diff --git a/panda/src/pgraphnodes/config_pgraphnodes.cxx b/panda/src/pgraphnodes/config_pgraphnodes.cxx index 8da8717a97..f553043efb 100644 --- a/panda/src/pgraphnodes/config_pgraphnodes.cxx +++ b/panda/src/pgraphnodes/config_pgraphnodes.cxx @@ -97,7 +97,6 @@ init_libpgraphnodes() { CallbackNode::register_with_read_factory(); DirectionalLight::register_with_read_factory(); FadeLODNode::register_with_read_factory(); - LightLensNode::register_with_read_factory(); LightNode::register_with_read_factory(); LODNode::register_with_read_factory(); PointLight::register_with_read_factory(); diff --git a/panda/src/pgraphnodes/lightLensNode.I b/panda/src/pgraphnodes/lightLensNode.I index a979d83da3..c21a63affa 100644 --- a/panda/src/pgraphnodes/lightLensNode.I +++ b/panda/src/pgraphnodes/lightLensNode.I @@ -60,6 +60,7 @@ set_shadow_caster(bool caster, int buffer_xsize, int buffer_ysize, int buffer_so _shadow_caster = caster; _sb_xsize = buffer_xsize; _sb_ysize = buffer_ysize; + if (buffer_sort != _sb_sort) { ShadowBuffers::iterator it; for(it = _sbuffers.begin(); it != _sbuffers.end(); ++it) { @@ -70,3 +71,21 @@ set_shadow_caster(bool caster, int buffer_xsize, int buffer_ysize, int buffer_so set_active(caster); } +//////////////////////////////////////////////////////////////////// +// Function: LightLensNode::get_shadow_buffer +// Access: Published +// Description: Returns the buffer that has been constructed for +// a given GSG, or NULL if no such buffer has (yet) +// been constructed. This should be used for +// debugging only, you will not need to call this +// normally. +//////////////////////////////////////////////////////////////////// +INLINE GraphicsOutputBase *LightLensNode:: +get_shadow_buffer(GraphicsStateGuardianBase *gsg) { + ShadowBuffers::iterator it = _sbuffers.find(gsg); + if (it == _sbuffers.end()) { + return NULL; + } else { + return (*it).second; + } +} diff --git a/panda/src/pgraphnodes/lightLensNode.cxx b/panda/src/pgraphnodes/lightLensNode.cxx index 2036f63a29..bead7ecf01 100644 --- a/panda/src/pgraphnodes/lightLensNode.cxx +++ b/panda/src/pgraphnodes/lightLensNode.cxx @@ -37,6 +37,7 @@ LightLensNode(const string &name, Lens *lens) : _sb_xsize = 512; _sb_ysize = 512; _sb_sort = -10; + //set_initial_state(RenderState::make(ShaderAttrib::make_off(), 1000)); // Backface culling helps eliminating artifacts. set_initial_state(RenderState::make(CullFaceAttrib::make_reverse(), ColorWriteAttrib::make(ColorWriteAttrib::C_off))); @@ -165,4 +166,3 @@ fillin(DatagramIterator &scan, BamReader *manager) { int sb_sort = scan.get_int32(); set_shadow_caster(shadow_caster, sb_xsize, sb_ysize, sb_sort); } - diff --git a/panda/src/pgraphnodes/lightLensNode.h b/panda/src/pgraphnodes/lightLensNode.h index b5e51e43f1..a2d1afab13 100644 --- a/panda/src/pgraphnodes/lightLensNode.h +++ b/panda/src/pgraphnodes/lightLensNode.h @@ -41,6 +41,8 @@ PUBLISHED: INLINE void set_shadow_caster(bool caster); INLINE void set_shadow_caster(bool caster, int buffer_xsize, int buffer_ysize, int sort = -10); + INLINE GraphicsOutputBase *get_shadow_buffer(GraphicsStateGuardianBase *gsg); + protected: LightLensNode(const LightLensNode ©); void clear_shadow_buffers();