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.

100 lines
4.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef IPROPS_H
  8. #define IPROPS_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "interface.h"
  13. #include "mathlib/vector.h"
  14. #include "utlvector.h"
  15. #include "basehandle.h"
  16. struct vcollide_t;
  17. struct Ray_t;
  18. class IClientRenderable;
  19. class CGameTrace;
  20. typedef CGameTrace trace_t;
  21. class IVPhysicsKeyHandler;
  22. class IPhysicsEnvironment;
  23. class ICollideable;
  24. //-----------------------------------------------------------------------------
  25. // Interface versions for static props
  26. //-----------------------------------------------------------------------------
  27. #define INTERFACEVERSION_STATICPROPMGR_CLIENT "StaticPropMgrClient004"
  28. #define INTERFACEVERSION_STATICPROPMGR_SERVER "StaticPropMgrServer002"
  29. //-----------------------------------------------------------------------------
  30. // Interface for static props
  31. //-----------------------------------------------------------------------------
  32. abstract_class IStaticPropMgr
  33. {
  34. public:
  35. // Create physics representations of props
  36. virtual void CreateVPhysicsRepresentations( IPhysicsEnvironment *physenv, IVPhysicsKeyHandler *pDefaults, void *pGameData ) = 0;
  37. // Purpose: Trace a ray against the specified static Prop. Returns point of intersection in trace_t
  38. virtual void TraceRayAgainstStaticProp( const Ray_t& ray, int staticPropIndex, trace_t& tr ) = 0;
  39. // Is a base handle a static prop?
  40. virtual bool IsStaticProp( IHandleEntity *pHandleEntity ) const = 0;
  41. virtual bool IsStaticProp( CBaseHandle handle ) const = 0;
  42. // returns a collideable interface to static props
  43. virtual ICollideable *GetStaticPropByIndex( int propIndex ) = 0;
  44. };
  45. abstract_class IStaticPropMgrClient : public IStaticPropMgr
  46. {
  47. public:
  48. // Recomputes the static prop opacity given a view origin
  49. virtual void ComputePropOpacity( const Vector &viewOrigin, float factor ) = 0;
  50. // Adds decals to static props, returns point of decal in trace_t
  51. virtual void AddDecalToStaticProp( const Vector& rayStart, const Vector& rayEnd,
  52. int staticPropIndex, int decalIndex, bool doTrace, trace_t& tr ) = 0;
  53. // Adds/removes shadows from static props
  54. virtual void AddShadowToStaticProp( unsigned short shadowHandle, IClientRenderable* pRenderable ) = 0;
  55. virtual void RemoveAllShadowsFromStaticProp( IClientRenderable* pRenderable ) = 0;
  56. // Gets the lighting + material color of a static prop
  57. virtual void GetStaticPropMaterialColorAndLighting( trace_t* pTrace,
  58. int staticPropIndex, Vector& lighting, Vector& matColor ) = 0;
  59. //Changes made specifically to support the Portal mod (smack Dave Kircher if something breaks) (Added separately to both client and server to not mess with versioning)
  60. //===================================================================
  61. virtual void GetAllStaticProps( CUtlVector<ICollideable *> *pOutput ) = 0; //testing function that will eventually be removed
  62. virtual void GetAllStaticPropsInAABB( const Vector &vMins, const Vector &vMaxs, CUtlVector<ICollideable *> *pOutput ) = 0; //get all static props that exist wholly or partially in an AABB
  63. virtual void GetAllStaticPropsInOBB( const Vector &ptOrigin, const Vector &vExtent1, const Vector &vExtent2, const Vector &vExtent3, CUtlVector<ICollideable *> *pOutput ) = 0; //get all static props that exist wholly or partially in an OBB
  64. //===================================================================
  65. virtual void DrawStaticProps( IClientRenderable **pProps, int count, bool bShadowDepth, bool drawVCollideWireframe ) = 0;
  66. virtual void AddColorDecalToStaticProp( Vector const& rayStart, Vector const& rayEnd,
  67. int staticPropIndex, int decalIndex, bool doTrace, trace_t& tr, bool bUseColor, Color cColor ) = 0;
  68. };
  69. class IStaticPropMgrServer : public IStaticPropMgr
  70. {
  71. public:
  72. //Changes made specifically to support the Portal mod (smack Dave Kircher if something breaks) (Added separately to both client and server to not mess with versioning)
  73. //===================================================================
  74. virtual void GetAllStaticProps( CUtlVector<ICollideable *> *pOutput ) = 0; //testing function that will eventually be removed
  75. virtual void GetAllStaticPropsInAABB( const Vector &vMins, const Vector &vMaxs, CUtlVector<ICollideable *> *pOutput ) = 0; //get all static props that exist wholly or partially in an AABB
  76. virtual void GetAllStaticPropsInOBB( const Vector &ptOrigin, const Vector &vExtent1, const Vector &vExtent2, const Vector &vExtent3, CUtlVector<ICollideable *> *pOutput ) = 0; //get all static props that exist wholly or partially in an OBB
  77. //===================================================================
  78. };
  79. #endif // IPROPS_H