Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

215 lines
4.7 KiB

  1. //===== Copyright (c), Valve Corporation, All rights reserved. ======//
  2. #ifndef imaterialsystem_declarations_h
  3. #define imaterialsystem_declarations_h
  4. #ifndef IMPLEMENT_OPERATOR_EQUAL
  5. // Define a reasonable operator=
  6. #define IMPLEMENT_OPERATOR_EQUAL( _classname ) \
  7. public: \
  8. _classname &operator=( const _classname &src ) \
  9. { \
  10. memcpy( this, &src, sizeof(_classname) ); \
  11. return *this; \
  12. }
  13. #endif
  14. // Sergiy: moved to _declarations.h
  15. /** EAPS3 [ pWallace ]
  16. * Moved to DmaPacketPcStubs.h:
  17. *
  18. * - Standard vertex shader constants
  19. */
  20. enum MaterialMatrixMode_t
  21. {
  22. MATERIAL_VIEW = 0,
  23. MATERIAL_PROJECTION,
  24. /*
  25. MATERIAL_MATRIX_UNUSED0,
  26. MATERIAL_MATRIX_UNUSED1,
  27. MATERIAL_MATRIX_UNUSED2,
  28. MATERIAL_MATRIX_UNUSED3,
  29. MATERIAL_MATRIX_UNUSED4,
  30. MATERIAL_MATRIX_UNUSED5,
  31. MATERIAL_MATRIX_UNUSED6,
  32. MATERIAL_MATRIX_UNUSED7,
  33. */
  34. // Texture matrices; used to be UNUSED
  35. MATERIAL_TEXTURE0,
  36. MATERIAL_TEXTURE1,
  37. MATERIAL_TEXTURE2,
  38. MATERIAL_TEXTURE3,
  39. MATERIAL_TEXTURE4,
  40. MATERIAL_TEXTURE5,
  41. MATERIAL_TEXTURE6,
  42. MATERIAL_TEXTURE7,
  43. MATERIAL_MODEL,
  44. // Total number of matrices
  45. NUM_MATRIX_MODES = MATERIAL_MODEL+1,
  46. // Number of texture transforms
  47. NUM_TEXTURE_TRANSFORMS = MATERIAL_TEXTURE7 - MATERIAL_TEXTURE0 + 1
  48. };
  49. /*******************************************************************************
  50. * MaterialFogMode_t
  51. *******************************************************************************/
  52. enum MaterialFogMode_t
  53. {
  54. MATERIAL_FOG_NONE,
  55. MATERIAL_FOG_LINEAR,
  56. MATERIAL_FOG_LINEAR_BELOW_FOG_Z,
  57. };
  58. //--------------------------------------------------------------------------------
  59. // Uberlight parameters
  60. //--------------------------------------------------------------------------------
  61. struct UberlightState_t
  62. {
  63. UberlightState_t()
  64. {
  65. m_fNearEdge = 2.0f;
  66. m_fFarEdge = 100.0f;
  67. m_fCutOn = 10.0f;
  68. m_fCutOff = 650.0f;
  69. m_fShearx = 0.0f;
  70. m_fSheary = 0.0f;
  71. m_fWidth = 0.3f;
  72. m_fWedge = 0.05f;
  73. m_fHeight = 0.3f;
  74. m_fHedge = 0.05f;
  75. m_fRoundness = 0.8f;
  76. }
  77. float m_fNearEdge;
  78. float m_fFarEdge;
  79. float m_fCutOn;
  80. float m_fCutOff;
  81. float m_fShearx;
  82. float m_fSheary;
  83. float m_fWidth;
  84. float m_fWedge;
  85. float m_fHeight;
  86. float m_fHedge;
  87. float m_fRoundness;
  88. IMPLEMENT_OPERATOR_EQUAL( UberlightState_t );
  89. };
  90. class ITexture;
  91. class IMaterial;
  92. // fixme: should move this into something else.
  93. struct FlashlightState_t
  94. {
  95. FlashlightState_t()
  96. {
  97. m_bEnableShadows = false; // Provide reasonable defaults for shadow depth mapping parameters
  98. m_bDrawShadowFrustum = false;
  99. m_flShadowMapResolution = 1024.0f;
  100. m_flShadowFilterSize = 3.0f;
  101. m_flShadowSlopeScaleDepthBias = 16.0f;
  102. m_flShadowDepthBias = 0.0005f;
  103. m_flShadowJitterSeed = 0.0f;
  104. m_flFlashlightTime = 0.0f;
  105. m_flShadowAtten = 0.0f;
  106. m_flAmbientOcclusion = 0.0f;
  107. m_bScissor = false;
  108. m_nLeft = -1;
  109. m_nTop = -1;
  110. m_nRight = -1;
  111. m_nBottom = -1;
  112. m_nShadowQuality = 0;
  113. m_bShadowHighRes = false;
  114. m_bUberlight = false;
  115. m_bVolumetric = false;
  116. m_flNoiseStrength = 0.8f;
  117. m_nNumPlanes = 64;
  118. m_flPlaneOffset = 0.0f;
  119. m_flVolumetricIntensity = 1.0f;
  120. m_bOrtho = false;
  121. m_fOrthoLeft = -1.0f;
  122. m_fOrthoRight = 1.0f;
  123. m_fOrthoTop = -1.0f;
  124. m_fOrthoBottom = 1.0f;
  125. m_flProjectionSize = 500.0f;
  126. m_flProjectionRotation = 0.0f;
  127. }
  128. Vector m_vecLightOrigin;
  129. Quaternion m_quatOrientation;
  130. float m_NearZ;
  131. float m_FarZ;
  132. float m_fHorizontalFOVDegrees;
  133. float m_fVerticalFOVDegrees;
  134. bool m_bOrtho;
  135. float m_fOrthoLeft;
  136. float m_fOrthoRight;
  137. float m_fOrthoTop;
  138. float m_fOrthoBottom;
  139. float m_fQuadraticAtten;
  140. float m_fLinearAtten;
  141. float m_fConstantAtten;
  142. float m_FarZAtten;
  143. float m_Color[4];
  144. ITexture *m_pSpotlightTexture;
  145. IMaterial *m_pProjectedMaterial;
  146. int m_nSpotlightTextureFrame;
  147. // Shadow depth mapping parameters
  148. bool m_bEnableShadows;
  149. bool m_bDrawShadowFrustum;
  150. float m_flShadowMapResolution;
  151. float m_flShadowFilterSize;
  152. float m_flShadowSlopeScaleDepthBias;
  153. float m_flShadowDepthBias;
  154. float m_flShadowJitterSeed;
  155. float m_flShadowAtten;
  156. float m_flAmbientOcclusion;
  157. int m_nShadowQuality;
  158. bool m_bShadowHighRes;
  159. // simple projection
  160. float m_flProjectionSize;
  161. float m_flProjectionRotation;
  162. // Uberlight parameters
  163. bool m_bUberlight;
  164. UberlightState_t m_uberlightState;
  165. bool m_bVolumetric;
  166. float m_flNoiseStrength;
  167. float m_flFlashlightTime;
  168. int m_nNumPlanes;
  169. float m_flPlaneOffset;
  170. float m_flVolumetricIntensity;
  171. // Getters for scissor members
  172. bool DoScissor() const { return m_bScissor; }
  173. int GetLeft() const { return m_nLeft; }
  174. int GetTop() const { return m_nTop; }
  175. int GetRight() const { return m_nRight; }
  176. int GetBottom() const { return m_nBottom; }
  177. private:
  178. friend class CShadowMgr;
  179. bool m_bScissor;
  180. int m_nLeft;
  181. int m_nTop;
  182. int m_nRight;
  183. int m_nBottom;
  184. IMPLEMENT_OPERATOR_EQUAL( FlashlightState_t ) ;
  185. };
  186. #endif