Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/blender/shader.cpp
| Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static DisplacementMethod get_displacement_method(PointerRNA &ptr) | static DisplacementMethod get_displacement_method(PointerRNA &ptr) | ||||
| { | { | ||||
| return (DisplacementMethod)get_enum( | return (DisplacementMethod)get_enum( | ||||
| ptr, "displacement_method", DISPLACE_NUM_METHODS, DISPLACE_BUMP); | ptr, "displacement_method", DISPLACE_NUM_METHODS, DISPLACE_BUMP); | ||||
| } | } | ||||
| static EmissionSampling get_emission_sampling(PointerRNA &ptr) | |||||
| { | |||||
| return (EmissionSampling)get_enum( | |||||
| ptr, "emission_sampling", EMISSION_SAMPLING_NUM, EMISSION_SAMPLING_AUTO); | |||||
| } | |||||
| static int validate_enum_value(int value, int num_values, int default_value) | static int validate_enum_value(int value, int num_values, int default_value) | ||||
| { | { | ||||
| if (value >= num_values) { | if (value >= num_values) { | ||||
| return default_value; | return default_value; | ||||
| } | } | ||||
| return value; | return value; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,482 Lines • ▼ Show 20 Lines | if (shader_map.add_or_update(&shader, b_mat) || update_all || | ||||
| ShaderNode *out = graph->output(); | ShaderNode *out = graph->output(); | ||||
| graph->connect(diffuse->output("BSDF"), out->input("Surface")); | graph->connect(diffuse->output("BSDF"), out->input("Surface")); | ||||
| } | } | ||||
| resolve_view_layer_attributes(shader, graph, b_depsgraph); | resolve_view_layer_attributes(shader, graph, b_depsgraph); | ||||
| /* settings */ | /* settings */ | ||||
| PointerRNA cmat = RNA_pointer_get(&b_mat.ptr, "cycles"); | PointerRNA cmat = RNA_pointer_get(&b_mat.ptr, "cycles"); | ||||
| shader->set_use_mis(get_boolean(cmat, "sample_as_light")); | shader->set_emission_sampling_method(get_emission_sampling(cmat)); | ||||
| shader->set_use_transparent_shadow(get_boolean(cmat, "use_transparent_shadow")); | shader->set_use_transparent_shadow(get_boolean(cmat, "use_transparent_shadow")); | ||||
| shader->set_heterogeneous_volume(!get_boolean(cmat, "homogeneous_volume")); | shader->set_heterogeneous_volume(!get_boolean(cmat, "homogeneous_volume")); | ||||
| shader->set_volume_sampling_method(get_volume_sampling(cmat)); | shader->set_volume_sampling_method(get_volume_sampling(cmat)); | ||||
| shader->set_volume_interpolation_method(get_volume_interpolation(cmat)); | shader->set_volume_interpolation_method(get_volume_interpolation(cmat)); | ||||
| shader->set_volume_step_rate(get_float(cmat, "volume_step_rate")); | shader->set_volume_step_rate(get_float(cmat, "volume_step_rate")); | ||||
| shader->set_displacement_method(get_displacement_method(cmat)); | shader->set_displacement_method(get_displacement_method(cmat)); | ||||
| shader->set_graph(graph); | shader->set_graph(graph); | ||||
| ▲ Show 20 Lines • Show All 255 Lines • Show Last 20 Lines | |||||