W3DDynamicLight.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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 BaseHeightMapRenderObjClass;
  38. friend class HeightMapRenderObjClass;
  39. protected:
  40. /// Values used by HeightMapRenderObjClass to update the height map.
  41. Bool m_priorEnable;
  42. Bool m_processMe;
  43. Int m_prevMinX, m_prevMinY, m_prevMaxX, m_prevMaxY;
  44. Int m_minX, m_minY, m_maxX, m_maxY;
  45. Bool m_enabled;
  46. Bool m_decayRange;
  47. Bool m_decayColor;
  48. UnsignedInt m_curDecayFrameCount;
  49. UnsignedInt m_curIncreaseFrameCount;
  50. UnsignedInt m_decayFrameCount;
  51. UnsignedInt m_increaseFrameCount;
  52. Real m_targetRange;
  53. Vector3 m_targetAmbient;
  54. Vector3 m_targetDiffuse;
  55. public:
  56. W3DDynamicLight();
  57. ~W3DDynamicLight(void);
  58. public:
  59. virtual void On_Frame_Update(void);
  60. void setEnabled(Bool enabled) { m_enabled = enabled; m_decayRange = false; m_decayFrameCount = 0; m_decayColor = false; m_increaseFrameCount = 0;};
  61. Bool isEnabled(void) {return m_enabled;};
  62. /// 0 frameIncreaseTime means it starts out full size/intensity, 0 decay time means it lasts forever.
  63. void setFrameFade(UnsignedInt frameIncreaseTime, UnsignedInt decayFrameTime);
  64. void setDecayRange(void) {m_decayRange = true;};
  65. void setDecayColor(void) {m_decayColor = true;};
  66. // Cull returns true if the terrain vertex at x,y is outside of the light's influence.
  67. Bool cull(Int x, Int y ) {return (x<m_minX||y<m_minY||x>m_maxX||y>m_maxY);}
  68. };
  69. #endif //TEXTURE_H