rinfo.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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 : WW3D *
  23. * *
  24. * $Archive:: /Commando/Code/ww3d2/rinfo.h $*
  25. * *
  26. * Author:: Greg Hjelstrom *
  27. * *
  28. * $Modtime:: 1/11/02 3:43p $*
  29. * *
  30. * $Revision:: 15 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef RINFO_H
  39. #define RINFO_H
  40. #include "always.h"
  41. #include "bittype.h"
  42. #include "ww3d.h"
  43. #include "wwdebug.h"
  44. #include "shader.h"
  45. #include "vector.h"
  46. #include "matrix3d.h"
  47. #include "matrix4.h"
  48. class MaterialPassClass;
  49. class LightEnvironmentClass;
  50. class VisRasterizerClass;
  51. class BWRenderClass;
  52. const unsigned MAX_ADDITIONAL_MATERIAL_PASSES=32;
  53. const unsigned MAX_OVERRIDE_FLAG_LEVEL=32;
  54. /**
  55. ** RenderInfoClass
  56. ** This class contains all of the data needed for the scene to render
  57. ** itself. It will be passed on to the scene from a WW3D::Render(scene)
  58. ** call.
  59. **
  60. ** Camera - The camera being used to render the scene, contains culling code, etc
  61. */
  62. class RenderInfoClass
  63. {
  64. public:
  65. RenderInfoClass(CameraClass & cam);
  66. ~RenderInfoClass(void);
  67. enum RINFO_OVERRIDE_FLAGS {
  68. RINFO_OVERRIDE_DEFAULT = 0x0000, // No overrides
  69. RINFO_OVERRIDE_FORCE_TWO_SIDED = 0x0001, // Override mesh settings to force no backface culling
  70. RINFO_OVERRIDE_FORCE_SORTING = 0x0002, // Override mesh settings to force sorting
  71. RINFO_OVERRIDE_ADDITIONAL_PASSES_ONLY = 0x0004, // Do not render base passes (only additional passes)
  72. RINFO_OVERRIDE_SHADOW_RENDERING = 0x0008 // Hint: we are rendering a shadow
  73. };
  74. void Push_Material_Pass(MaterialPassClass * matpass);
  75. void Pop_Material_Pass(void);
  76. int Additional_Pass_Count(void);
  77. MaterialPassClass * Peek_Additional_Pass(int i);
  78. void Push_Override_Flags(RINFO_OVERRIDE_FLAGS flg); // Saves current override flags on stack and installs a new one
  79. void Pop_Override_Flags(void); // Restores previous override flags from stack
  80. RINFO_OVERRIDE_FLAGS & Current_Override_Flags(void); // Access to current override flags
  81. CameraClass & Camera;
  82. float fog_scale;
  83. float fog_start;
  84. float fog_end;
  85. LightEnvironmentClass* light_environment;
  86. protected:
  87. MaterialPassClass* AdditionalMaterialPassArray[MAX_ADDITIONAL_MATERIAL_PASSES];
  88. unsigned AdditionalMaterialPassCount;
  89. unsigned RejectedMaterialPasses;
  90. RINFO_OVERRIDE_FLAGS OverrideFlag[MAX_OVERRIDE_FLAG_LEVEL];
  91. unsigned OverrideFlagLevel;
  92. };
  93. /**
  94. ** SpecialRenderInfoClass
  95. ** This structure also contains a "grab-bag" of junk for use by the Special_Render
  96. ** function. The first use that I have for Special_Render is to implement the
  97. ** visibility detection algorithm where each object is rendered in such a way
  98. ** that I can get the 'id' of the object which generated each pixel on the screen.
  99. ** Another use I have planned for Special_Render is a shadow rendering mode that
  100. ** just draws an object in solid black from the point of view of a light source.
  101. ** This would just need another enum for the RenderType...
  102. **
  103. ** The reason for a Special_Render function is that I didn't want to pollute
  104. ** the main rendering pipeline with checks for these alternate rendering operations.
  105. */
  106. class SpecialRenderInfoClass : public RenderInfoClass
  107. {
  108. public:
  109. SpecialRenderInfoClass(CameraClass & cam,int render_type);
  110. ~SpecialRenderInfoClass(void);
  111. // The following fields are only used by the Special_Render function.
  112. // this is basically just a place to stick whatever information you need.
  113. enum
  114. {
  115. RENDER_VIS,
  116. RENDER_SHADOW
  117. };
  118. int RenderType;
  119. // RENDER_VIS variables and methods:
  120. VisRasterizerClass * VisRasterizer;
  121. // RENDER_SHADOW variables and methods:
  122. // NOTE: this is somewhat obsolete now that we have hardware render-to-texture.
  123. BWRenderClass * BWRenderer; // Black & white non-textured renderer
  124. private:
  125. // Not implemented...
  126. SpecialRenderInfoClass(const RenderInfoClass &);
  127. SpecialRenderInfoClass & operator = (const RenderInfoClass &);
  128. };
  129. #endif