Add LightLensNode::get_shadow_buffer
This commit is contained in:
parent
14bd32c215
commit
67fda9f0c1
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue