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.

84 lines
2.1 KiB

  1. //===== Copyright � 2013-2013, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose: Interface to help with rendering CMDLs & CMergedMDLs to textures.
  4. //
  5. //===========================================================================//
  6. #ifndef IRENDERTORTHELPEROBJECT_H
  7. #define IRENDERTORTHELPEROBJECT_H
  8. #if defined( _WIN32 )
  9. #pragma once
  10. #endif
  11. #include "materialsystem/imaterialsystem.h"
  12. #include "mathlib/camera.h"
  13. //-----------------------------------------------------------------------------
  14. // Forward declarations
  15. //-----------------------------------------------------------------------------
  16. class ITexture;
  17. class IRenderToRTHelperObject
  18. {
  19. public:
  20. virtual void Draw( const matrix3x4_t &rootToWorld ) = 0;
  21. virtual bool GetBoundingSphere( Vector &vecCenter, float &flRadius ) = 0;
  22. virtual ITexture *GetEnvCubeMap() = 0;
  23. };
  24. enum RenderToRTStage_t
  25. {
  26. RENDER_TO_RT_STAGE_CREATED = 0,
  27. RENDER_TO_RT_STAGE_STARTED,
  28. RENDER_TO_RT_STAGE_WAITING_FOR_READ_BACK,
  29. RENDER_TO_RT_STAGE_WAITING_FOR_RESULT,
  30. RENDER_TO_RT_STAGE_DONE,
  31. RENDER_TO_RT_STAGE_UNDEFINED = -1
  32. };
  33. struct RenderToRTData_t
  34. {
  35. RenderToRTData_t()
  36. : m_pObject( NULL )
  37. , m_pResultVTF( NULL )
  38. , m_pszIconNameSuffix( NULL )
  39. , m_stage( RENDER_TO_RT_STAGE_UNDEFINED )
  40. {
  41. }
  42. IRenderToRTHelperObject *m_pObject;
  43. IVTFTexture *m_pResultVTF;
  44. MaterialLightingState_t m_LightingState;
  45. QAngle m_cameraAngles;
  46. Vector m_cameraOffset;
  47. float m_cameraFOV;
  48. Camera_t m_Camera;
  49. matrix3x4_t m_rootToWorld;
  50. RenderToRTStage_t m_stage;
  51. const char *m_pszIconNameSuffix;
  52. bool m_bUsingExplicitModelCameraPosAnglesFromAttachment;
  53. };
  54. class IRenderToRTHelper
  55. {
  56. public:
  57. virtual bool Init() = 0;
  58. virtual void Shutdown() = 0;
  59. virtual RenderToRTData_t *CreateRenderToRTData( IRenderToRTHelperObject *pObject, IVTFTexture *pResultVTF ) = 0;
  60. virtual void StartRenderToRT( RenderToRTData_t *pRendertoRTData ) = 0;
  61. virtual void DestroyRenderToRTData( RenderToRTData_t *pRendertoRTData ) = 0;
  62. virtual bool Process() = 0;
  63. };
  64. #define RENDER_TO_RT_HELPER_INTERFACE_VERSION "RenderToRTHelper001"
  65. extern IRenderToRTHelper *g_pRenderToRTHelper;
  66. #endif // IRENDERTORTHELPEROBJECT_H