Cycles / HSV Separator and Combine node:
[blender.git] / intern / cycles / render / nodes.cpp
index 319d821037709d68e7bbf8d3943ae82bfc49c7e9..b5107315d4c0232e3cab3421676455c5d8b45d41 100644 (file)
@@ -2064,6 +2064,7 @@ LightPathNode::LightPathNode()
        add_output("Is Reflection Ray", SHADER_SOCKET_FLOAT);
        add_output("Is Transmission Ray", SHADER_SOCKET_FLOAT);
        add_output("Ray Length", SHADER_SOCKET_FLOAT);
+       add_output("Ray Depth", SHADER_SOCKET_FLOAT);
 }
 
 void LightPathNode::compile(SVMCompiler& compiler)
@@ -2118,6 +2119,12 @@ void LightPathNode::compile(SVMCompiler& compiler)
                compiler.stack_assign(out);
                compiler.add_node(NODE_LIGHT_PATH, NODE_LP_ray_length, out->stack_offset);
        }
+       
+       out = output("Ray Depth");
+       if(!out->links.empty()) {
+               compiler.stack_assign(out);
+               compiler.add_node(NODE_LIGHT_PATH, NODE_LP_ray_depth, out->stack_offset);
+       }
 
 }
 
@@ -3231,8 +3238,8 @@ VectorTransformNode::VectorTransformNode()
 : ShaderNode("vector_transform")
 {
        type = ustring("Vector");
-       convert_from = ustring("World");
-       convert_to = ustring("Object");
+       convert_from = ustring("world");
+       convert_to = ustring("object");
 
        add_input("Vector", SHADER_SOCKET_VECTOR);
        add_output("Vector",  SHADER_SOCKET_VECTOR);
@@ -3244,35 +3251,24 @@ static ShaderEnum vector_transform_type_init()
 
        enm.insert("Vector", NODE_VECTOR_TRANSFORM_TYPE_VECTOR);
        enm.insert("Point", NODE_VECTOR_TRANSFORM_TYPE_POINT);
+       enm.insert("Normal", NODE_VECTOR_TRANSFORM_TYPE_NORMAL);
 
        return enm;
 }
 
-static ShaderEnum vector_transform_convert_from_init()
-{
-       ShaderEnum enm;
-
-       enm.insert("World", NODE_VECTOR_TRANSFORM_CONVERT_FROM_WORLD);
-       enm.insert("Object", NODE_VECTOR_TRANSFORM_CONVERT_FROM_OBJECT);
-       enm.insert("Camera", NODE_VECTOR_TRANSFORM_CONVERT_FROM_CAMERA);
-
-       return enm;
-}
-
-static ShaderEnum vector_transform_convert_to_init()
+static ShaderEnum vector_transform_convert_space_init()
 {
        ShaderEnum enm;
 
-       enm.insert("World", NODE_VECTOR_TRANSFORM_CONVERT_TO_WORLD);
-       enm.insert("Object", NODE_VECTOR_TRANSFORM_CONVERT_TO_OBJECT);
-       enm.insert("Camera", NODE_VECTOR_TRANSFORM_CONVERT_TO_CAMERA);
+       enm.insert("world", NODE_VECTOR_TRANSFORM_CONVERT_SPACE_WORLD);
+       enm.insert("object", NODE_VECTOR_TRANSFORM_CONVERT_SPACE_OBJECT);
+       enm.insert("camera", NODE_VECTOR_TRANSFORM_CONVERT_SPACE_CAMERA);
 
        return enm;
 }
 
 ShaderEnum VectorTransformNode::type_enum = vector_transform_type_init();
-ShaderEnum VectorTransformNode::convert_from_enum = vector_transform_convert_from_init();
-ShaderEnum VectorTransformNode::convert_to_enum = vector_transform_convert_to_init();
+ShaderEnum VectorTransformNode::convert_space_enum = vector_transform_convert_space_init();
 
 void VectorTransformNode::compile(SVMCompiler& compiler)
 {
@@ -3283,7 +3279,7 @@ void VectorTransformNode::compile(SVMCompiler& compiler)
        compiler.stack_assign(vector_out);
 
        compiler.add_node(NODE_VECTOR_TRANSFORM,
-               compiler.encode_uchar4(type_enum[type], convert_from_enum[convert_from], convert_to_enum[convert_to]),
+               compiler.encode_uchar4(type_enum[type], convert_space_enum[convert_from], convert_space_enum[convert_to]),
                compiler.encode_uchar4(vector_in->stack_offset, vector_out->stack_offset));
 }