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
This commit is contained in:
Bartosz Moniewski
2020-02-17 12:31:38 +01:00
committed by Brecht Van Lommel
parent ae9bbb4d03
commit 67d12bb519
13 changed files with 354 additions and 58 deletions

View File

@@ -4556,9 +4556,30 @@ static void def_sh_tex_wave(StructRNA *srna)
{0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem prop_wave_bands_direction_items[] = {
{SHD_WAVE_BANDS_DIRECTION_X, "X", 0, "X", "Bands across X axis"},
{SHD_WAVE_BANDS_DIRECTION_Y, "Y", 0, "Y", "Bands across Y axis"},
{SHD_WAVE_BANDS_DIRECTION_Z, "Z", 0, "Z", "Bands across Z axis"},
{SHD_WAVE_BANDS_DIRECTION_DIAGONAL, "DIAGONAL", 0, "Diagonal", "Bands across diagonal axis"},
{0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem prop_wave_rings_direction_items[] = {
{SHD_WAVE_RINGS_DIRECTION_X, "X", 0, "X", "Rings along X axis"},
{SHD_WAVE_RINGS_DIRECTION_Y, "Y", 0, "Y", "Rings along Y axis"},
{SHD_WAVE_RINGS_DIRECTION_Z, "Z", 0, "Z", "Rings along Z axis"},
{SHD_WAVE_RINGS_DIRECTION_SPHERICAL,
"SPHERICAL",
0,
"Spherical",
"Rings along spherical distance"},
{0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_wave_profile_items[] = {
{SHD_WAVE_PROFILE_SIN, "SIN", 0, "Sine", "Use a standard sine profile"},
{SHD_WAVE_PROFILE_SAW, "SAW", 0, "Saw", "Use a sawtooth profile"},
{SHD_WAVE_PROFILE_TRI, "TRI", 0, "Triangle", "Use a triangle profile"},
{0, NULL, 0, NULL, NULL},
};
@@ -4573,6 +4594,18 @@ static void def_sh_tex_wave(StructRNA *srna)
RNA_def_property_ui_text(prop, "Wave Type", "");
RNA_def_property_update(prop, 0, "rna_Node_update");
prop = RNA_def_property(srna, "bands_direction", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "bands_direction");
RNA_def_property_enum_items(prop, prop_wave_bands_direction_items);
RNA_def_property_ui_text(prop, "Bands Direction", "");
RNA_def_property_update(prop, 0, "rna_Node_update");
prop = RNA_def_property(srna, "rings_direction", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "rings_direction");
RNA_def_property_enum_items(prop, prop_wave_rings_direction_items);
RNA_def_property_ui_text(prop, "Rings Direction", "");
RNA_def_property_update(prop, 0, "rna_Node_update");
prop = RNA_def_property(srna, "wave_profile", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "wave_profile");
RNA_def_property_enum_items(prop, prop_wave_profile_items);