[Bf-blender-cvs] [175e041] object_nodes: Texture coordinates node.
Lukas Tönne
noreply at git.blender.org
Tue Nov 24 09:43:40 CET 2015
Commit: 175e041ddf26e84f50b0d6533dfcfb033989b62e
Author: Lukas Tönne
Date: Thu Oct 29 12:31:06 2015 +0100
Branches: object_nodes
https://developer.blender.org/rB175e041ddf26e84f50b0d6533dfcfb033989b62e
Texture coordinates node.
===================================================================
M source/blender/blenvm/bvm/bvm_eval.cc
M source/blender/blenvm/bvm/bvm_opcode.h
M source/blender/blenvm/compile/bvm_nodegraph.cc
M source/blender/blenvm/intern/bvm_api.cc
===================================================================
diff --git a/source/blender/blenvm/bvm/bvm_eval.cc b/source/blender/blenvm/bvm/bvm_eval.cc
index 988a1a2..6a0b4dd 100644
--- a/source/blender/blenvm/bvm/bvm_eval.cc
+++ b/source/blender/blenvm/bvm/bvm_eval.cc
@@ -366,6 +366,11 @@ static void eval_op_normalize_float3(float *stack, StackIndex offset, StackIndex
stack_store_float(stack, offset_val, l);
}
+static void eval_op_tex_coord(const EvalData *data, float *stack, StackIndex offset)
+{
+ stack_store_float3(stack, offset, data->texture.co);
+}
+
static void eval_op_effector_transform(const EvalGlobals *globals, float *stack, int object_index, StackIndex offset_tfm)
{
Object *ob = globals->objects[object_index];
@@ -682,6 +687,13 @@ void EvalContext::eval_instructions(const EvalGlobals *globals, const EvalData *
eval_op_normalize_float3(stack, offset, offset_vec, offset_val);
break;
}
+
+ case OP_TEX_COORD: {
+ StackIndex offset = expr->read_stack_index(&instr);
+ eval_op_tex_coord(data, stack, offset);
+ break;
+ }
+
case OP_EFFECTOR_TRANSFORM: {
int object_index = expr->read_int(&instr);
StackIndex offset_tfm = expr->read_stack_index(&instr);
diff --git a/source/blender/blenvm/bvm/bvm_opcode.h b/source/blender/blenvm/bvm/bvm_opcode.h
index 62f6957..307fb93 100644
--- a/source/blender/blenvm/bvm/bvm_opcode.h
+++ b/source/blender/blenvm/bvm/bvm_opcode.h
@@ -80,10 +80,13 @@ enum OpCode {
OP_CROSS_FLOAT3,
OP_NORMALIZE_FLOAT3,
+ OP_TEX_COORD,
+
OP_EFFECTOR_TRANSFORM,
OP_EFFECTOR_CLOSEST_POINT,
OP_END,
+
// OP_JUMP,
// OP_JUMP_IF_ZERO,
// OP_JUMP_IF_ONE,
diff --git a/source/blender/blenvm/compile/bvm_nodegraph.cc b/source/blender/blenvm/compile/bvm_nodegraph.cc
index 44697a0..2e50624 100644
--- a/source/blender/blenvm/compile/bvm_nodegraph.cc
+++ b/source/blender/blenvm/compile/bvm_nodegraph.cc
@@ -591,6 +591,8 @@ OpCode get_opcode_from_node_type(const string &node)
NODETYPE(CROSS_FLOAT3);
NODETYPE(NORMALIZE_FLOAT3);
+ NODETYPE(TEX_COORD);
+
NODETYPE(EFFECTOR_TRANSFORM);
NODETYPE(EFFECTOR_CLOSEST_POINT);
@@ -698,6 +700,9 @@ void register_opcode_node_types()
nt->add_output("vector", BVM_FLOAT3, float3(0.0f, 0.0f, 0.0f));
nt->add_output("value", BVM_FLOAT, 0.0f);
+ nt = NodeGraph::add_node_type("TEX_COORD");
+ nt->add_output("value", BVM_FLOAT3, float3(0.0f, 0.0f, 0.0f));
+
nt = NodeGraph::add_node_type("EFFECTOR_TRANSFORM");
nt->add_input("object", BVM_INT, 0, true);
nt->add_output("transform", BVM_MATRIX44, matrix44::identity());
diff --git a/source/blender/blenvm/intern/bvm_api.cc b/source/blender/blenvm/intern/bvm_api.cc
index 9cfaa74..4ae2465 100644
--- a/source/blender/blenvm/intern/bvm_api.cc
+++ b/source/blender/blenvm/intern/bvm_api.cc
@@ -518,6 +518,10 @@ struct TextureNodeParser : public bNodeParser {
comp->set_graph_output("normal", node, "value");
}
}
+ else if (type == "TextureNodeCoordinates") {
+ bvm::NodeInstance *node = comp->add_node("TEX_COORD", bvm::string(bnode->name));
+ comp->map_output_socket(bnode, 0, node, "value");
+ }
}
};
More information about the Bf-blender-cvs
mailing list