From 08ab3cbcce1eb9c2de4953a83b50cabc44479d3c Mon Sep 17 00:00:00 2001 From: OmarSquircleArt Date: Thu, 22 Aug 2019 14:26:09 +0200 Subject: 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 --- .../nodes/shader/nodes/node_shader_object_info.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'source/blender/nodes') 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); } -- cgit v1.2.3