Water.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. // FILE: Water.h //////////////////////////////////////////////////////////////////////////////////
  24. // Author: Colin Day, December 2001
  25. // Desc: Water settings
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef __WATER_H_
  29. #define __WATER_H_
  30. // INLCLUDES //////////////////////////////////////////////////////////////////////////////////////
  31. #include "Common/GameType.h"
  32. #include "Common/Overridable.h"
  33. #include "Common/Override.h"
  34. //-------------------------------------------------------------------------------------------------
  35. struct FieldParse;
  36. //-------------------------------------------------------------------------------------------------
  37. /** This structures keeps the settings for how our water will look */
  38. //-------------------------------------------------------------------------------------------------
  39. class WaterSetting
  40. {
  41. public:
  42. WaterSetting( void );
  43. virtual ~WaterSetting( void );
  44. /// Get the INI parsing table for loading
  45. const FieldParse *getFieldParse( void ) { return m_waterSettingFieldParseTable; }
  46. static const FieldParse m_waterSettingFieldParseTable[]; ///< the parse table for INI definition
  47. AsciiString m_skyTextureFile;
  48. AsciiString m_waterTextureFile;
  49. Int m_waterRepeatCount;
  50. Real m_skyTexelsPerUnit; //texel density of sky plane (higher value repeats texture more).
  51. RGBAColorInt m_vertex00Diffuse;
  52. RGBAColorInt m_vertex10Diffuse;
  53. RGBAColorInt m_vertex11Diffuse;
  54. RGBAColorInt m_vertex01Diffuse;
  55. RGBAColorInt m_waterDiffuseColor;
  56. RGBAColorInt m_transparentWaterDiffuse;
  57. Real m_uScrollPerMs;
  58. Real m_vScrollPerMs;
  59. };
  60. //-------------------------------------------------------------------------------------------------
  61. /** This structure keeps the transparency and vertex settings, which are the same regardless of the
  62. time of day. They can be overridden on a per-map basis. */
  63. //-------------------------------------------------------------------------------------------------
  64. class WaterTransparencySetting : public Overridable
  65. {
  66. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( WaterTransparencySetting, "WaterTransparencySetting" )
  67. public:
  68. Real m_transparentWaterDepth;
  69. Real m_minWaterOpacity;
  70. AsciiString m_skyboxTextureN;
  71. AsciiString m_skyboxTextureE;
  72. AsciiString m_skyboxTextureS;
  73. AsciiString m_skyboxTextureW;
  74. AsciiString m_skyboxTextureT;
  75. public:
  76. WaterTransparencySetting()
  77. {
  78. m_transparentWaterDepth = 3.0f;
  79. m_minWaterOpacity = 1.0f;
  80. m_skyboxTextureN = "TSMorningN.tga";
  81. m_skyboxTextureE = "TSMorningE.tga";
  82. m_skyboxTextureS = "TSMorningS.tga";
  83. m_skyboxTextureW = "TSMorningW.tga";
  84. m_skyboxTextureT = "TSMorningT.tga";
  85. }
  86. static const FieldParse m_waterTransparencySettingFieldParseTable[]; ///< the parse table for INI definition
  87. /// Get the INI parsing table for loading
  88. const FieldParse *getFieldParse( void ) const { return m_waterTransparencySettingFieldParseTable; }
  89. };
  90. EMPTY_DTOR(WaterTransparencySetting)
  91. // EXTERNAL ///////////////////////////////////////////////////////////////////////////////////////
  92. extern WaterSetting WaterSettings[ TIME_OF_DAY_COUNT ];
  93. extern OVERRIDE<WaterTransparencySetting> TheWaterTransparency;
  94. #endif // __WATER_H_