Team Fortress 2 Source Code as on 22/4/2020
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.

127 lines
5.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef C_PORTALGHOSTRENDERABLE_H
  8. #define C_PORTALGHOSTRENDERABLE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. //#include "iclientrenderable.h"
  13. #include "c_baseanimating.h"
  14. class C_PortalGhostRenderable : public C_BaseAnimating//IClientRenderable, public IClientUnknown
  15. {
  16. public:
  17. C_BaseEntity *m_pGhostedRenderable; //the renderable we're transforming and re-rendering
  18. VMatrix m_matGhostTransform;
  19. float *m_pSharedRenderClipPlane; //shared by all portal ghost renderables within the same portal
  20. bool m_bLocalPlayer; //special draw rules for the local player
  21. bool m_bSourceIsBaseAnimating;
  22. C_Prop_Portal *m_pOwningPortal;
  23. struct
  24. {
  25. Vector vRenderOrigin;
  26. QAngle qRenderAngle;
  27. matrix3x4_t matRenderableToWorldTransform;
  28. } m_ReferencedReturns; //when returning a reference, it has to actually exist somewhere
  29. C_PortalGhostRenderable( C_Prop_Portal *pOwningPortal, C_BaseEntity *pGhostSource, RenderGroup_t sourceRenderGroup, const VMatrix &matGhostTransform, float *pSharedRenderClipPlane, bool bLocalPlayer );
  30. virtual ~C_PortalGhostRenderable( void );
  31. void PerFrameUpdate( void ); //called once per frame for misc updating
  32. // Data accessors
  33. virtual Vector const& GetRenderOrigin( void );
  34. virtual QAngle const& GetRenderAngles( void );
  35. virtual bool ShouldDraw( void ) { return true; }
  36. // Call this to get the current bone transforms for the model.
  37. // currentTime parameter will affect interpolation
  38. // nMaxBones specifies how many matrices pBoneToWorldOut can hold. (Should be greater than or
  39. // equal to studiohdr_t::numbones. Use MAXSTUDIOBONES to be safe.)
  40. virtual bool SetupBones( matrix3x4_t *pBoneToWorldOut, int nMaxBones, int boneMask, float currentTime );
  41. // Returns the bounds relative to the origin (render bounds)
  42. virtual void GetRenderBounds( Vector& mins, Vector& maxs );
  43. // returns the bounds as an AABB in worldspace
  44. virtual void GetRenderBoundsWorldspace( Vector& mins, Vector& maxs );
  45. // These normally call through to GetRenderAngles/GetRenderBounds, but some entities custom implement them.
  46. virtual void GetShadowRenderBounds( Vector &mins, Vector &maxs, ShadowType_t shadowType );
  47. // These methods return true if we want a per-renderable shadow cast direction + distance
  48. //virtual bool GetShadowCastDistance( float *pDist, ShadowType_t shadowType ) const;
  49. //virtual bool GetShadowCastDirection( Vector *pDirection, ShadowType_t shadowType ) const;
  50. // Returns the transform from RenderOrigin/RenderAngles to world
  51. virtual const matrix3x4_t &RenderableToWorldTransform();
  52. // Attachments
  53. virtual bool GetAttachment( int number, Vector &origin, QAngle &angles );
  54. virtual bool GetAttachment( int number, matrix3x4_t &matrix );
  55. virtual bool GetAttachment( int number, Vector &origin );
  56. virtual bool GetAttachmentVelocity( int number, Vector &originVel, Quaternion &angleVel );
  57. // Rendering clip plane, should be 4 floats, return value of NULL indicates a disabled render clip plane
  58. virtual float *GetRenderClipPlane( void ) { return m_pSharedRenderClipPlane; };
  59. virtual int DrawModel( int flags );
  60. // Get the model instance of the ghosted model so that decals will properly draw across portals
  61. virtual ModelInstanceHandle_t GetModelInstance();
  62. //------------------------------------------
  63. //IClientRenderable - Trivial or redirection
  64. //------------------------------------------
  65. virtual IClientUnknown* GetIClientUnknown() { return this; };
  66. virtual bool IsTransparent( void );
  67. virtual bool UsesPowerOfTwoFrameBufferTexture();
  68. //virtual ClientShadowHandle_t GetShadowHandle() const { return m_hShadowHandle; };
  69. //virtual ClientRenderHandle_t& RenderHandle() { return m_hRenderHandle; };
  70. //virtual const model_t* GetModel( ) const;
  71. //virtual int GetBody();
  72. //virtual void ComputeFxBlend( ) { return m_pGhostedRenderable->ComputeFxBlend(); };
  73. //virtual int GetFxBlend( void ) { return m_pGhostedRenderable->GetFxBlend(); };
  74. virtual void GetColorModulation( float* color );
  75. //virtual bool LODTest() { return true; };
  76. //virtual void SetupWeights( void ) { NULL; };
  77. //virtual void DoAnimationEvents( void ) { NULL; }; //TODO: find out if there's something we should be doing with this
  78. //virtual IPVSNotify* GetPVSNotifyInterface() { return NULL; };
  79. //virtual bool ShouldReceiveProjectedTextures( int flags ) { return false; };//{ return m_pGhostedRenderable->ShouldReceiveProjectedTextures( flags ); };
  80. //virtual bool IsShadowDirty( ) { return m_bDirtyShadow; };
  81. //virtual void MarkShadowDirty( bool bDirty ) { m_bDirtyShadow = bDirty; };
  82. //virtual IClientRenderable * GetShadowParent() { return NULL; };
  83. //virtual IClientRenderable * FirstShadowChild() { return NULL; };
  84. //virtual IClientRenderable * NextShadowPeer() { return NULL; };
  85. //virtual ShadowType_t ShadowCastType();
  86. //virtual void CreateModelInstance() { NULL; };
  87. //virtual ModelInstanceHandle_t GetModelInstance() { return m_pGhostedRenderable->GetModelInstance(); }; //TODO: find out if sharing an instance causes bugs
  88. virtual int LookupAttachment( const char *pAttachmentName );
  89. //virtual int GetSkin();
  90. //virtual bool IsTwoPass( void );
  91. //virtual void OnThreadedDrawSetup() { NULL; };
  92. //IHandleEntity
  93. //virtual void SetRefEHandle( const CBaseHandle &handle ) { m_RefEHandle = handle; };
  94. //virtual const CBaseHandle& GetRefEHandle() const { return m_RefEHandle; };
  95. //IClientUnknown
  96. virtual ICollideable* GetCollideable() { return NULL; };
  97. virtual IClientNetworkable* GetClientNetworkable() { return NULL; };
  98. virtual IClientRenderable* GetClientRenderable() { return this; };
  99. virtual IClientEntity* GetIClientEntity() { return NULL; };
  100. virtual C_BaseEntity* GetBaseEntity() { return NULL; };
  101. virtual IClientThinkable* GetClientThinkable() { return NULL; };
  102. };
  103. #endif //#ifndef C_PORTALGHOSTRENDERABLE_H