2
0

transitioneffect.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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/transitioneffect.h $*
  25. * *
  26. * Original Author:: Greg Hjelstrom *
  27. * *
  28. * $Author:: Patrick $*
  29. * *
  30. * $Modtime:: 10/06/01 6:59p $*
  31. * *
  32. * $Revision:: 7 $*
  33. * *
  34. *---------------------------------------------------------------------------------------------*
  35. * Functions: *
  36. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  37. #ifndef TRANSITIONEFFECT_H
  38. #define TRANSITIONEFFECT_H
  39. #include "always.h"
  40. #include "materialeffect.h"
  41. #include "vector2.h"
  42. #include "matrixmapper.h"
  43. class ChunkSaveClass;
  44. class ChunkLoadClass;
  45. class TextureClass;
  46. /**
  47. ** TransitionEffectClass
  48. ** This material effect can manage and display a "transition" effect for an object.
  49. ** It has a requirement that the user "timestep" it each frame so that its internal
  50. ** state gets updated. The transition is controlled by a single parameter which
  51. ** when zero, the object is invisible and when 1, the object is fully visible.
  52. */
  53. class TransitionEffectClass : public MaterialEffectClass
  54. {
  55. public:
  56. TransitionEffectClass(void);
  57. ~TransitionEffectClass(void);
  58. virtual void Timestep(float dt);
  59. virtual void Render_Push(RenderInfoClass & rinfo,PhysClass * obj);
  60. virtual void Render_Pop(RenderInfoClass & rinfo);
  61. /*
  62. ** Initialization
  63. */
  64. void Set_Parameter(float param) { CurrentParameter = param; }
  65. void Set_Target_Parameter(float param) { TargetParameter = param; }
  66. void Set_Texture(TextureClass * texture);
  67. void Set_Start_Delay(float seconds) { StartDelay = seconds; }
  68. void Set_Transition_Time(float seconds) { if (seconds > 0.0f) ParameterVelocity = 1.0f / seconds; }
  69. void Set_Min_UV_Velocity(const Vector2 & uv_vel) { MinUVRate = uv_vel; }
  70. void Set_Max_UV_Velocity(const Vector2 & uv_vel) { MaxUVRate = uv_vel; }
  71. void Set_Max_Intensity(float max_inten) { MaxIntensity = max_inten; }
  72. void Enable_Remove_On_Complete(bool onoff) { RemoveOnComplete = onoff; }
  73. float Get_Parameter(void) const { return CurrentParameter; }
  74. float Get_Target_Parameter(void) const { return TargetParameter; }
  75. float Get_Max_Intensity(void) const { return MaxIntensity; }
  76. float Get_Start_Delay(void) const { return StartDelay; }
  77. bool Is_Remove_On_Complete_Enabled(void) const { return RemoveOnComplete; }
  78. /*
  79. ** Save-Load support
  80. */
  81. bool Save(ChunkSaveClass & csave);
  82. bool Load(ChunkLoadClass & cload);
  83. protected:
  84. /*
  85. ** Current State
  86. */
  87. float CurrentParameter;
  88. float TargetParameter;
  89. /*
  90. ** Properties
  91. */
  92. float ParameterVelocity;
  93. Vector2 MinUVRate;
  94. Vector2 MaxUVRate;
  95. Vector2 UVRate;
  96. float MaxIntensity;
  97. float StartDelay;
  98. bool RemoveOnComplete;
  99. /*
  100. ** Render State
  101. */
  102. bool RenderBaseMaterial;
  103. bool RenderTransitionMaterial;
  104. float IntensityScale;
  105. Vector2 UVOffset;
  106. MatrixMapperClass * Mapper;
  107. MaterialPassClass * MaterialPass;
  108. };
  109. #endif //TRANSITIONEFFECT_H