Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/nodes.cpp
| Context not available. | |||||
| compiler.add(this, "node_voronoi_texture"); | compiler.add(this, "node_voronoi_texture"); | ||||
| } | } | ||||
| /* Voronoi Crackle */ | |||||
| static ShaderEnum voronoi_crackle_metric_init() | |||||
| { | |||||
| ShaderEnum enm; | |||||
| enm.insert("Distance Squared", NODE_VORONOI_CRACKLE_DISTANCE_SQUARED); | |||||
| enm.insert("Distance", NODE_VORONOI_CRACKLE_DISTANCE); | |||||
| enm.insert("Manhattan", NODE_VORONOI_CRACKLE_MANHATTAN); | |||||
| enm.insert("Chebychev", NODE_VORONOI_CRACKLE_CHEBYCHEV); | |||||
| return enm; | |||||
| } | |||||
| ShaderEnum VoronoiCrackleTextureNode::metric_enum = voronoi_crackle_metric_init(); | |||||
| VoronoiCrackleTextureNode::VoronoiCrackleTextureNode() | |||||
| : TextureNode("voronoi_crackle_texture") | |||||
| { | |||||
| metric = ustring("Distance Squared"); | |||||
| add_input("Scale", SHADER_SOCKET_FLOAT, 1.0f); | |||||
| add_input("Vector", SHADER_SOCKET_POINT, ShaderInput::TEXTURE_GENERATED); | |||||
| add_output("Color", SHADER_SOCKET_COLOR); | |||||
| add_output("Fac", SHADER_SOCKET_FLOAT); | |||||
| } | |||||
| void VoronoiCrackleTextureNode::compile(SVMCompiler& compiler) | |||||
| { | |||||
| ShaderInput *scale_in = input("Scale"); | |||||
| ShaderInput *vector_in = input("Vector"); | |||||
| ShaderOutput *color_out = output("Color"); | |||||
| ShaderOutput *fac_out = output("Fac"); | |||||
| if(vector_in->link) compiler.stack_assign(vector_in); | |||||
| if(scale_in->link) compiler.stack_assign(scale_in); | |||||
| int vector_offset = vector_in->stack_offset; | |||||
| if(!tex_mapping.skip()) { | |||||
| vector_offset = compiler.stack_find_offset(SHADER_SOCKET_VECTOR); | |||||
| tex_mapping.compile(compiler, vector_in->stack_offset, vector_offset); | |||||
| } | |||||
| compiler.stack_assign(color_out); | |||||
| compiler.stack_assign(fac_out); | |||||
| compiler.add_node(NODE_TEX_VORONOI_CRACKLE, | |||||
| compiler.encode_uchar4(metric_enum[metric]), | |||||
| compiler.encode_uchar4(scale_in->stack_offset, vector_offset, fac_out->stack_offset, color_out->stack_offset), | |||||
| __float_as_int(scale_in->value.x)); | |||||
| if(vector_offset != vector_in->stack_offset) | |||||
| compiler.stack_clear_offset(vector_in->type, vector_offset); | |||||
| } | |||||
| void VoronoiCrackleTextureNode::compile(OSLCompiler& compiler) | |||||
| { | |||||
| tex_mapping.compile(compiler); | |||||
| compiler.parameter("Metric", metric); | |||||
| compiler.add(this, "node_voronoi_crackle_texture"); | |||||
| } | |||||
| /* Musgrave Texture */ | /* Musgrave Texture */ | ||||
| static ShaderEnum musgrave_type_init() | static ShaderEnum musgrave_type_init() | ||||
| Context not available. | |||||