W3DDynamicLight.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // W3DDynamicLight.h
  24. // Class to generate texture for terrain.
  25. // Author: John Ahlquist, April 2001
  26. #pragma once
  27. #ifndef W3D_DYNAMIC_LIGHT_H
  28. #define W3D_DYNAMIC_LIGHT_H
  29. #include "WW3D2/Light.h"
  30. #include "lib/baseType.h"
  31. class HeightMapRenderObjClass;
  32. /*************************************************************************
  33. ** W3DDynamicLight
  34. ***************************************************************************/
  35. class W3DDynamicLight : public LightClass
  36. {
  37. friend class HeightMapRenderObjClass;
  38. protected:
  39. /// Values used by HeightMapRenderObjClass to update the height map.
  40. Bool m_priorEnable;
  41. Bool m_processMe;
  42. Int m_prevMinX, m_prevMinY, m_prevMaxX, m_prevMaxY;
  43. Int m_minX, m_minY, m_maxX, m_maxY;
  44. Bool m_enabled;
  45. Bool m_decayRange;
  46. Bool m_decayColor;
  47. UnsignedInt m_curDecayFrameCount;
  48. UnsignedInt m_curIncreaseFrameCount;
  49. UnsignedInt m_decayFrameCount;
  50. UnsignedInt m_increaseFrameCount;
  51. Real m_targetRange;
  52. Vector3 m_targetAmbient;
  53. Vector3 m_targetDiffuse;
  54. public:
  55. W3DDynamicLight();
  56. ~W3DDynamicLight(void);
  57. public:
  58. virtual void On_Frame_Update(void);
  59. void setEnabled(Bool enabled) { m_enabled = enabled; m_decayRange = false; m_decayFrameCount = 0; m_decayColor = false; m_increaseFrameCount = 0;};
  60. Bool isEnabled(void) {return m_enabled;};
  61. /// 0 frameIncreaseTime means it starts out full size/intensity, 0 decay time means it lasts forever.
  62. void setFrameFade(UnsignedInt frameIncreaseTime, UnsignedInt decayFrameTime);
  63. void setDecayRange(void) {m_decayRange = true;};
  64. void setDecayColor(void) {m_decayColor = true;};
  65. // Cull returns true if the terrain vertex at x,y is outside of the light's influence.
  66. Bool cull(Int x, Int y ) {return (x<m_minX||y<m_minY||x>m_maxX||y>m_maxY);}
  67. };
  68. #endif //TEXTURE_H