diff options
author | OmarSquircleArt <omar.squircleart@gmail.com> | 2019-08-22 15:26:09 +0300 |
---|---|---|
committer | OmarSquircleArt <omar.squircleart@gmail.com> | 2019-08-22 15:26:09 +0300 |
commit | 08ab3cbcce1eb9c2de4953a83b50cabc44479d3c (patch) | |
tree | ef169595562509b0e3338cecb36a3b3210bd64ce /source/blender/nodes | |
parent | a2443848646cdb5d13980157a8c62eb4cd578388 (diff) |
Shading: Add object color to Object Info node.
The object color property is added as an additional output in
the Object Info node.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5554
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_object_info.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_object_info.c b/source/blender/nodes/shader/nodes/node_shader_object_info.c index 118b8136693..58449a53706 100644 --- a/source/blender/nodes/shader/nodes/node_shader_object_info.c +++ b/source/blender/nodes/shader/nodes/node_shader_object_info.c @@ -23,6 +23,7 @@ static bNodeSocketTemplate sh_node_object_info_out[] = { {SOCK_VECTOR, 0, N_("Location"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + {SOCK_RGBA, 0, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {SOCK_FLOAT, 0, N_("Object Index"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {SOCK_FLOAT, 0, N_("Material Index"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {SOCK_FLOAT, 0, N_("Random"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, @@ -36,38 +37,25 @@ static int node_shader_gpu_object_info(GPUMaterial *mat, GPUNodeStack *out) { Material *ma = GPU_material_get_material(mat); - /* Convert to float. */ - float index = ma ? ma->index : 0; + float index = ma ? ma->index : 0.0f; return GPU_stack_link(mat, node, "node_object_info", in, out, GPU_builtin(GPU_OBJECT_MATRIX), + GPU_builtin(GPU_OBJECT_COLOR), GPU_builtin(GPU_OBJECT_INFO), GPU_constant(&index)); } -static void node_shader_exec_object_info(void *UNUSED(data), - int UNUSED(thread), - bNode *UNUSED(node), - bNodeExecData *UNUSED(execdata), - bNodeStack **UNUSED(in), - bNodeStack **UNUSED(out)) -{ -} - -/* node type definition */ void register_node_type_sh_object_info(void) { static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_OBJECT_INFO, "Object Info", NODE_CLASS_INPUT, 0); node_type_socket_templates(&ntype, NULL, sh_node_object_info_out); - node_type_init(&ntype, NULL); - node_type_storage(&ntype, "", NULL, NULL); node_type_gpu(&ntype, node_shader_gpu_object_info); - node_type_exec(&ntype, NULL, NULL, node_shader_exec_object_info); nodeRegisterType(&ntype); } |