rinfo.cpp 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. *** 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 : WW3D *
  23. * *
  24. * $Archive:: /Commando/Code/ww3d2/rinfo.cpp $*
  25. * *
  26. * Author:: Greg Hjelstrom *
  27. * *
  28. * $Modtime:: 8/24/01 3:31p $*
  29. * *
  30. * $Revision:: 13 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #include "rinfo.h"
  36. #include "camera.h"
  37. #include "matpass.h"
  38. /***********************************************************************************************
  39. **
  40. ** RenderInfoClass Implementation
  41. **
  42. ***********************************************************************************************/
  43. RenderInfoClass::RenderInfoClass(CameraClass & cam) :
  44. Camera(cam),
  45. fog_start(0.0f),
  46. fog_end(0.0f),
  47. fog_scale(0.0f),
  48. light_environment(0),
  49. AdditionalMaterialPassCount(0),
  50. OverrideFlagLevel(0),
  51. alphaOverride(1.0f),
  52. materialPassAlphaOverride(1.0f),
  53. materialPassEmissiveOverride(1.0f)
  54. {
  55. // Need to have one entry in the override flags stack, initialize it to default values.
  56. OverrideFlag[OverrideFlagLevel]=RINFO_OVERRIDE_DEFAULT;
  57. }
  58. RenderInfoClass::~RenderInfoClass(void)
  59. {
  60. }
  61. void RenderInfoClass::Push_Material_Pass(MaterialPassClass * matpass)
  62. {
  63. // add to the end of the array
  64. if (matpass) {
  65. matpass->Add_Ref();
  66. }
  67. WWASSERT(AdditionalMaterialPassCount<MAX_ADDITIONAL_MATERIAL_PASSES);
  68. AdditionalMaterialPassArray[AdditionalMaterialPassCount++]=matpass;
  69. }
  70. void RenderInfoClass::Pop_Material_Pass(void)
  71. {
  72. // remove from the end of the array
  73. WWASSERT(AdditionalMaterialPassCount>0);
  74. AdditionalMaterialPassCount--;
  75. MaterialPassClass * mpass = AdditionalMaterialPassArray[AdditionalMaterialPassCount];
  76. if (mpass != NULL) {
  77. mpass->Release_Ref();
  78. }
  79. }
  80. int RenderInfoClass::Additional_Pass_Count(void)
  81. {
  82. return AdditionalMaterialPassCount;
  83. }
  84. MaterialPassClass * RenderInfoClass::Peek_Additional_Pass(int i)
  85. {
  86. return AdditionalMaterialPassArray[i];
  87. }
  88. void RenderInfoClass::Push_Override_Flags(RINFO_OVERRIDE_FLAGS flg)
  89. {
  90. // copy to the end of the array
  91. WWASSERT(OverrideFlagLevel<MAX_OVERRIDE_FLAG_LEVEL);
  92. OverrideFlagLevel++;
  93. OverrideFlag[OverrideFlagLevel]=flg;
  94. }
  95. void RenderInfoClass::Pop_Override_Flags(void)
  96. {
  97. WWASSERT(OverrideFlagLevel>0);
  98. OverrideFlagLevel--;
  99. }
  100. RenderInfoClass::RINFO_OVERRIDE_FLAGS & RenderInfoClass::Current_Override_Flags(void)
  101. {
  102. return OverrideFlag[OverrideFlagLevel];
  103. }
  104. /***********************************************************************************************
  105. **
  106. ** SpecialRenderInfoClass Implementation
  107. **
  108. ***********************************************************************************************/
  109. SpecialRenderInfoClass::SpecialRenderInfoClass(CameraClass & cam,int render_type) :
  110. RenderInfoClass(cam),
  111. RenderType(render_type),
  112. VisRasterizer(NULL),
  113. BWRenderer(NULL)
  114. {
  115. }
  116. SpecialRenderInfoClass::~SpecialRenderInfoClass(void)
  117. {
  118. }