grideffect.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. ** Command & Conquer Renegade(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. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : wwphys *
  23. * *
  24. * $Archive:: /Commando/Code/wwphys/grideffect.h $*
  25. * *
  26. * Original Author:: Greg Hjelstrom *
  27. * *
  28. * $Author:: Greg_h $*
  29. * *
  30. * $Modtime:: 6/20/01 6:15p $*
  31. * *
  32. * $Revision:: 3 $*
  33. * *
  34. *---------------------------------------------------------------------------------------------*
  35. * Functions: *
  36. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  37. #if defined(_MSC_VER)
  38. #pragma once
  39. #endif
  40. #ifndef GRIDEFFECT_H
  41. #define GRIDEFFECT_H
  42. #include "always.h"
  43. #include "materialeffect.h"
  44. #include "matrix3d.h"
  45. class MatrixMapperClass;
  46. class TextureClass;
  47. /**
  48. ** GridFadeEffectClass
  49. ** This material effect super-imposes a 2d projected grid over the object that is rendered.
  50. ** The grid fades up, the object disappears, and the grid fades down.
  51. */
  52. class GridEffectClass : public MaterialEffectClass
  53. {
  54. public:
  55. GridEffectClass(void);
  56. ~GridEffectClass(void);
  57. virtual void Render_Push(RenderInfoClass & rinfo,PhysClass * obj);
  58. virtual void Render_Pop(RenderInfoClass & rinfo);
  59. /*
  60. ** The "parameter" changes from 0 to 1 at the specified rate, it controls
  61. ** all other effects.
  62. */
  63. void Set_Current_Parameter(float param) { CurrentParameter = param; }
  64. void Set_Target_Parameter(float param) { TargetParameter = param; }
  65. void Set_Parameter_Rate(float rate) { ParameterRate = rate; }
  66. float Get_Current_Parameter(void) { return CurrentParameter; }
  67. float Get_Target_Parameter(void) { return TargetParameter; }
  68. float Get_Parameter_Rate(void) { return ParameterRate; }
  69. /*
  70. ** Control over the grid transform, this enables you to set the coordinate
  71. ** axes that will generate the grid.
  72. */
  73. void Set_Grid_Transform(const Matrix3D & tm);
  74. const Matrix3D & Get_Grid_Transform(void);
  75. /*
  76. ** Texture, the texture is used one row at a time. Animation of the grid
  77. ** lines is achieved by scrolling through the rows of the texture as the
  78. ** "parameter" changes. GridEffectClass will automatically use a default
  79. ** texture if the user doesn't want to specify a custom one.
  80. */
  81. void Set_Texture(TextureClass * tex);
  82. TextureClass * Peek_Texture(void);
  83. protected:
  84. float CurrentParameter;
  85. float TargetParameter;
  86. float ParameterRate;
  87. unsigned int LastRenderTime;
  88. Matrix3D GridTransform;
  89. bool RenderBaseMaterial;
  90. bool RenderGridMaterial;
  91. MatrixMapperClass * Stage0Mapper;
  92. MatrixMapperClass * Stage1Mapper;
  93. MaterialPassClass * MaterialPass;
  94. };
  95. #endif //GRIDEFFECT_H