diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2013-12-28 04:54:44 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2013-12-28 19:57:02 +0400 |
commit | a35db17cee5a9b47dc9624f7dfcb41f5fc185b33 (patch) | |
tree | ef23032da73b9b202490307f865e2afd4e2e7e76 /intern/cycles/kernel/osl/osl_closures.h | |
parent | a06c9c277a8577f7ef473fffaf2258d2a3a6ab80 (diff) |
Cycles Volume Render: work on nodes and closures.
* Henyey-Greenstein scattering closure implementation.
* Rename transparent to absorption node and isotropic to scatter node.
* Volume density is folded into the closure weights.
* OSL support for volume closures and nodes.
* This commit has no user visible changes, there is no volume render code yet.
This is work by "storm", Stuart Broadfoot, Thomas Dinges and myself.
Diffstat (limited to 'intern/cycles/kernel/osl/osl_closures.h')
-rw-r--r-- | intern/cycles/kernel/osl/osl_closures.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/intern/cycles/kernel/osl/osl_closures.h b/intern/cycles/kernel/osl/osl_closures.h index b6c38e01b23..f2f79f80fdf 100644 --- a/intern/cycles/kernel/osl/osl_closures.h +++ b/intern/cycles/kernel/osl/osl_closures.h @@ -54,6 +54,7 @@ OSL::ClosureParam *closure_bssrdf_cubic_params(); OSL::ClosureParam *closure_bssrdf_gaussian_params(); OSL::ClosureParam *closure_bssrdf_cubic_extended_params(); OSL::ClosureParam *closure_bssrdf_gaussian_extended_params(); +OSL::ClosureParam *closure_henyey_greenstein_volume_params(); void closure_emission_prepare(OSL::RendererServices *, int id, void *data); void closure_background_prepare(OSL::RendererServices *, int id, void *data); @@ -65,6 +66,7 @@ void closure_westin_backscatter_prepare(OSL::RendererServices *, int id, void *d void closure_westin_sheen_prepare(OSL::RendererServices *, int id, void *data); void closure_bssrdf_cubic_prepare(OSL::RendererServices *, int id, void *data); void closure_bssrdf_gaussian_prepare(OSL::RendererServices *, int id, void *data); +void closure_henyey_greenstein_volume_prepare(OSL::RendererServices *, int id, void *data); #define CCLOSURE_PREPARE(name, classname) \ void name(RendererServices *, int id, void *data) \ @@ -186,6 +188,54 @@ static ClosureParam *bsdf_##lower##_params() \ \ CCLOSURE_PREPARE_STATIC(bsdf_##lower##_prepare, Upper##Closure) + +/* Volume */ + +class CVolumeClosure : public CClosurePrimitive { +public: + ShaderClosure sc; + + CVolumeClosure(int scattering) : CClosurePrimitive(Volume), + m_scattering_label(scattering), m_shaderdata_flag(0) + { memset(&sc, 0, sizeof(sc)); } + ~CVolumeClosure() { } + + int scattering() const { return m_scattering_label; } + int shaderdata_flag() const { return m_shaderdata_flag; } + +protected: + int m_scattering_label; + int m_shaderdata_flag; +}; + +#define VOLUME_CLOSURE_CLASS_BEGIN(Upper, lower, TYPE) \ +\ +class Upper##Closure : public CVolumeClosure { \ +public: \ + Upper##Closure() : CVolumeClosure(TYPE) {} \ +\ + void setup() \ + { \ + sc.prim = NULL; \ + m_shaderdata_flag = volume_##lower##_setup(&sc); \ + } \ +}; \ +\ +static ClosureParam *volume_##lower##_params() \ +{ \ + static ClosureParam params[] = { + +/* parameters */ + +#define VOLUME_CLOSURE_CLASS_END(Upper, lower) \ + CLOSURE_STRING_KEYPARAM("label"), \ + CLOSURE_FINISH_PARAM(Upper##Closure) \ + }; \ + return params; \ +} \ +\ +CCLOSURE_PREPARE_STATIC(volume_##lower##_prepare, Upper##Closure) + CCL_NAMESPACE_END #endif /* __OSL_CLOSURES_H__ */ |