Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/scene/shader.h
| Show All 28 Lines | |||||
| class Progress; | class Progress; | ||||
| class Scene; | class Scene; | ||||
| class ShaderGraph; | class ShaderGraph; | ||||
| struct float3; | struct float3; | ||||
| enum ShadingSystem { SHADINGSYSTEM_OSL, SHADINGSYSTEM_SVM }; | enum ShadingSystem { SHADINGSYSTEM_OSL, SHADINGSYSTEM_SVM }; | ||||
| /* Keep those in sync with the python-defined enum. */ | /* Keep those in sync with the python-defined enum. */ | ||||
| enum VolumeSampling { | enum VolumeSampling { | ||||
| VOLUME_SAMPLING_DISTANCE = 0, | VOLUME_SAMPLING_DISTANCE = 0, | ||||
| VOLUME_SAMPLING_EQUIANGULAR = 1, | VOLUME_SAMPLING_EQUIANGULAR = 1, | ||||
| VOLUME_SAMPLING_MULTIPLE_IMPORTANCE = 2, | VOLUME_SAMPLING_MULTIPLE_IMPORTANCE = 2, | ||||
| VOLUME_NUM_SAMPLING, | VOLUME_NUM_SAMPLING, | ||||
| }; | }; | ||||
| Show All 23 Lines | public: | ||||
| NODE_DECLARE | NODE_DECLARE | ||||
| /* shader graph */ | /* shader graph */ | ||||
| ShaderGraph *graph; | ShaderGraph *graph; | ||||
| NODE_SOCKET_API(int, pass_id) | NODE_SOCKET_API(int, pass_id) | ||||
| /* sampling */ | /* sampling */ | ||||
| NODE_SOCKET_API(bool, use_mis) | NODE_SOCKET_API(EmissionSampling, emission_sampling_method) | ||||
| NODE_SOCKET_API(bool, use_transparent_shadow) | NODE_SOCKET_API(bool, use_transparent_shadow) | ||||
| NODE_SOCKET_API(bool, heterogeneous_volume) | NODE_SOCKET_API(bool, heterogeneous_volume) | ||||
| NODE_SOCKET_API(VolumeSampling, volume_sampling_method) | NODE_SOCKET_API(VolumeSampling, volume_sampling_method) | ||||
| NODE_SOCKET_API(int, volume_interpolation_method) | NODE_SOCKET_API(int, volume_interpolation_method) | ||||
| NODE_SOCKET_API(float, volume_step_rate) | NODE_SOCKET_API(float, volume_step_rate) | ||||
| /* displacement */ | /* displacement */ | ||||
| NODE_SOCKET_API(DisplacementMethod, displacement_method) | NODE_SOCKET_API(DisplacementMethod, displacement_method) | ||||
| Show All 11 Lines | public: | ||||
| * since the user connected something to the volume output the surface | * since the user connected something to the volume output the surface | ||||
| * should still be transparent. | * should still be transparent. | ||||
| * Therefore, has_volume_connected stores whether some volume sub-tree | * Therefore, has_volume_connected stores whether some volume sub-tree | ||||
| * was connected before optimization. */ | * was connected before optimization. */ | ||||
| bool has_volume_connected; | bool has_volume_connected; | ||||
| /* information about shader after compiling */ | /* information about shader after compiling */ | ||||
| bool has_surface; | bool has_surface; | ||||
| bool has_surface_emission; | |||||
| bool has_surface_transparent; | bool has_surface_transparent; | ||||
| bool has_surface_raytrace; | bool has_surface_raytrace; | ||||
| bool has_volume; | bool has_volume; | ||||
| bool has_displacement; | bool has_displacement; | ||||
| bool has_surface_bssrdf; | bool has_surface_bssrdf; | ||||
| bool has_bump; | bool has_bump; | ||||
| bool has_bssrdf_bump; | bool has_bssrdf_bump; | ||||
| bool has_surface_spatial_varying; | bool has_surface_spatial_varying; | ||||
| bool has_volume_spatial_varying; | bool has_volume_spatial_varying; | ||||
| bool has_volume_attribute_dependency; | bool has_volume_attribute_dependency; | ||||
| bool has_integrator_dependency; | bool has_integrator_dependency; | ||||
| float3 emission_estimate; | |||||
| EmissionSampling emission_sampling; | |||||
| bool emission_is_constant; | |||||
| /* requested mesh attributes */ | /* requested mesh attributes */ | ||||
| AttributeRequestSet attributes; | AttributeRequestSet attributes; | ||||
| /* determined before compiling */ | /* determined before compiling */ | ||||
| uint id; | uint id; | ||||
| #ifdef WITH_OSL | #ifdef WITH_OSL | ||||
| /* osl shading state references */ | /* osl shading state references */ | ||||
| OSL::ShaderGroupRef osl_surface_ref; | OSL::ShaderGroupRef osl_surface_ref; | ||||
| OSL::ShaderGroupRef osl_surface_bump_ref; | OSL::ShaderGroupRef osl_surface_bump_ref; | ||||
| OSL::ShaderGroupRef osl_volume_ref; | OSL::ShaderGroupRef osl_volume_ref; | ||||
| OSL::ShaderGroupRef osl_displacement_ref; | OSL::ShaderGroupRef osl_displacement_ref; | ||||
| #endif | #endif | ||||
| Shader(); | Shader(); | ||||
| ~Shader(); | ~Shader(); | ||||
| /* Checks whether the shader consists of just a emission node with fixed inputs that's connected | /* Estimate emission of this shader based on the shader graph. This works only in very simple | ||||
| * directly to the output. | * cases. But it helps improve light importance sampling in common cases. | ||||
| * If yes, it sets the content of emission to the constant value (color * strength), which is | * | ||||
| * then used for speeding up light evaluation. */ | * If the emission is fully constant, returns true, so that shader evaluation can be skipped | ||||
| bool is_constant_emission(float3 *emission); | * entirely for a light. */ | ||||
| void estimate_emission(); | |||||
| void set_graph(ShaderGraph *graph); | void set_graph(ShaderGraph *graph); | ||||
| void tag_update(Scene *scene); | void tag_update(Scene *scene); | ||||
| void tag_used(Scene *scene); | void tag_used(Scene *scene); | ||||
| /* Return true when either of the surface or displacement socket of the output node is linked. | /* Return true when either of the surface or displacement socket of the output node is linked. | ||||
| * This should be used to ensure that surface attributes are also requested even when only the | * This should be used to ensure that surface attributes are also requested even when only the | ||||
| * displacement socket is linked. */ | * displacement socket is linked. */ | ||||
| ▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines | |||||