Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/nodes.cpp
| Show First 20 Lines • Show All 928 Lines • ▼ Show 20 Lines | NODE_DEFINE(VoronoiTextureNode) | ||||
| SOCKET_ENUM(feature, "Feature", feature_enum, NODE_VORONOI_INTENSITY); | SOCKET_ENUM(feature, "Feature", feature_enum, NODE_VORONOI_INTENSITY); | ||||
| SOCKET_IN_FLOAT(scale, "Scale", 1.0f); | SOCKET_IN_FLOAT(scale, "Scale", 1.0f); | ||||
| SOCKET_IN_FLOAT(exponent, "Exponent", 0.5f); | SOCKET_IN_FLOAT(exponent, "Exponent", 0.5f); | ||||
| SOCKET_IN_POINT(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); | SOCKET_IN_POINT(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); | ||||
| SOCKET_OUT_COLOR(color, "Color"); | SOCKET_OUT_COLOR(color, "Color"); | ||||
| SOCKET_OUT_FLOAT(fac, "Fac"); | SOCKET_OUT_FLOAT(fac, "Fac"); | ||||
| SOCKET_OUT_VECTOR(vector_out, "Offset"); | |||||
| return type; | return type; | ||||
| } | } | ||||
| VoronoiTextureNode::VoronoiTextureNode() | VoronoiTextureNode::VoronoiTextureNode() | ||||
| : TextureNode(node_type) | : TextureNode(node_type) | ||||
| { | { | ||||
| } | } | ||||
| void VoronoiTextureNode::compile(SVMCompiler& compiler) | void VoronoiTextureNode::compile(SVMCompiler& compiler) | ||||
| { | { | ||||
| ShaderInput *scale_in = input("Scale"); | ShaderInput *scale_in = input("Scale"); | ||||
| ShaderInput *vector_in = input("Vector"); | ShaderInput *vector_in = input("Vector"); | ||||
| ShaderInput *exponent_in = input("Exponent"); | ShaderInput *exponent_in = input("Exponent"); | ||||
| ShaderOutput *color_out = output("Color"); | ShaderOutput *color_out = output("Color"); | ||||
| ShaderOutput *fac_out = output("Fac"); | ShaderOutput *fac_out = output("Fac"); | ||||
| ShaderOutput *vector_out = output("Offset"); | |||||
| if(vector_in->link) compiler.stack_assign(vector_in); | if(vector_in->link) compiler.stack_assign(vector_in); | ||||
| if(scale_in->link) compiler.stack_assign(scale_in); | if(scale_in->link) compiler.stack_assign(scale_in); | ||||
| if(exponent_in->link) compiler.stack_assign(exponent_in); | if(exponent_in->link) compiler.stack_assign(exponent_in); | ||||
| int vector_offset = tex_mapping.compile_begin(compiler, vector_in); | int vector_offset = tex_mapping.compile_begin(compiler, vector_in); | ||||
| compiler.add_node(NODE_TEX_VORONOI, | compiler.add_node(NODE_TEX_VORONOI, | ||||
| compiler.encode_uchar4( | compiler.encode_uchar4( | ||||
| vector_offset, | vector_offset, | ||||
| coloring, | coloring, | ||||
| metric, | metric, | ||||
| feature | feature | ||||
| ), | ), | ||||
| compiler.encode_uchar4( | compiler.encode_uchar4( | ||||
| compiler.stack_assign_if_linked(scale_in), | compiler.stack_assign_if_linked(scale_in), | ||||
| compiler.stack_assign_if_linked(exponent_in), | compiler.stack_assign_if_linked(exponent_in), | ||||
| compiler.stack_assign(fac_out), | compiler.stack_assign(fac_out), | ||||
| compiler.stack_assign(color_out) | compiler.stack_assign(color_out) | ||||
| )); | )); | ||||
| compiler.add_node( | compiler.add_node( | ||||
| __float_as_int(scale), | __float_as_int(scale), | ||||
| __float_as_int(exponent)); | __float_as_int(exponent), | ||||
| compiler.encode_uchar4( | |||||
| compiler.stack_assign(vector_out) | |||||
| )); | |||||
| tex_mapping.compile_end(compiler, vector_in, vector_offset); | tex_mapping.compile_end(compiler, vector_in, vector_offset); | ||||
| } | } | ||||
| void VoronoiTextureNode::compile(OSLCompiler& compiler) | void VoronoiTextureNode::compile(OSLCompiler& compiler) | ||||
| { | { | ||||
| tex_mapping.compile(compiler); | tex_mapping.compile(compiler); | ||||
| ▲ Show 20 Lines • Show All 5,236 Lines • Show Last 20 Lines | |||||