Blender V2.61 - r43446
Defines | Typedefs | Functions | Variables

node_texture_proc.c File Reference

#include "node_texture_util.h"
#include "NOD_texture.h"
#include "RE_shader_ext.h"

Go to the source code of this file.

Defines

#define I   2
#define COMMON_INPUTS
#define ProcNoInputs(name)
#define ProcDef(name)
#define TexDef(TEXTYPE, outputs, name, Name)
#define C   outputs_color_only
#define CV   outputs_both

Typedefs

typedef void(* MapFn )(Tex *tex, bNodeStack **in, TexParams *p, short thread)

Functions

static void do_proc (float *result, TexParams *p, float *col1, float *col2, char is_normal, Tex *tex, short thread)
static void texfn (float *result, TexParams *p, bNode *node, bNodeStack **in, char is_normal, MapFn map_inputs, short thread)
static int count_outputs (bNode *node)
static void voronoi_map_inputs (Tex *tex, bNodeStack **in, TexParams *p, short thread)
 ProcDef (voronoi)
 ProcNoInputs (blend)
static void magic_map_inputs (Tex *tex, bNodeStack **in, TexParams *p, short thread)
 ProcDef (magic)
static void marble_map_inputs (Tex *tex, bNodeStack **in, TexParams *p, short thread)
 ProcDef (marble)
static void clouds_map_inputs (Tex *tex, bNodeStack **in, TexParams *p, short thread)
 ProcDef (clouds)
static void distnoise_map_inputs (Tex *tex, bNodeStack **in, TexParams *p, short thread)
 ProcDef (distnoise)
static void wood_map_inputs (Tex *tex, bNodeStack **in, TexParams *p, short thread)
 ProcDef (wood)
static void musgrave_map_inputs (Tex *tex, bNodeStack **in, TexParams *p, short thread)
 ProcDef (musgrave)
 ProcNoInputs (noise)
static void stucci_map_inputs (Tex *tex, bNodeStack **in, TexParams *p, short thread)
 ProcDef (stucci)

Variables

static bNodeSocketTemplate outputs_both []
static bNodeSocketTemplate outputs_color_only []
static bNodeSocketTemplate voronoi_inputs []

Detailed Description

Definition in file node_texture_proc.c.


Define Documentation

#define C   outputs_color_only
#define COMMON_INPUTS
Value:
{ SOCK_RGBA, 1, "Color 1", 0.0f, 0.0f, 0.0f, 1.0f }, \
    { SOCK_RGBA, 1, "Color 2", 1.0f, 1.0f, 1.0f, 1.0f }

Definition at line 55 of file node_texture_proc.c.

Referenced by ProcDef(), and ProcNoInputs().

#define CV   outputs_both

Definition at line 314 of file node_texture_proc.c.

