[Bf-blender-cvs] [92f55bc] object_nodes: BVM node for combining dupli lists.
Lukas Tönne
noreply at git.blender.org
Wed Dec 23 14:46:02 CET 2015
Commit: 92f55bcf876081ac36b9c1f8a83632692a7a8147
Author: Lukas Tönne
Date: Wed Dec 23 13:18:45 2015 +0100
Branches: object_nodes
https://developer.blender.org/rB92f55bcf876081ac36b9c1f8a83632692a7a8147
BVM node for combining dupli lists.
===================================================================
M source/blender/blenvm/bvm/bvm_eval.cc
M source/blender/blenvm/bvm/bvm_eval_common.h
M source/blender/blenvm/bvm/bvm_opcode.h
M source/blender/blenvm/compile/bvm_nodegraph.cc
===================================================================
diff --git a/source/blender/blenvm/bvm/bvm_eval.cc b/source/blender/blenvm/bvm/bvm_eval.cc
index 7db1e6c..dc6500a 100644
--- a/source/blender/blenvm/bvm/bvm_eval.cc
+++ b/source/blender/blenvm/bvm/bvm_eval.cc
@@ -322,6 +322,20 @@ static void eval_op_make_dupli(float *stack, StackIndex offset_object, StackInde
stack_store_duplis(stack, offset_dupli, list);
}
+static void eval_op_duplis_combine(float *stack, StackIndex offset_duplis_a, StackIndex offset_duplis_b,
+ StackIndex offset_duplis)
+{
+ const DupliList *a = stack_load_duplis(stack, offset_duplis_a);
+ const DupliList *b = stack_load_duplis(stack, offset_duplis_b);
+
+ DupliList *result = new DupliList();
+ result->reserve(a->size() + b->size());
+ result->insert(result->end(), a->begin(), a->end());
+ result->insert(result->end(), b->begin(), b->end());
+
+ stack_store_duplis(stack, offset_duplis, result);
+}
+
void EvalContext::eval_instructions(const EvalGlobals *globals, const Function *fn, int entry_point, float *stack) const
{
EvalKernelData kd;
@@ -979,6 +993,14 @@ void EvalContext::eval_instructions(const EvalGlobals *globals, const Function *
break;
}
+ case OP_DUPLIS_COMBINE: {
+ StackIndex offset_duplis_a = fn->read_stack_index(&instr);
+ StackIndex offset_duplis_b = fn->read_stack_index(&instr);
+ StackIndex offset_result = fn->read_stack_index(&instr);
+ eval_op_duplis_combine(stack, offset_duplis_a, offset_duplis_b, offset_result);
+ break;
+ }
+
case OP_END:
return;
}
diff --git a/source/blender/blenvm/bvm/bvm_eval_common.h b/source/blender/blenvm/bvm/bvm_eval_common.h
index 5482741..e4975ca 100644
--- a/source/blender/blenvm/bvm/bvm_eval_common.h
+++ b/source/blender/blenvm/bvm/bvm_eval_common.h
@@ -94,7 +94,7 @@ inline static duplis_ptr stack_load_duplis_ptr(float *stack, StackIndex offset)
return *(duplis_ptr *)(&stack[offset]);
}
-inline static DupliList *stack_load_duplis(float *stack, StackIndex offset)
+inline static const DupliList *stack_load_duplis(float *stack, StackIndex offset)
{
return ((duplis_ptr *)(&stack[offset]))->get();
}
diff --git a/source/blender/blenvm/bvm/bvm_opcode.h b/source/blender/blenvm/bvm/bvm_opcode.h
index 2838f40..8471174 100644
--- a/source/blender/blenvm/bvm/bvm_opcode.h
+++ b/source/blender/blenvm/bvm/bvm_opcode.h
@@ -144,6 +144,7 @@ enum OpCode {
OP_CURVE_PATH,
OP_MAKE_DUPLI,
+ OP_DUPLIS_COMBINE,
OP_END,
diff --git a/source/blender/blenvm/compile/bvm_nodegraph.cc b/source/blender/blenvm/compile/bvm_nodegraph.cc
index 339b671..fb938a8 100644
--- a/source/blender/blenvm/compile/bvm_nodegraph.cc
+++ b/source/blender/blenvm/compile/bvm_nodegraph.cc
@@ -885,6 +885,7 @@ OpCode get_opcode_from_node_type(const string &node)
NODETYPE(CURVE_PATH);
NODETYPE(MAKE_DUPLI);
+ NODETYPE(DUPLIS_COMBINE);
#undef NODETYPE
@@ -1270,6 +1271,11 @@ static void register_opcode_node_types()
nt->add_input("recursive", TYPE_INT, 1);
nt->add_output("dupli", TYPE_DUPLIS);
+ nt = NodeGraph::add_function_node_type("DUPLIS_COMBINE");
+ nt->add_input("duplis_a", TYPE_DUPLIS, duplis_ptr(new DupliList()));
+ nt->add_input("duplis_b", TYPE_DUPLIS, duplis_ptr(new DupliList()));
+ nt->add_output("duplis", TYPE_DUPLIS);
+
nt = NodeGraph::add_function_node_type("ADD_MATRIX44");
nt->add_input("value_a", TYPE_MATRIX44, matrix44::identity());
nt->add_input("value_b", TYPE_MATRIX44, matrix44::identity());
More information about the Bf-blender-cvs
mailing list