From ab9822eff8865846d3c7ef81ff30cc35cb48ae0c Mon Sep 17 00:00:00 2001 From: IRIE Shinsuke Date: Mon, 25 Nov 2013 20:58:23 +0900 Subject: Blender Internal: Add "Lamp Data" shader node that allows shaders to acquire information such as light vector from specified Lamp. For now this provides the following outputs: - Color - Light Vector - Distance - Shadow - Visibility Factor Note: Color output is multiplied by the lamp energy. Multiplication of color*max(dot(light_vector,normal_vector),0)*shadow*visibility_factor produces the exact same result as the Lambert shader. Many thanks to Brecht for code review and discussion! --- source/blender/editors/space_node/drawnode.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/blender/editors/space_node/drawnode.c') diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index b33c3d6c228..61e7fd89866 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -753,6 +753,11 @@ static void node_shader_buts_geometry(uiLayout *layout, bContext *C, PointerRNA } } +static void node_shader_buts_lamp(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "lamp_object", 0, IFACE_("Lamp Object"), ICON_NONE); +} + static void node_shader_buts_attribute(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "attribute_name", 0, IFACE_("Name"), ICON_NONE); @@ -1002,6 +1007,9 @@ static void node_shader_set_butfunc(bNodeType *ntype) case SH_NODE_GEOMETRY: ntype->draw_buttons = node_shader_buts_geometry; break; + case SH_NODE_LAMP: + ntype->draw_buttons = node_shader_buts_lamp; + break; case SH_NODE_ATTRIBUTE: ntype->draw_buttons = node_shader_buts_attribute; break; -- cgit v1.2.3