Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/shader.h
| Show All 22 Lines | |||||
| # include <OSL/oslexec.h> | # include <OSL/oslexec.h> | ||||
| #endif | #endif | ||||
| #include "kernel/kernel_types.h" | #include "kernel/kernel_types.h" | ||||
| #include "render/attribute.h" | #include "render/attribute.h" | ||||
| #include "graph/node.h" | #include "graph/node.h" | ||||
| #include "util/util_api.h" | |||||
| #include "util/util_map.h" | #include "util/util_map.h" | ||||
| #include "util/util_param.h" | #include "util/util_param.h" | ||||
| #include "util/util_string.h" | #include "util/util_string.h" | ||||
| #include "util/util_thread.h" | #include "util/util_thread.h" | ||||
| #include "util/util_types.h" | #include "util/util_types.h" | ||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| Show All 34 Lines | |||||
| /* Shader describing the appearance of a Mesh, Light or Background. | /* Shader describing the appearance of a Mesh, Light or Background. | ||||
| * | * | ||||
| * While there is only a single shader graph, it has three outputs: surface, | * While there is only a single shader graph, it has three outputs: surface, | ||||
| * volume and displacement, that the shader manager will compile and execute | * volume and displacement, that the shader manager will compile and execute | ||||
| * separately. */ | * separately. */ | ||||
| class Shader : public Node { | class Shader : public Node { | ||||
| float prev_volume_step_rate; | |||||
| public: | public: | ||||
| NODE_DECLARE | NODE_DECLARE | ||||
| /* shader graph */ | /* shader graph */ | ||||
| ShaderGraph *graph; | GET_READ_ONLY(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(bool, use_mis) | ||||
| 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) | ||||
| float prev_volume_step_rate; | |||||
| /* synchronization */ | /* synchronization */ | ||||
| bool need_update_geometry; | GET_SET(bool, need_update_geometry) | ||||
| /* If the shader has only volume components, the surface is assumed to | /* If the shader has only volume components, the surface is assumed to | ||||
| * be transparent. | * be transparent. | ||||
| * However, graph optimization might remove the volume subgraph, but | * However, graph optimization might remove the volume subgraph, but | ||||
| * 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; | GET_SET(bool, has_volume_connected) | ||||
| /* information about shader after compiling */ | /* information about shader after compiling */ | ||||
| bool has_surface; | GET_SET(bool, has_surface) | ||||
| bool has_surface_emission; | GET_SET(bool, has_surface_emission) | ||||
| bool has_surface_transparent; | GET_SET(bool, has_surface_transparent) | ||||
| bool has_volume; | GET_SET(bool, has_volume) | ||||
| bool has_displacement; | GET_SET(bool, has_displacement) | ||||
| bool has_surface_bssrdf; | GET_SET(bool, has_surface_bssrdf) | ||||
| bool has_bump; | GET_SET(bool, has_bump) | ||||
| bool has_bssrdf_bump; | GET_SET(bool, has_bssrdf_bump) | ||||
| bool has_surface_spatial_varying; | GET_SET(bool, has_surface_spatial_varying) | ||||
| bool has_volume_spatial_varying; | GET_SET(bool, has_volume_spatial_varying) | ||||
| bool has_volume_attribute_dependency; | GET_SET(bool, has_volume_attribute_dependency) | ||||
| bool has_integrator_dependency; | GET_SET(bool, has_integrator_dependency) | ||||
| /* requested mesh attributes */ | /* requested mesh attributes */ | ||||
| AttributeRequestSet attributes; | GET_SET(AttributeRequestSet, attributes) | ||||
| /* determined before compiling */ | /* determined before compiling */ | ||||
| uint id; | GET_SET(uint, id) | ||||
| bool used; | GET_SET(bool, used) | ||||
| #ifdef WITH_OSL | #ifdef WITH_OSL | ||||
| /* osl shading state references */ | /* osl shading state references */ | ||||
| OSL::ShaderGroupRef osl_surface_ref; | GET_SET(OSL::ShaderGroupRef, osl_surface_ref) | ||||
| OSL::ShaderGroupRef osl_surface_bump_ref; | GET_SET(OSL::ShaderGroupRef, osl_surface_bump_ref) | ||||
| OSL::ShaderGroupRef osl_volume_ref; | GET_SET(OSL::ShaderGroupRef, osl_volume_ref) | ||||
| OSL::ShaderGroupRef osl_displacement_ref; | GET_SET(OSL::ShaderGroupRef, osl_displacement_ref) | ||||
| #endif | #endif | ||||
| public: | |||||
| Shader(); | Shader(); | ||||
| ~Shader(); | ~Shader(); | ||||
| /* Checks whether the shader consists of just a emission node with fixed inputs that's connected | /* Checks whether the shader consists of just a emission node with fixed inputs that's connected | ||||
| * directly to the output. | * directly to the output. | ||||
| * If yes, it sets the content of emission to the constant value (color * strength), which is | * If yes, it sets the content of emission to the constant value (color * strength), which is | ||||
| * then used for speeding up light evaluation. */ | * then used for speeding up light evaluation. */ | ||||
| bool is_constant_emission(float3 *emission); | bool is_constant_emission(float3 *emission); | ||||
| ▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines | |||||