Blender V4.3
node_texture_proc.cc File Reference
#include "BKE_material.h"
#include "BKE_texture.h"
#include "BLI_math_vector.h"
#include "DNA_material_types.h"
#include "node_texture_util.hh"
#include "node_util.hh"
#include "RE_texture.h"

Go to the source code of this file.

Macros

#define I   2 /* count */
 
#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

using MapFn = void (*)(Tex *tex, bNodeStack **in, TexParams *p, const short thread)
 

Functions

static void do_proc (float *result, TexParams *p, const float col1[4], const float col2[4], Tex *tex, const short thread)
 
static void texfn (float *result, TexParams *p, bNode *node, bNodeStack **in, 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)
 
 ProcDef (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)
 
 ProcDef (noise)
 
static void stucci_map_inputs (Tex *tex, bNodeStack **in, TexParams *p, short thread)
 
 ProcDef (stucci)
 
static void init (bNodeTree *, bNode *node)
 
 TexDef (TEX_VORONOI, CV, voronoi, "Voronoi") TexDef(TEX_BLEND
 
 TexDef (TEX_MAGIC, C, magic, "Magic") TexDef(TEX_MARBLE
 
 TexDef (TEX_CLOUDS, CV, clouds, "Clouds") TexDef(TEX_WOOD
 
 TexDef (TEX_MUSGRAVE, CV, musgrave, "Musgrave") TexDef(TEX_NOISE
 
 TexDef (TEX_STUCCI, CV, stucci, "Stucci")
 
 TexDef (TEX_DISTNOISE, CV, distnoise, "Distorted Noise")
 

Variables

static blender::bke::bNodeSocketTemplate outputs_both []
 
static blender::bke::bNodeSocketTemplate outputs_color_only []
 
static blender::bke::bNodeSocketTemplate voronoi_inputs []
 
static blender::bke::bNodeSocketTemplate blend_inputs [] = {COMMON_INPUTS, {-1, ""}}
 
static blender::bke::bNodeSocketTemplate magic_inputs []
 
static blender::bke::bNodeSocketTemplate marble_inputs []
 
static blender::bke::bNodeSocketTemplate clouds_inputs []
 
static blender::bke::bNodeSocketTemplate distnoise_inputs []
 
static blender::bke::bNodeSocketTemplate wood_inputs []
 
static blender::bke::bNodeSocketTemplate musgrave_inputs []
 
static blender::bke::bNodeSocketTemplate noise_inputs [] = {COMMON_INPUTS, {-1, ""}}
 
static blender::bke::bNodeSocketTemplate stucci_inputs []
 
 C
 
 blend
 
 Blend
 
 CV
 
 marble
 
 Marble
 
 wood
 
 Wood
 
 noise
 
 Noise
 

Macro Definition Documentation

◆ C

Definition at line 271 of file node_texture_proc.cc.

◆ COMMON_INPUTS

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

Definition at line 29 of file node_texture_proc.cc.

◆ CV

◆ I

◆ ProcDef

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

Definition at line 91 of file node_texture_proc.cc.

◆ ProcNoInputs

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

Definition at line 85 of file node_texture_proc.cc.

◆ TexDef

#define TexDef ( TEXTYPE,
outputs,
name,
Name )
Value:
void register_node_type_tex_proc_##name(void) \
{ \
static blender::bke::bNodeType ntype; \
\
tex_node_type_base(&ntype, TEX_NODE_PROC + TEXTYPE, Name, NODE_CLASS_TEXTURE); \
blender::bke::node_type_socket_templates(&ntype, name##_inputs, outputs); \
blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::Middle); \
ntype.initfunc = init; \
blender::bke::node_type_storage( \
ntype.exec_fn = name##_exec; \
ntype.flag |= NODE_PREVIEW; \
\
blender::bke::node_register_type(&ntype); \
}
#define NODE_CLASS_TEXTURE
Definition BKE_node.hh:414
@ NODE_PREVIEW
void init()
void node_free_standard_storage(bNode *node)
Definition node_util.cc:46
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
Definition node_util.cc:58
Defines a node type.
Definition BKE_node.hh:218
NodeExecFunction exec_fn
Definition BKE_node.hh:316
void(* initfunc)(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:267

Definition at line 254 of file node_texture_proc.cc.

Typedef Documentation

◆ MapFn

using MapFn = void (*)(Tex *tex, bNodeStack **in, TexParams *p, const short thread)

Definition at line 59 of file node_texture_proc.cc.

Function Documentation

◆ clouds_map_inputs()

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

Definition at line 168 of file node_texture_proc.cc.

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

◆ count_outputs()

static int count_outputs ( bNode * node)
static

Definition at line 74 of file node_texture_proc.cc.

References LISTBASE_FOREACH.

◆ distnoise_map_inputs()

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

Definition at line 180 of file node_texture_proc.cc.

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

◆ do_proc()

static void do_proc ( float * result,
TexParams * p,
const float col1[4],
const float col2[4],
Tex * tex,
const short thread )
static

◆ init()

static void init ( bNodeTree * ,
bNode * node )
static

◆ magic_map_inputs()

static void magic_map_inputs ( Tex * tex,
bNodeStack ** in,
TexParams * p,
short thread )
static

Definition at line 144 of file node_texture_proc.cc.

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

◆ marble_map_inputs()

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

Definition at line 156 of file node_texture_proc.cc.

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

◆ musgrave_map_inputs()

static void musgrave_map_inputs ( Tex * tex,
bNodeStack ** in,
TexParams * p,
short thread )
static

◆ ProcDef() [1/10]

ProcDef ( blend )

◆ ProcDef() [2/10]

ProcDef ( clouds )

◆ ProcDef() [3/10]

ProcDef ( distnoise )

◆ ProcDef() [4/10]

ProcDef ( magic )

◆ ProcDef() [5/10]

ProcDef ( marble )

◆ ProcDef() [6/10]

ProcDef ( musgrave )

◆ ProcDef() [7/10]

ProcDef ( noise )

◆ ProcDef() [8/10]

ProcDef ( stucci )

◆ ProcDef() [9/10]

ProcDef ( voronoi )

◆ ProcDef() [10/10]

ProcDef ( wood )

◆ ProcNoInputs() [1/2]

ProcNoInputs ( blend )

◆ ProcNoInputs() [2/2]

ProcNoInputs ( noise )

◆ stucci_map_inputs()

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

Definition at line 231 of file node_texture_proc.cc.

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

◆ TexDef() [1/6]

TexDef ( TEX_CLOUDS ,
CV ,
clouds ,
"Clouds"  )

◆ TexDef() [2/6]

TexDef ( TEX_DISTNOISE ,
CV ,
distnoise ,
"Distorted Noise"  )

◆ TexDef() [3/6]

TexDef ( TEX_MAGIC ,
C ,
magic ,
"Magic"  )

◆ TexDef() [4/6]

TexDef ( TEX_MUSGRAVE ,
CV ,
musgrave ,
"Musgrave"  )

◆ TexDef() [5/6]

TexDef ( TEX_STUCCI ,
CV ,
stucci ,
"Stucci"  )

◆ TexDef() [6/6]

TexDef ( TEX_VORONOI ,
CV ,
voronoi ,
"Voronoi"  )

◆ texfn()

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

Definition at line 61 of file node_texture_proc.cc.

References do_proc(), tex, and tex_input_rgba().

Referenced by tex_output().

◆ voronoi_map_inputs()

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

◆ wood_map_inputs()

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

Definition at line 193 of file node_texture_proc.cc.

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

Variable Documentation

◆ Blend

◆ blend

◆ blend_inputs

blender::bke::bNodeSocketTemplate blend_inputs[] = {COMMON_INPUTS, {-1, ""}}
static

Definition at line 135 of file node_texture_proc.cc.

◆ C

C

Definition at line 274 of file node_texture_proc.cc.

◆ clouds_inputs

blender::bke::bNodeSocketTemplate clouds_inputs[]
static
Initial value:
= {
{SOCK_FLOAT, N_("Size"), 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f, PROP_UNSIGNED},
{-1, ""}}
@ SOCK_FLOAT
@ PROP_UNSIGNED
Definition RNA_types.hh:152
#define COMMON_INPUTS
#define N_(msgid)

Definition at line 164 of file node_texture_proc.cc.

◆ CV

CV

Definition at line 275 of file node_texture_proc.cc.

◆ distnoise_inputs

blender::bke::bNodeSocketTemplate distnoise_inputs[]
static
Initial value:
= {
{SOCK_FLOAT, N_("Size"), 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f, PROP_UNSIGNED},
{SOCK_FLOAT, N_("Distortion"), 1.00f, 0.0f, 0.0f, 0.0f, 0.0000f, 10.0f, PROP_UNSIGNED},
{-1, ""}}

Definition at line 175 of file node_texture_proc.cc.

◆ magic_inputs

blender::bke::bNodeSocketTemplate magic_inputs[]
static
Initial value:
= {
{SOCK_FLOAT, N_("Turbulence"), 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f, PROP_UNSIGNED},
{-1, ""}}

Definition at line 140 of file node_texture_proc.cc.

◆ Marble

Marble

Definition at line 275 of file node_texture_proc.cc.

◆ marble

marble

Definition at line 275 of file node_texture_proc.cc.

Referenced by multitex().

◆ marble_inputs

blender::bke::bNodeSocketTemplate marble_inputs[]
static
Initial value:
= {
{SOCK_FLOAT, N_("Size"), 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f, PROP_UNSIGNED},
{SOCK_FLOAT, N_("Turbulence"), 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f, PROP_UNSIGNED},
{-1, ""}}

Definition at line 151 of file node_texture_proc.cc.

◆ musgrave_inputs

blender::bke::bNodeSocketTemplate musgrave_inputs[]
static
Initial value:
= {
{SOCK_FLOAT, N_("H"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f, PROP_UNSIGNED},
{SOCK_FLOAT, N_("Lacunarity"), 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 6.0f, PROP_UNSIGNED},
{SOCK_FLOAT, N_("Octaves"), 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 8.0f, PROP_UNSIGNED},
{SOCK_FLOAT, N_("iScale"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f, PROP_UNSIGNED},
{SOCK_FLOAT, N_("Size"), 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f, PROP_UNSIGNED},
{-1, ""}}

Definition at line 201 of file node_texture_proc.cc.

◆ Noise

Noise

Definition at line 277 of file node_texture_proc.cc.

Referenced by FrsNoise_init().

◆ noise

◆ noise_inputs

blender::bke::bNodeSocketTemplate noise_inputs[] = {COMMON_INPUTS, {-1, ""}}
static

Definition at line 221 of file node_texture_proc.cc.

◆ outputs_both

blender::bke::bNodeSocketTemplate outputs_both[]
static
Initial value:
= {
{SOCK_RGBA, N_("Color"), 1.0f, 0.0f, 0.0f, 1.0f}, {-1, ""}}

Definition at line 22 of file node_texture_proc.cc.

◆ outputs_color_only

blender::bke::bNodeSocketTemplate outputs_color_only[]
static
Initial value:
= {{SOCK_RGBA, N_("Color")},
{-1, ""}}

Definition at line 24 of file node_texture_proc.cc.

◆ stucci_inputs

blender::bke::bNodeSocketTemplate stucci_inputs[]
static
Initial value:
= {
{SOCK_FLOAT, N_("Size"), 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f, PROP_UNSIGNED},
{SOCK_FLOAT, N_("Turbulence"), 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f, PROP_UNSIGNED},
{-1, ""}}

Definition at line 226 of file node_texture_proc.cc.

◆ voronoi_inputs

blender::bke::bNodeSocketTemplate voronoi_inputs[]
static
Initial value:
= {
{SOCK_FLOAT, N_("W1"), 1.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f, PROP_NONE},
{SOCK_FLOAT, N_("W2"), 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f, PROP_NONE},
{SOCK_FLOAT, N_("W3"), 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f, PROP_NONE},
{SOCK_FLOAT, N_("W4"), 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f, PROP_NONE},
{SOCK_FLOAT, N_("iScale"), 1.0f, 0.0f, 0.0f, 0.0f, 0.01f, 10.0f, PROP_UNSIGNED},
{SOCK_FLOAT, N_("Size"), 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 4.0f, PROP_UNSIGNED},
{-1, ""}}
@ PROP_NONE
Definition RNA_types.hh:136

Definition at line 111 of file node_texture_proc.cc.

◆ Wood

Wood

Definition at line 276 of file node_texture_proc.cc.

◆ wood

wood

Definition at line 276 of file node_texture_proc.cc.

Referenced by multitex().

◆ wood_inputs

blender::bke::bNodeSocketTemplate wood_inputs[]
static
Initial value:
= {
{SOCK_FLOAT, N_("Size"), 0.25f, 0.0f, 0.0f, 0.0f, 0.0001f, 2.0f, PROP_UNSIGNED},
{SOCK_FLOAT, N_("Turbulence"), 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 200.0f, PROP_UNSIGNED},
{-1, ""}}

Definition at line 188 of file node_texture_proc.cc.