TerrainTex.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. // TerrainTex.h
  24. // Class to generate texture for terrain.
  25. // Author: John Ahlquist, April 2001
  26. #pragma once
  27. #ifndef TERRAINTEX_H
  28. #define TERRAINTEX_H
  29. //#define DO_8STAGE_TERRAIN_PASS //optimized terrain rendering for Nvidia based cards
  30. #include "WW3D2/Texture.h"
  31. #include "WWMATH/Matrix3d.h"
  32. #include "common/AsciiString.h"
  33. class WorldHeightMap;
  34. #define TILE_OFFSET 8
  35. /** ***********************************************************************
  36. ** TerrainTextureClass
  37. ***************************************************************************/
  38. class TerrainTextureClass : public TextureClass
  39. {
  40. W3DMPO_GLUE(TerrainTextureClass)
  41. protected:
  42. virtual void Apply(unsigned int stage);
  43. public:
  44. /// Create texture for a height map.
  45. TerrainTextureClass(int height);
  46. /// Create texture for a height map.
  47. TerrainTextureClass(int height, int width);
  48. // just use default destructor. ~TerrainTextureClass(void);
  49. public:
  50. int update(WorldHeightMap *htMap); ///< Sets the pixels, and returns the actual height of the texture.
  51. Bool updateFlat(WorldHeightMap *htMap, Int xCell, Int yCell, Int cellWidth, Int pixelsPerCell); ///< Sets the pixels.
  52. void setLOD(Int LOD);
  53. };
  54. class AlphaTerrainTextureClass : public TextureClass
  55. {
  56. W3DMPO_GLUE(AlphaTerrainTextureClass)
  57. protected:
  58. virtual void Apply(unsigned int stage);
  59. public:
  60. // Create texture for a height map.
  61. AlphaTerrainTextureClass(TextureClass *pBaseTex );
  62. // just use default destructor. ~TerrainTextureClass(void);
  63. };
  64. /** ***********************************************************************
  65. ** AlphaEdgeTextureClass
  66. ***************************************************************************/
  67. class AlphaEdgeTextureClass : public TextureClass
  68. {
  69. W3DMPO_GLUE(AlphaEdgeTextureClass)
  70. protected:
  71. virtual void Apply(unsigned int stage);
  72. int update256(WorldHeightMap *htMap);///< Sets the pixels, and returns the actual height of the texture.
  73. public:
  74. /// Create texture for a height map.
  75. AlphaEdgeTextureClass(int height, MipCountType mipLevelCount = MIP_LEVELS_3 );
  76. // just use default destructor. ~TerrainTextureClass(void);
  77. public:
  78. int update(WorldHeightMap *htMap); ///< Sets the pixels, and returns the actual height of the texture.
  79. };
  80. class LightMapTerrainTextureClass : public TextureClass
  81. {
  82. W3DMPO_GLUE(LightMapTerrainTextureClass)
  83. protected:
  84. virtual void Apply(unsigned int stage);
  85. public:
  86. // Create texture from a height map.
  87. LightMapTerrainTextureClass( AsciiString name, MipCountType mipLevelCount = MIP_LEVELS_ALL );
  88. // just use default destructor.
  89. };
  90. class ScorchTextureClass : public TextureClass
  91. {
  92. W3DMPO_GLUE(ScorchTextureClass)
  93. protected:
  94. virtual void Apply(unsigned int stage);
  95. public:
  96. // Create texture.
  97. ScorchTextureClass( MipCountType mipLevelCount = MIP_LEVELS_3 );
  98. // just use default destructor. ~ScorchTextureClass(void);
  99. };
  100. class CloudMapTerrainTextureClass : public TextureClass
  101. {
  102. W3DMPO_GLUE(CloudMapTerrainTextureClass)
  103. protected:
  104. virtual void Apply(unsigned int stage);
  105. protected:
  106. float m_xSlidePerSecond ; ///< How far the clouds move per second.
  107. float m_ySlidePerSecond ; ///< How far the clouds move per second.
  108. int m_curTick;
  109. float m_xOffset;
  110. float m_yOffset;
  111. public:
  112. // Create texture from a height map.
  113. CloudMapTerrainTextureClass( MipCountType mipLevelCount = MIP_LEVELS_ALL );
  114. // just use default destructor. ~TerrainTextureClass(void);
  115. void restore(void);
  116. };
  117. #endif //TEXTURE_H