Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/blender/blender_shader.cpp
| Show First 20 Lines • Show All 1,428 Lines • ▼ Show 20 Lines | if(shader_map.sync(&shader, b_light) || update_all) { | ||||
| if(b_light.use_nodes() && b_light.node_tree()) { | if(b_light.use_nodes() && b_light.node_tree()) { | ||||
| shader->name = b_light.name().c_str(); | shader->name = b_light.name().c_str(); | ||||
| BL::ShaderNodeTree b_ntree(b_light.node_tree()); | BL::ShaderNodeTree b_ntree(b_light.node_tree()); | ||||
| add_nodes(scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree); | add_nodes(scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree); | ||||
| } | } | ||||
| else { | else { | ||||
| float strength = 1.0f; | |||||
| if(b_light.type() == BL::Light::type_POINT || | |||||
| b_light.type() == BL::Light::type_SPOT || | |||||
| b_light.type() == BL::Light::type_AREA) | |||||
| { | |||||
| strength = 100.0f; | |||||
| } | |||||
| EmissionNode *emission = new EmissionNode(); | EmissionNode *emission = new EmissionNode(); | ||||
| emission->color = get_float3(b_light.color()); | emission->color = make_float3(1.0f, 1.0f, 1.0f); | ||||
| emission->strength = strength; | emission->strength = 1.0f; | ||||
| graph->add(emission); | graph->add(emission); | ||||
| ShaderNode *out = graph->output(); | ShaderNode *out = graph->output(); | ||||
| graph->connect(emission->output("Emission"), out->input("Surface")); | graph->connect(emission->output("Emission"), out->input("Surface")); | ||||
| } | } | ||||
| shader->set_graph(graph); | shader->set_graph(graph); | ||||
| shader->tag_update(scene); | shader->tag_update(scene); | ||||
| Show All 26 Lines | |||||