materialeffect.cpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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/materialeffect.cpp $*
  25. * *
  26. * Original Author:: Greg Hjelstrom *
  27. * *
  28. * $Author:: Greg_h $*
  29. * *
  30. * $Modtime:: 12/07/01 2:43p $*
  31. * *
  32. * $Revision:: 4 $*
  33. * *
  34. *---------------------------------------------------------------------------------------------*
  35. * Functions: *
  36. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  37. #include "materialeffect.h"
  38. #include "materialeffectlist.h"
  39. #include "rinfo.h"
  40. #include "matpass.h"
  41. static NonRefMaterialEffectListClass _AllocatedEffects;
  42. /*************************************************************************************************
  43. **
  44. ** MaterialEffectClass Implementation
  45. **
  46. *************************************************************************************************/
  47. MaterialEffectClass::MaterialEffectClass(void) :
  48. AutoRemoveEnabled(false),
  49. SuppressShadows(false)
  50. {
  51. _AllocatedEffects.Add(this);
  52. }
  53. MaterialEffectClass::~MaterialEffectClass(void)
  54. {
  55. _AllocatedEffects.Remove(this);
  56. }
  57. void MaterialEffectClass::Timestep_All_Effects(float dt)
  58. {
  59. NonRefMaterialEffectListIterator it(&_AllocatedEffects);
  60. while (!it.Is_Done()) {
  61. it.Peek_Obj()->Timestep(dt);
  62. it.Next();
  63. }
  64. }
  65. /*************************************************************************************************
  66. **
  67. ** SimpleEffectClass Implementation
  68. **
  69. *************************************************************************************************/
  70. DEFINE_AUTO_POOL(SimpleEffectClass, SIMPLE_EFFECT_GROWTH_STEP);
  71. SimpleEffectClass::SimpleEffectClass(MaterialPassClass * matpass) :
  72. MatPass(NULL)
  73. {
  74. REF_PTR_SET(MatPass,matpass);
  75. }
  76. SimpleEffectClass::~SimpleEffectClass(void)
  77. {
  78. REF_PTR_RELEASE(MatPass);
  79. }
  80. void SimpleEffectClass::Render_Push(RenderInfoClass & rinfo,PhysClass *)
  81. {
  82. rinfo.Push_Material_Pass(MatPass);
  83. }
  84. void SimpleEffectClass::Render_Pop(RenderInfoClass & rinfo)
  85. {
  86. rinfo.Pop_Material_Pass();
  87. }