lightLensNode.I 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Filename: lightLensNode.I
  2. // Created by: drose (26Mar02)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) Carnegie Mellon University. All rights reserved.
  8. //
  9. // All use of this software is subject to the terms of the revised BSD
  10. // license. You should have received a copy of this license along
  11. // with this source code in a file named "LICENSE."
  12. //
  13. ////////////////////////////////////////////////////////////////////
  14. ////////////////////////////////////////////////////////////////////
  15. // Function: LightLensNode::is_shadow_caster
  16. // Access: Published
  17. // Description: Returns whether this light is configured to cast
  18. // shadows or not.
  19. ////////////////////////////////////////////////////////////////////
  20. INLINE bool LightLensNode::
  21. is_shadow_caster() {
  22. return _shadow_caster;
  23. }
  24. ////////////////////////////////////////////////////////////////////
  25. // Function: LightLensNode::set_shadow_caster
  26. // Access: Published
  27. // Description: Sets the flag indicating whether this light should
  28. // cast shadows or not. This is the variant without
  29. // buffer size, meaning that the current buffer size
  30. // will be kept (512x512 is the default).
  31. // Note that enabling shadows will require the shader
  32. // generator to be enabled on the scene.
  33. ////////////////////////////////////////////////////////////////////
  34. INLINE void LightLensNode::
  35. set_shadow_caster(bool caster) {
  36. if (_shadow_caster && !caster) {
  37. clear_shadow_buffers();
  38. }
  39. _shadow_caster = caster;
  40. set_active(caster);
  41. }
  42. ////////////////////////////////////////////////////////////////////
  43. // Function: LightLensNode::set_shadow_caster
  44. // Access: Published
  45. // Description: Sets the flag indicating whether this light should
  46. // cast shadows or not. The xsize and ysize parameters
  47. // specify the size of the shadow buffer that will be
  48. // set up, the sort parameter specifies the sort.
  49. // Note that enabling shadows will require the shader
  50. // generator to be enabled on the scene.
  51. ////////////////////////////////////////////////////////////////////
  52. INLINE void LightLensNode::
  53. set_shadow_caster(bool caster, int buffer_xsize, int buffer_ysize, int buffer_sort) {
  54. if ((_shadow_caster && !caster) || buffer_xsize != _sb_xsize || buffer_ysize != _sb_ysize) {
  55. clear_shadow_buffers();
  56. }
  57. _shadow_caster = caster;
  58. _sb_xsize = buffer_xsize;
  59. _sb_ysize = buffer_ysize;
  60. if (buffer_sort != _sb_sort) {
  61. ShadowBuffers::iterator it;
  62. for(it = _sbuffers.begin(); it != _sbuffers.end(); ++it) {
  63. (*it).second->set_sort(buffer_sort);
  64. }
  65. _sb_sort = buffer_sort;
  66. }
  67. set_active(caster);
  68. }