Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/blender/blender_shader.cpp
| Show First 20 Lines • Show All 1,334 Lines • ▼ Show 20 Lines | else if (new_viewport_parameters.use_scene_world && b_world) { | ||||
| BackgroundNode *background = new BackgroundNode(); | BackgroundNode *background = new BackgroundNode(); | ||||
| background->color = get_float3(b_world.color()); | background->color = get_float3(b_world.color()); | ||||
| graph->add(background); | graph->add(background); | ||||
| ShaderNode *out = graph->output(); | ShaderNode *out = graph->output(); | ||||
| graph->connect(background->output("Background"), out->input("Surface")); | graph->connect(background->output("Background"), out->input("Surface")); | ||||
| } | } | ||||
| else if (!new_viewport_parameters.use_scene_world) { | else if (!new_viewport_parameters.use_scene_world) { | ||||
| float3 world_color; | |||||
| if (b_world) { | |||||
| world_color = get_float3(b_world.color()); | |||||
| } | |||||
| else { | |||||
| world_color = make_float3(0.0f, 0.0f, 0.0f); | |||||
| } | |||||
| BackgroundNode *background = new BackgroundNode(); | BackgroundNode *background = new BackgroundNode(); | ||||
| graph->add(background); | graph->add(background); | ||||
| LightPathNode *light_path = new LightPathNode(); | LightPathNode *light_path = new LightPathNode(); | ||||
| graph->add(light_path); | graph->add(light_path); | ||||
| MixNode *mix_scene_with_background = new MixNode(); | MixNode *mix_scene_with_background = new MixNode(); | ||||
| mix_scene_with_background->color2 = get_float3(b_world.color()); | mix_scene_with_background->color2 = world_color; | ||||
| graph->add(mix_scene_with_background); | graph->add(mix_scene_with_background); | ||||
| EnvironmentTextureNode *texture_environment = new EnvironmentTextureNode(); | EnvironmentTextureNode *texture_environment = new EnvironmentTextureNode(); | ||||
| texture_environment->tex_mapping.type = TextureMapping::VECTOR; | texture_environment->tex_mapping.type = TextureMapping::VECTOR; | ||||
| texture_environment->tex_mapping.rotation[2] = new_viewport_parameters.studiolight_rotate_z; | texture_environment->tex_mapping.rotation[2] = new_viewport_parameters.studiolight_rotate_z; | ||||
| texture_environment->filename = new_viewport_parameters.studiolight_path; | texture_environment->filename = new_viewport_parameters.studiolight_path; | ||||
| graph->add(texture_environment); | graph->add(texture_environment); | ||||
| MixNode *mix_intensity = new MixNode(); | MixNode *mix_intensity = new MixNode(); | ||||
| mix_intensity->type = NODE_MIX_MUL; | mix_intensity->type = NODE_MIX_MUL; | ||||
| mix_intensity->fac = 1.0f; | mix_intensity->fac = 1.0f; | ||||
| mix_intensity->color2 = make_float3(new_viewport_parameters.studiolight_intensity, | mix_intensity->color2 = make_float3(new_viewport_parameters.studiolight_intensity, | ||||
| new_viewport_parameters.studiolight_intensity, | new_viewport_parameters.studiolight_intensity, | ||||
| new_viewport_parameters.studiolight_intensity); | new_viewport_parameters.studiolight_intensity); | ||||
| graph->add(mix_intensity); | graph->add(mix_intensity); | ||||
| TextureCoordinateNode *texture_coordinate = new TextureCoordinateNode(); | TextureCoordinateNode *texture_coordinate = new TextureCoordinateNode(); | ||||
| graph->add(texture_coordinate); | graph->add(texture_coordinate); | ||||
| MixNode *mix_background_with_environment = new MixNode(); | MixNode *mix_background_with_environment = new MixNode(); | ||||
| mix_background_with_environment->fac = new_viewport_parameters.studiolight_background_alpha; | mix_background_with_environment->fac = new_viewport_parameters.studiolight_background_alpha; | ||||
| mix_background_with_environment->color1 = get_float3(b_world.color()); | mix_background_with_environment->color1 = world_color; | ||||
| graph->add(mix_background_with_environment); | graph->add(mix_background_with_environment); | ||||
| ShaderNode *out = graph->output(); | ShaderNode *out = graph->output(); | ||||
| graph->connect(texture_coordinate->output("Generated"), | graph->connect(texture_coordinate->output("Generated"), | ||||
| texture_environment->input("Vector")); | texture_environment->input("Vector")); | ||||
| graph->connect(texture_environment->output("Color"), mix_intensity->input("Color1")); | graph->connect(texture_environment->output("Color"), mix_intensity->input("Color1")); | ||||
| graph->connect(light_path->output("Is Camera Ray"), mix_scene_with_background->input("Fac")); | graph->connect(light_path->output("Is Camera Ray"), mix_scene_with_background->input("Fac")); | ||||
| ▲ Show 20 Lines • Show All 122 Lines • Show Last 20 Lines | |||||