Skip to content

Commit ee85ced

Browse files
Add MDL support for geomcolor nodes with index 0 (#2835)
Index 0 is mapped to scene::data_lookup_<ltype>("GEOMCOLOR0"). Zero is returned for all other indices (as before). This could be extended later with a generator option to specify the upper bound for the indices to be supported.
1 parent 3cf6abb commit ee85ced

2 files changed

Lines changed: 44 additions & 6 deletions

File tree

source/MaterialXGenMdl/mdl/materialx/stdlib_1_8.mdl

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ export using .::stdlib_1_7 import mx_tangent_vector3;
8080
export using .::stdlib_1_7 import mx_bitangent_vector3;
8181
export using .::stdlib_1_7 import mx_texcoord_vector2;
8282
export using .::stdlib_1_7 import mx_texcoord_vector3;
83-
export using .::stdlib_1_7 import mx_geomcolor_float;
84-
export using .::stdlib_1_7 import mx_geomcolor_color3;
85-
export using .::stdlib_1_7 import mx_geomcolor_color4;
8683
export using .::stdlib_1_7 import mx_time_float;
8784
export using .::stdlib_1_7 import mx_modulo_color3;
8885
export using .::stdlib_1_7 import mx_modulo_color4;
@@ -456,3 +453,43 @@ export float mx_frame_float()
456453
{
457454
return scene::data_lookup_float("FRAME", 1.0);
458455
}
456+
457+
export float mx_geomcolor_float(
458+
uniform int mxp_index = int(0)
459+
)
460+
[[
461+
anno::description("Node Group: geometric")
462+
]]
463+
{
464+
float defaultValue = float(0.0);
465+
return mxp_index == 0
466+
? scene::data_lookup_float("GEOMCOLOR0", defaultValue)
467+
: defaultValue;
468+
}
469+
470+
export color mx_geomcolor_color3(
471+
uniform int mxp_index = int(0)
472+
)
473+
[[
474+
anno::description("Node Group: geometric")
475+
]]
476+
{
477+
color defaultValue = color(0.0, 0.0, 0.0);
478+
return mxp_index == 0
479+
? scene::data_lookup_color("GEOMCOLOR0", defaultValue)
480+
: defaultValue;
481+
}
482+
483+
export core::color4 mx_geomcolor_color4(
484+
uniform int mxp_index = int(0)
485+
)
486+
[[
487+
anno::description("Node Group: geometric")
488+
]]
489+
{
490+
float4 defaultValue = float4(0.0, 0.0, 0.0, 0.0);
491+
float4 value = mxp_index == 0
492+
? scene::data_lookup_float4("GEOMCOLOR0", defaultValue)
493+
: defaultValue;
494+
return core::mk_color4(value.x, value.y, value.z, value.w);
495+
}

source/MaterialXGenMdl/mdl/materialx/stdlib_1_9.mdl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ export using .::stdlib_1_7 import mx_tangent_vector3;
8181
export using .::stdlib_1_7 import mx_bitangent_vector3;
8282
export using .::stdlib_1_7 import mx_texcoord_vector2;
8383
export using .::stdlib_1_7 import mx_texcoord_vector3;
84-
export using .::stdlib_1_7 import mx_geomcolor_float;
85-
export using .::stdlib_1_7 import mx_geomcolor_color3;
86-
export using .::stdlib_1_7 import mx_geomcolor_color4;
8784
export using .::stdlib_1_7 import mx_time_float;
8885
export using .::stdlib_1_7 import mx_modulo_color3;
8986
export using .::stdlib_1_7 import mx_modulo_color4;
@@ -331,6 +328,10 @@ export using .::stdlib_1_7 import mx_flake3d;
331328
export using .::stdlib_1_7 import mx_combine2_color4CF;
332329

333330
export using .::stdlib_1_7 import mx_geompropvalue_string;
331+
332+
export using .::stdlib_1_8 import mx_geomcolor_float;
333+
export using .::stdlib_1_8 import mx_geomcolor_color3;
334+
export using .::stdlib_1_8 import mx_geomcolor_color4;
334335
export using .::stdlib_1_8 import mx_geompropvalue_boolean;
335336
export using .::stdlib_1_8 import mx_geompropvalue_integer;
336337
export using .::stdlib_1_8 import mx_geompropvalue_float;

0 commit comments

Comments
 (0)