Panda3D
 All Classes Functions Variables Enumerations
lightLensNode.I
00001 // Filename: lightLensNode.I
00002 // Created by:  drose (26Mar02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 ////////////////////////////////////////////////////////////////////
00016 //     Function: LightLensNode::is_shadow_caster
00017 //       Access: Published
00018 //  Description: Returns whether this light is configured to cast
00019 //               shadows or not.
00020 ////////////////////////////////////////////////////////////////////
00021 INLINE bool LightLensNode::
00022 is_shadow_caster() {
00023   return _shadow_caster;
00024 }
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //     Function: LightLensNode::set_shadow_caster
00028 //       Access: Published
00029 //  Description: Sets the flag indicating whether this light should
00030 //               cast shadows or not. This is the variant without
00031 //               buffer size, meaning that the current buffer size
00032 //               will be kept (512x512 is the default).
00033 //               Note that enabling shadows will require the shader
00034 //               generator to be enabled on the scene.
00035 ////////////////////////////////////////////////////////////////////
00036 INLINE void LightLensNode::
00037 set_shadow_caster(bool caster) {
00038   if (_shadow_caster && !caster) {
00039     clear_shadow_buffers();
00040   }
00041   _shadow_caster = caster;
00042   set_active(caster);
00043 }
00044 
00045 ////////////////////////////////////////////////////////////////////
00046 //     Function: LightLensNode::set_shadow_caster
00047 //       Access: Published
00048 //  Description: Sets the flag indicating whether this light should
00049 //               cast shadows or not. The xsize and ysize parameters
00050 //               specify the size of the shadow buffer that will be
00051 //               set up, the sort parameter specifies the sort.
00052 //               Note that enabling shadows will require the shader
00053 //               generator to be enabled on the scene.
00054 ////////////////////////////////////////////////////////////////////
00055 INLINE void LightLensNode::
00056 set_shadow_caster(bool caster, int buffer_xsize, int buffer_ysize, int buffer_sort) {
00057   if ((_shadow_caster && !caster) || buffer_xsize != _sb_xsize || buffer_ysize != _sb_ysize) {
00058     clear_shadow_buffers();
00059   }
00060   _shadow_caster = caster;
00061   _sb_xsize = buffer_xsize;
00062   _sb_ysize = buffer_ysize;
00063   if (buffer_sort != _sb_sort) {
00064     ShadowBuffers::iterator it;
00065     for(it = _sbuffers.begin(); it != _sbuffers.end(); ++it) {
00066       (*it).second->set_sort(buffer_sort);
00067     }
00068     _sb_sort = buffer_sort;
00069   }
00070   set_active(caster);
00071 }
00072 
 All Classes Functions Variables Enumerations