forked from blender/blender
Code improvements + Mix node #30
@ -291,31 +291,31 @@ NodeItem NodeItem::dotproduct(const NodeItem &other) const
|
||||
float f = 0.0f;
|
||||
switch (d.type()) {
|
||||
case Type::Float: {
|
||||
f = value->asA<float>();
|
||||
f = d.value->asA<float>();
|
||||
break;
|
||||
}
|
||||
case Type::Vector2: {
|
||||
auto v = value->asA<MaterialX::Vector2>();
|
||||
auto v = d.value->asA<MaterialX::Vector2>();
|
||||
f = v[0] + v[1];
|
||||
break;
|
||||
}
|
||||
case Type::Vector3: {
|
||||
auto v = value->asA<MaterialX::Vector3>();
|
||||
auto v = d.value->asA<MaterialX::Vector3>();
|
||||
f = v[0] + v[1] + v[2];
|
||||
break;
|
||||
}
|
||||
case Type::Vector4: {
|
||||
auto v = value->asA<MaterialX::Vector4>();
|
||||
auto v = d.value->asA<MaterialX::Vector4>();
|
||||
f = v[0] + v[1] + v[2] + v[3];
|
||||
break;
|
||||
}
|
||||
case Type::Color3: {
|
||||
auto v = value->asA<MaterialX::Color3>();
|
||||
auto v = d.value->asA<MaterialX::Color3>();
|
||||
f = v[0] + v[1] + v[2];
|
||||
break;
|
||||
}
|
||||
case Type::Color4: {
|
||||
auto v = value->asA<MaterialX::Color4>();
|
||||
auto v = d.value->asA<MaterialX::Color4>();
|
||||
f = v[0] + v[1] + v[2] + v[3];
|
||||
break;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ class GroupNodeParser;
|
||||
|
||||
/**
|
||||
* This is base abstraction class for parsing Blender nodes into MaterialX nodes.
|
||||
* NodeParser::compute() should be overrides in child classes.
|
||||
* NodeParser::compute() should be overrided in child classes.
|
||||
*/
|
||||
class NodeParser {
|
||||
protected:
|
||||
|
@ -219,7 +219,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
bool invert = node_->custom2;
|
||||
|
||||
NodeItem vector = get_input_value("Vector", NodeItem::Type::Vector3);
|
||||
NodeItem center = get_input_value("Center", NodeItem::Type::Vector3);
|
||||
NodeItem center = get_input_value("Center", NodeItem::Type::Vector3) *
|
||||
BogdanNagirniak marked this conversation as resolved
Outdated
|
||||
val(MaterialX::Vector3(1.0f, 1.0f, -1.0f));
|
||||
vector = vector - center;
|
||||
|
||||
if (mode == NODE_VECTOR_ROTATE_TYPE_EULER_XYZ) {
|
||||
|
Loading…
Reference in New Issue
Block a user
To perform the same result as Blender it requires invert Z.
NodeItem center = get_input_value("Center", NodeItem::Type::Vector3) * val(MaterialX::Vector3(1.0f, 1.0f, -1.0f))