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.

134 lines
5.3 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //===========================================================================//
  8. #ifndef ICLIENTSHADOWMGR_H
  9. #define ICLIENTSHADOWMGR_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include "igamesystem.h"
  14. #include "icliententityinternal.h"
  15. #include "engine/ishadowmgr.h"
  16. #include "ivrenderview.h"
  17. #include "toolframework/itoolentity.h"
  18. //-----------------------------------------------------------------------------
  19. // Forward decls
  20. //-----------------------------------------------------------------------------
  21. struct FlashlightState_t;
  22. //-----------------------------------------------------------------------------
  23. // Handles to a client shadow
  24. //-----------------------------------------------------------------------------
  25. enum ShadowReceiver_t
  26. {
  27. SHADOW_RECEIVER_BRUSH_MODEL = 0,
  28. SHADOW_RECEIVER_STATIC_PROP,
  29. SHADOW_RECEIVER_STUDIO_MODEL,
  30. };
  31. //-----------------------------------------------------------------------------
  32. // The class responsible for dealing with shadows on the client side
  33. //-----------------------------------------------------------------------------
  34. abstract_class IClientShadowMgr : public IGameSystemPerFrame
  35. {
  36. public:
  37. // Create, destroy shadows
  38. virtual ClientShadowHandle_t CreateShadow( ClientEntityHandle_t entity, int nEntIndex, int flags, CBitVec< MAX_SPLITSCREEN_PLAYERS > *pSplitScreenBits = NULL ) = 0;
  39. virtual void DestroyShadow( ClientShadowHandle_t handle ) = 0;
  40. // Create flashlight.
  41. // FLASHLIGHTFIXME: need to rename all of the shadow stuff to projectedtexture and have flashlights and shadows as instances.
  42. virtual ClientShadowHandle_t CreateFlashlight( const FlashlightState_t &lightState ) = 0;
  43. virtual void UpdateFlashlightState( ClientShadowHandle_t shadowHandle, const FlashlightState_t &lightState ) = 0;
  44. virtual void DestroyFlashlight( ClientShadowHandle_t handle ) = 0;
  45. // Create simple projected texture. it is not a light or a shadow, but this system does most of the work already for it
  46. virtual ClientShadowHandle_t CreateProjection( const FlashlightState_t &lightState ) = 0;
  47. virtual void UpdateProjectionState( ClientShadowHandle_t shadowHandle, const FlashlightState_t &lightState ) = 0;
  48. virtual void DestroyProjection( ClientShadowHandle_t handle ) = 0;
  49. // Indicate that the shadow should be recomputed due to a change in
  50. // the client entity
  51. virtual void UpdateProjectedTexture( ClientShadowHandle_t handle, bool force = false ) = 0;
  52. // Used to cause shadows to be re-projected against the world.
  53. virtual void AddToDirtyShadowList( ClientShadowHandle_t handle, bool force = false ) = 0;
  54. virtual void AddToDirtyShadowList( IClientRenderable *pRenderable, bool force = false ) = 0;
  55. // deals with shadows being added to shadow receivers
  56. virtual void AddShadowToReceiver( ClientShadowHandle_t handle,
  57. IClientRenderable* pRenderable, ShadowReceiver_t type ) = 0;
  58. virtual void RemoveAllShadowsFromReceiver(
  59. IClientRenderable* pRenderable, ShadowReceiver_t type ) = 0;
  60. // Re-renders all shadow textures for shadow casters that lie in the leaf list
  61. virtual void ComputeShadowTextures( const CViewSetup &view, int leafCount, WorldListLeafData_t* pLeafList ) = 0;
  62. // Frees shadow depth textures for use in subsequent view/frame
  63. virtual void UnlockAllShadowDepthTextures() = 0;
  64. // Renders the shadow texture to screen...
  65. virtual void RenderShadowTexture( int w, int h ) = 0;
  66. // Sets the shadow direction + color
  67. virtual void SetShadowDirection( const Vector& dir ) = 0;
  68. virtual const Vector &GetShadowDirection() const = 0;
  69. virtual void SetShadowColor( unsigned char r, unsigned char g, unsigned char b ) = 0;
  70. virtual void SetShadowDistance( float flMaxDistance ) = 0;
  71. virtual void SetShadowBlobbyCutoffArea( float flMinArea ) = 0;
  72. virtual void SetFalloffBias( ClientShadowHandle_t handle, unsigned char ucBias ) = 0;
  73. // Marks the render-to-texture shadow as needing to be re-rendered
  74. virtual void MarkRenderToTextureShadowDirty( ClientShadowHandle_t handle ) = 0;
  75. // Advance the frame
  76. virtual void AdvanceFrame() = 0;
  77. // Set and clear flashlight target renderable
  78. virtual void SetFlashlightTarget( ClientShadowHandle_t shadowHandle, EHANDLE targetEntity ) = 0;
  79. // Set flashlight light world flag
  80. virtual void SetFlashlightLightWorld( ClientShadowHandle_t shadowHandle, bool bLightWorld ) = 0;
  81. virtual void SetShadowsDisabled( bool bDisabled ) = 0;
  82. virtual void ComputeShadowDepthTextures( const CViewSetup &pView, bool bSetup = false ) = 0;
  83. virtual void DrawVolumetrics( const CViewSetup &view ) = 0;
  84. // Toggle shadow casting from world light sources
  85. virtual void SetShadowFromWorldLightsEnabled( bool bEnable ) = 0;
  86. virtual void DrawDeferredShadows( const CViewSetup &view, int leafCount, WorldListLeafData_t* pLeafList ) = 0;
  87. virtual void InitRenderTargets() = 0;
  88. // Reprojects moved shadows against the world
  89. virtual void ReprojectShadows() = 0;
  90. virtual void UpdateSplitscreenLocalPlayerShadowSkip() = 0;
  91. virtual void GetFrustumExtents( ClientShadowHandle_t handle, Vector &vecMin, Vector &vecMax ) = 0;
  92. virtual void ShutdownRenderTargets( void ) =0;
  93. };
  94. //-----------------------------------------------------------------------------
  95. // Singleton
  96. //-----------------------------------------------------------------------------
  97. extern IClientShadowMgr* g_pClientShadowMgr;
  98. #endif // ICLIENTSHADOWMGR_H