Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/nodes.cpp
| Show First 20 Lines • Show All 1,537 Lines • ▼ Show 20 Lines | void BsdfNode::compile(SVMCompiler& compiler) | ||||
| compile(compiler, NULL, NULL); | compile(compiler, NULL, NULL); | ||||
| } | } | ||||
| void BsdfNode::compile(OSLCompiler& compiler) | void BsdfNode::compile(OSLCompiler& compiler) | ||||
| { | { | ||||
| assert(0); | assert(0); | ||||
| } | } | ||||
| /* Ward BSDF Closure */ | /* Anisotropic BSDF Closure */ | ||||
| WardBsdfNode::WardBsdfNode() | static ShaderEnum aniso_distribution_init() | ||||
| { | { | ||||
| closure = CLOSURE_BSDF_WARD_ID; | ShaderEnum enm; | ||||
| enm.insert("Sharp", CLOSURE_BSDF_REFLECTION_ID); | |||||
| enm.insert("Beckmann", CLOSURE_BSDF_MICROFACET_BECKMANN_ANISO_ID); | |||||
| enm.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID); | |||||
| enm.insert("Ashikhmin-Shirley", CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID); | |||||
| return enm; | |||||
| } | |||||
| ShaderEnum AnisotropicBsdfNode::distribution_enum = aniso_distribution_init(); | |||||
| AnisotropicBsdfNode::AnisotropicBsdfNode() | |||||
| { | |||||
| distribution = ustring("GGX"); | |||||
| add_input("Tangent", SHADER_SOCKET_VECTOR, ShaderInput::TANGENT); | add_input("Tangent", SHADER_SOCKET_VECTOR, ShaderInput::TANGENT); | ||||
| add_input("Roughness", SHADER_SOCKET_FLOAT, 0.2f); | add_input("Roughness", SHADER_SOCKET_FLOAT, 0.2f); | ||||
| add_input("Anisotropy", SHADER_SOCKET_FLOAT, 0.5f); | add_input("Anisotropy", SHADER_SOCKET_FLOAT, 0.5f); | ||||
| add_input("Rotation", SHADER_SOCKET_FLOAT, 0.0f); | add_input("Rotation", SHADER_SOCKET_FLOAT, 0.0f); | ||||
| } | } | ||||
| void WardBsdfNode::attributes(Shader *shader, AttributeRequestSet *attributes) | void AnisotropicBsdfNode::attributes(Shader *shader, AttributeRequestSet *attributes) | ||||
| { | { | ||||
| if(shader->has_surface) { | if(shader->has_surface) { | ||||
| ShaderInput *tangent_in = input("Tangent"); | ShaderInput *tangent_in = input("Tangent"); | ||||
| if(!tangent_in->link) | if(!tangent_in->link) | ||||
| attributes->add(ATTR_STD_GENERATED); | attributes->add(ATTR_STD_GENERATED); | ||||
| } | } | ||||
| ShaderNode::attributes(shader, attributes); | ShaderNode::attributes(shader, attributes); | ||||
| } | } | ||||
| void WardBsdfNode::compile(SVMCompiler& compiler) | void AnisotropicBsdfNode::compile(SVMCompiler& compiler) | ||||
| { | { | ||||
| closure = (ClosureType)distribution_enum[distribution]; | |||||
| BsdfNode::compile(compiler, input("Roughness"), input("Anisotropy"), input("Rotation")); | BsdfNode::compile(compiler, input("Roughness"), input("Anisotropy"), input("Rotation")); | ||||
| } | } | ||||
| void WardBsdfNode::compile(OSLCompiler& compiler) | void AnisotropicBsdfNode::compile(OSLCompiler& compiler) | ||||
| { | { | ||||
| compiler.add(this, "node_ward_bsdf"); | compiler.parameter("distribution", distribution); | ||||
| compiler.add(this, "node_anisotropic_bsdf"); | |||||
| } | } | ||||
| /* Glossy BSDF Closure */ | /* Glossy BSDF Closure */ | ||||
| static ShaderEnum glossy_distribution_init() | static ShaderEnum glossy_distribution_init() | ||||
| { | { | ||||
| ShaderEnum enm; | ShaderEnum enm; | ||||
| enm.insert("Sharp", CLOSURE_BSDF_REFLECTION_ID); | enm.insert("Sharp", CLOSURE_BSDF_REFLECTION_ID); | ||||
| enm.insert("Beckmann", CLOSURE_BSDF_MICROFACET_BECKMANN_ID); | enm.insert("Beckmann", CLOSURE_BSDF_MICROFACET_BECKMANN_ID); | ||||
| enm.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_ID); | enm.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_ID); | ||||
| enm.insert("Ashikhmin-Shirley", CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID); | |||||
| return enm; | return enm; | ||||
| } | } | ||||
| ShaderEnum GlossyBsdfNode::distribution_enum = glossy_distribution_init(); | ShaderEnum GlossyBsdfNode::distribution_enum = glossy_distribution_init(); | ||||
| GlossyBsdfNode::GlossyBsdfNode() | GlossyBsdfNode::GlossyBsdfNode() | ||||
| { | { | ||||
| distribution = ustring("Beckmann"); | distribution = ustring("GGX"); | ||||
| add_input("Roughness", SHADER_SOCKET_FLOAT, 0.2f); | add_input("Roughness", SHADER_SOCKET_FLOAT, 0.2f); | ||||
| } | } | ||||
| void GlossyBsdfNode::compile(SVMCompiler& compiler) | void GlossyBsdfNode::compile(SVMCompiler& compiler) | ||||
| { | { | ||||
| closure = (ClosureType)distribution_enum[distribution]; | closure = (ClosureType)distribution_enum[distribution]; | ||||
| ▲ Show 20 Lines • Show All 2,518 Lines • Show Last 20 Lines | |||||