TerrainTex.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. // 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. int update256(WorldHeightMap *htMap);///< Sets the pixels, and returns the actual height of the texture.
  44. public:
  45. /// Create texture for a height map.
  46. TerrainTextureClass(int height, MipCountType mipLevelCount = MIP_LEVELS_3 );
  47. // just use default destructor. ~TerrainTextureClass(void);
  48. public:
  49. int update(WorldHeightMap *htMap); ///< Sets the pixels, and returns the actual height of the texture.
  50. };
  51. class AlphaTerrainTextureClass : public TextureClass
  52. {
  53. W3DMPO_GLUE(AlphaTerrainTextureClass)
  54. protected:
  55. virtual void Apply(unsigned int stage);
  56. public:
  57. // Create texture for a height map.
  58. AlphaTerrainTextureClass(TextureClass *pBaseTex );
  59. // just use default destructor. ~TerrainTextureClass(void);
  60. };
  61. /** ***********************************************************************
  62. ** AlphaEdgeTextureClass
  63. ***************************************************************************/
  64. class AlphaEdgeTextureClass : public TextureClass
  65. {
  66. W3DMPO_GLUE(AlphaEdgeTextureClass)
  67. protected:
  68. virtual void Apply(unsigned int stage);
  69. int update256(WorldHeightMap *htMap);///< Sets the pixels, and returns the actual height of the texture.
  70. public:
  71. /// Create texture for a height map.
  72. AlphaEdgeTextureClass(int height, MipCountType mipLevelCount = MIP_LEVELS_3 );
  73. // just use default destructor. ~TerrainTextureClass(void);
  74. public:
  75. int update(WorldHeightMap *htMap); ///< Sets the pixels, and returns the actual height of the texture.
  76. };
  77. class LightMapTerrainTextureClass : public TextureClass
  78. {
  79. W3DMPO_GLUE(LightMapTerrainTextureClass)
  80. protected:
  81. virtual void Apply(unsigned int stage);
  82. public:
  83. // Create texture from a height map.
  84. LightMapTerrainTextureClass( AsciiString name, MipCountType mipLevelCount = MIP_LEVELS_ALL );
  85. // just use default destructor.
  86. };
  87. class ScorchTextureClass : public TextureClass
  88. {
  89. W3DMPO_GLUE(ScorchTextureClass)
  90. protected:
  91. virtual void Apply(unsigned int stage);
  92. public:
  93. // Create texture.
  94. ScorchTextureClass( MipCountType mipLevelCount = MIP_LEVELS_3 );
  95. // just use default destructor. ~ScorchTextureClass(void);
  96. };
  97. class CloudMapTerrainTextureClass : public TextureClass
  98. {
  99. W3DMPO_GLUE(CloudMapTerrainTextureClass)
  100. protected:
  101. virtual void Apply(unsigned int stage);
  102. protected:
  103. float m_xSlidePerSecond ; ///< How far the clouds move per second.
  104. float m_ySlidePerSecond ; ///< How far the clouds move per second.
  105. int m_curTick;
  106. float m_xOffset;
  107. float m_yOffset;
  108. public:
  109. // Create texture from a height map.
  110. CloudMapTerrainTextureClass( MipCountType mipLevelCount = MIP_LEVELS_ALL );
  111. // just use default destructor. ~TerrainTextureClass(void);
  112. void restore(void);
  113. };
  114. #endif //TEXTURE_H