#define I   2
#define ProcDef (   name)
Value:
static void name##_colorfn(float *result, TexParams *p, bNode *node, bNodeStack **in, short thread)  \
        {                                                                                                    \
                texfn(result, p, node, in, 0, &name##_map_inputs, thread);                               \
        }                                                                                                    \
        static void name##_normalfn(float *result, TexParams *p, bNode *node, bNodeStack **in, short thread) \
        {                                                                                                    \
                texfn(result, p, node, in, 1, &name##_map_inputs, thread);                               \
        }                                                                                                    \
        static void name##_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)                  \
        {                                                                                                    \
                int outs = count_outputs(node);                                                              \
                if(outs >= 1) tex_output(node, in, out[0], &name##_colorfn, data);                                 \
                if(outs >= 2) tex_output(node, in, out[1], &name##_normalfn, data);                                \
        }

Definition at line 123 of file node_texture_proc.c.

#define ProcNoInputs (   name)
Value:
static void name##_map_inputs(Tex *UNUSED(tex), bNodeStack **UNUSED(in), TexParams *UNUSED(p), short UNUSED(thread)) \
        {}

Definition at line 119 of file node_texture_proc.c.

#define TexDef (   TEXTYPE,
  outputs,
  name,
  Name 
)
Value:
void register_node_type_tex_proc_##name(bNodeTreeType *ttype) \
{ \
    static bNodeType ntype; \
    \
    node_type_base(ttype, &ntype, TEX_NODE_PROC+TEXTYPE, Name, NODE_CLASS_TEXTURE, NODE_PREVIEW|NODE_OPTIONS); \
    node_type_socket_templates(&ntype, name##_inputs, outputs); \
    node_type_size(&ntype, 140, 80, 140); \
    node_type_init(&ntype, init); \
    node_type_storage(&ntype, "Tex", node_free_standard_storage, node_copy_standard_storage); \
    node_type_exec(&ntype, name##_exec); \
    \
    nodeRegisterType(ttype, &ntype); \
}

Definition at line 298 of file node_texture_proc.c.


Typedef Documentation

typedef void(* MapFn)(Tex *tex, bNodeStack **in, TexParams *p, short thread)

Definition at line 86 of file node_texture_proc.c.


Function Documentation

static void clouds_map_inputs ( Tex tex,
bNodeStack **  in,
TexParams p,
short  thread 
) [static]

Definition at line 205 of file node_texture_proc.c.

References I, Tex::noisesize, and tex_input_value().

static int count_outputs ( bNode node) [static]

Definition at line 107 of file node_texture_proc.c.

References ListBase::first, bNodeSocket::next, and bNode::outputs.

static void distnoise_map_inputs ( Tex tex,
bNodeStack **  in,
TexParams p,
short  thread 
) [static]

Definition at line 218 of file node_texture_proc.c.

References Tex::dist_amount, I, Tex::noisesize, and tex_input_value().

static void do_proc ( float *  result,
TexParams p,
float *  col1,
float *  col2,
char  is_normal,
Tex tex,
short  thread 
) [static]
static void magic_map_inputs ( Tex tex,
bNodeStack **  in,
TexParams p,
short  thread 
) [static]

Definition at line 179 of file node_texture_proc.c.

References I, tex_input_value(), and Tex::turbul.

static void marble_map_inputs ( Tex tex,
bNodeStack **  in,
TexParams p,
short  thread 
) [static]

Definition at line 192 of file node_texture_proc.c.

References I, Tex::noisesize, tex_input_value(), and Tex::turbul.

static void musgrave_map_inputs ( Tex tex,
bNodeStack **  in,
TexParams p,
short  thread 
) [static]
ProcDef ( wood  )

Definition at line 237 of file node_texture_proc.c.

References COMMON_INPUTS, PROP_UNSIGNED, and SOCK_FLOAT.

ProcDef ( voronoi  )

Definition at line 163 of file node_texture_proc.c.

References COMMON_INPUTS.

ProcDef ( magic  )

Definition at line 183 of file node_texture_proc.c.

References COMMON_INPUTS, PROP_UNSIGNED, and SOCK_FLOAT.

ProcDef ( stucci  )
ProcDef ( marble  )

Definition at line 197 of file node_texture_proc.c.

References COMMON_INPUTS, PROP_UNSIGNED, and SOCK_FLOAT.

ProcDef ( musgrave  )

Definition at line 258 of file node_texture_proc.c.

References COMMON_INPUTS.

ProcDef ( clouds  )

Definition at line 209 of file node_texture_proc.c.

References COMMON_INPUTS, PROP_UNSIGNED, and SOCK_FLOAT.

ProcDef ( distnoise  )

Definition at line 223 of file node_texture_proc.c.

References COMMON_INPUTS, PROP_UNSIGNED, and SOCK_FLOAT.

ProcNoInputs ( noise  )

Definition at line 265 of file node_texture_proc.c.

References COMMON_INPUTS, PROP_UNSIGNED, and SOCK_FLOAT.

ProcNoInputs ( blend  )

Definition at line 170 of file node_texture_proc.c.

References COMMON_INPUTS, PROP_UNSIGNED, and SOCK_FLOAT.

static void stucci_map_inputs ( Tex tex,
bNodeStack **  in,
TexParams p,
short  thread 
) [static]

Definition at line 275 of file node_texture_proc.c.

References I, Tex::noisesize, tex_input_value(), and Tex::turbul.

static void texfn ( float *  result,
TexParams p,
bNode node,
bNodeStack **  in,
char  is_normal,
MapFn  map_inputs,
short  thread 
) [static]

Definition at line 88 of file node_texture_proc.c.

References do_proc(), bNode::storage, and tex_input_rgba().

Referenced by tex_output().

static void voronoi_map_inputs ( Tex tex,
bNodeStack **  in,
TexParams p,
short  thread 
) [static]
static void wood_map_inputs ( Tex tex,
bNodeStack **  in,
TexParams p,
short  thread 
) [static]

Definition at line 232 of file node_texture_proc.c.

References I, Tex::noisesize, tex_input_value(), and Tex::turbul.


Variable Documentation

Initial value:
 {
    { SOCK_RGBA, 0, "Color",  1.0f, 0.0f, 0.0f, 1.0f },
    { SOCK_VECTOR, 0, "Normal", 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, PROP_DIRECTION },
    { -1, 0, "" }
}

Definition at line 43 of file node_texture_proc.c.

Initial value:
 {
    { SOCK_RGBA, 0, "Color" },
    { -1, 0, "" }
}

Definition at line 48 of file node_texture_proc.c.

Initial value:
 {
    COMMON_INPUTS,
    { SOCK_FLOAT, 1, "W1", 1.0f, 0.0f, 0.0f, 0.0f,   -2.0f, 2.0f, PROP_NONE },
    { SOCK_FLOAT, 1, "W2", 0.0f, 0.0f, 0.0f, 0.0f,   -2.0f, 2.0f, PROP_NONE },
    { SOCK_FLOAT, 1, "W3", 0.0f, 0.0f, 0.0f, 0.0f,   -2.0f, 2.0f, PROP_NONE },
    { SOCK_FLOAT, 1, "W4", 0.0f, 0.0f, 0.0f, 0.0f,   -2.0f, 2.0f, PROP_NONE },
    
    { SOCK_FLOAT, 1, "iScale", 1.0f, 0.0f, 0.0f, 0.0f,    0.01f,  10.0f, PROP_UNSIGNED },
    { SOCK_FLOAT, 1, "Size",   0.25f, 0.0f, 0.0f, 0.0f,   0.0001f, 4.0f, PROP_UNSIGNED },
    
    { -1, 0, "" }
}

Definition at line 141 of file node_texture_proc.c.