Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Moniewski <monio>2020-02-17 14:31:38 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-02-17 15:24:07 +0300
commit67d12bb5192d04a596e216f63cff2875fdd8cfbf (patch)
treec4d866f343ec9b87f713ebd004a8f343ab6f5307 /source/blender/nodes
parentae9bbb4d0360aea694b46ee698d24dbc1476ebf3 (diff)
Shading: add direction modes and phase offset to wave texture node
* Direction mode X, Y and Z to align with axes rather than diagonal or spherical as previously. X is the new default, existing files will use diagonal or spherical for compatibility. * Phase offset to offset the wave along its direction, for purposes like animation and distortion. https://developer.blender.org/D6382
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_wave.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c
index b525f4897a9..457e85519b2 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c
@@ -27,6 +27,7 @@ static bNodeSocketTemplate sh_node_tex_wave_in[] = {
{SOCK_FLOAT, 1, N_("Distortion"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f},
{SOCK_FLOAT, 1, N_("Detail"), 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 16.0f},
{SOCK_FLOAT, 1, N_("Detail Scale"), 1.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f},
+ {SOCK_FLOAT, 1, N_("Phase Offset"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f},
{-1, 0, ""},
};
@@ -62,7 +63,9 @@ static void node_shader_init_tex_wave(bNodeTree *UNUSED(ntree), bNode *node)
BKE_texture_mapping_default(&tex->base.tex_mapping, TEXMAP_TYPE_POINT);
BKE_texture_colormapping_default(&tex->base.color_mapping);
tex->wave_type = SHD_WAVE_BANDS;
-
+ tex->bands_direction = SHD_WAVE_BANDS_DIRECTION_X;
+ tex->rings_direction = SHD_WAVE_RINGS_DIRECTION_X;
+ tex->wave_profile = SHD_WAVE_PROFILE_SIN;
node->storage = tex;
}
@@ -77,10 +80,19 @@ static int node_shader_gpu_tex_wave(GPUMaterial *mat,
NodeTexWave *tex = (NodeTexWave *)node->storage;
float wave_type = tex->wave_type;
+ float bands_direction = tex->bands_direction;
+ float rings_direction = tex->rings_direction;
float wave_profile = tex->wave_profile;
- return GPU_stack_link(
- mat, node, "node_tex_wave", in, out, GPU_constant(&wave_type), GPU_constant(&wave_profile));
+ return GPU_stack_link(mat,
+ node,
+ "node_tex_wave",
+ in,
+ out,
+ GPU_constant(&wave_type),
+ GPU_constant(&bands_direction),
+ GPU_constant(&rings_direction),
+ GPU_constant(&wave_profile));
}
/* node type definition */