Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/intern/node_tree_multi_function.cc
| Show First 20 Lines • Show All 202 Lines • ▼ Show 20 Lines | static DataTypeConversions create_implicit_conversions() | ||||
| add_implicit_conversion<float3, Color4f>( | add_implicit_conversion<float3, Color4f>( | ||||
| conversions, "float3 to Color4f", [](float3 a) { return Color4f(a.x, a.y, a.z, 1.0f); }); | conversions, "float3 to Color4f", [](float3 a) { return Color4f(a.x, a.y, a.z, 1.0f); }); | ||||
| add_implicit_conversion<Color4f, float3>( | add_implicit_conversion<Color4f, float3>( | ||||
| conversions, "Color4f to float3", [](Color4f a) { return float3(a.r, a.g, a.b); }); | conversions, "Color4f to float3", [](Color4f a) { return float3(a.r, a.g, a.b); }); | ||||
| add_implicit_conversion<float, Color4f>( | add_implicit_conversion<float, Color4f>( | ||||
| conversions, "float to Color4f", [](float a) { return Color4f(a, a, a, 1.0f); }); | conversions, "float to Color4f", [](float a) { return Color4f(a, a, a, 1.0f); }); | ||||
| add_implicit_conversion<Color4f, float>( | add_implicit_conversion<Color4f, float>( | ||||
| conversions, "Color4f to float", [](Color4f a) { return rgb_to_grayscale(a); }); | conversions, "Color4f to float", [](Color4f a) { return rgb_to_grayscale(a); }); | ||||
| add_implicit_conversion<float3, bool>( | |||||
| conversions, "float3 to boolean", [](float3 a) { return a.length() == 0.0f; }); | |||||
JacquesLucke: I guess it would be good to have some kind of conversion from bool to float3?
Also, use `a. | |||||
| return conversions; | return conversions; | ||||
| } | } | ||||
| const DataTypeConversions &get_implicit_type_conversions() | const DataTypeConversions &get_implicit_type_conversions() | ||||
| { | { | ||||
| static const DataTypeConversions conversions = create_implicit_conversions(); | static const DataTypeConversions conversions = create_implicit_conversions(); | ||||
| return conversions; | return conversions; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 278 Lines • Show Last 20 Lines | |||||
I guess it would be good to have some kind of conversion from bool to float3?
Also, use a.length_squared() instead of a.length(). This can end up in hot loops.