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.

89 lines
2.3 KiB

  1. //============ Copyright (c) Valve Corporation, All rights reserved. ============
  2. #ifndef SCENEVIEW_H
  3. #define SCENEVIEW_H
  4. #ifdef _WIN32
  5. #pragma once
  6. #endif
  7. #include "mathlib/camera.h"
  8. #include "tier1/utlvector.h"
  9. #include "tier1/utlintrusivelist.h"
  10. #include "rendersystem/irendercontext.h"
  11. // to use the scenesystem, you feed it a bunch of CSceneViews to render. More CSceneViews may be
  12. // generated during rendering as a result of things such as lights, etc.
  13. enum ELayerType
  14. {
  15. LAYERTYPE_DRAW_WORLDOBJECTS, // this layer causes a world-graph traversal producing an object list
  16. LAYERTYPE_PROCEDURAL,
  17. };
  18. enum ELayerFlags
  19. {
  20. LAYERFLAG_NEEDS_FULLSORT = 1,
  21. LAYERFLAGS_CLEAR_RENDERTARGET = 2,
  22. };
  23. class CSceneDrawList;
  24. struct CStandardTextureBindingRecord_t
  25. {
  26. StandardTextureID_t m_nID;
  27. HRenderTexture m_hTexture;
  28. };
  29. class CSceneLayer
  30. {
  31. public:
  32. RenderViewport_t m_viewport;
  33. ELayerType m_eLayerType;
  34. MaterialDrawMode_t m_eShaderMode;
  35. int m_nShadingMode; // mode to use for binding materials when rendering into this layer
  36. uint m_nObjectFlagsRequiredMask;
  37. uint m_nObjectFlagsExcludedMask;
  38. uint m_nLayerFlags; // LAYERFLAG_xxx
  39. Vector4D m_vecClearColor;
  40. int m_nClearFlags;
  41. int m_nLayerIndex;
  42. RenderTargetBinding_t m_hRenderTargetBinding;
  43. LAYERDRAWFN m_pRenderProcedure;
  44. CUtlIntrusiveList<CSceneDrawList> m_pendingDrawList;
  45. CUtlIntrusiveList<CDisplayList> m_renderLists;
  46. CUtlVectorFixed<CStandardTextureBindingRecord_t, STDTEXTURE_NUMBER_OF_IDS> m_standardBindings;
  47. FORCEINLINE void AddStandardTextureBinding( StandardTextureID_t nID, HRenderTexture hTexture );
  48. };
  49. FORCEINLINE void CSceneLayer::AddStandardTextureBinding( StandardTextureID_t nID, HRenderTexture hTexture )
  50. {
  51. int nSlot = m_standardBindings.AddToTail();
  52. m_standardBindings[nSlot].m_nID = nID;
  53. m_standardBindings[nSlot].m_hTexture = hTexture;
  54. }
  55. // constant buffer layout for camera constants. needs to be moved somewhere where shaders can see it.
  56. struct ViewRelatedConstants_t
  57. {
  58. VMatrix m_mViewProjection;
  59. Vector4D m_vEyePt;
  60. Vector4D m_vEyeDir;
  61. Vector4D m_flFarPlane;
  62. };
  63. // reserved constant slots. needs to go somewhere in the new mat/shader system
  64. #define VERTEX_CONSTANT_SLOT_VIEWRELATED_BASE 0
  65. #endif //sceneview_h