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.

83 lines
2.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef ENGINE_ICOLLIDEABLE_H
  8. #define ENGINE_ICOLLIDEABLE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. enum SolidType_t;
  13. class IHandleEntity;
  14. struct Ray_t;
  15. struct model_t;
  16. class Vector;
  17. class QAngle;
  18. class CGameTrace;
  19. typedef CGameTrace trace_t;
  20. class IClientUnknown;
  21. class IPhysicsObject;
  22. abstract_class ICollideable
  23. {
  24. public:
  25. // Gets at the entity handle associated with the collideable
  26. virtual IHandleEntity *GetEntityHandle() = 0;
  27. // These methods return the bounds of an OBB measured in "collision" space
  28. // which can be retreived through the CollisionToWorldTransform or
  29. // GetCollisionOrigin/GetCollisionAngles methods
  30. virtual const Vector& OBBMins( ) const = 0;
  31. virtual const Vector& OBBMaxs( ) const = 0;
  32. // Returns the bounds of a world-space box used when the collideable is being traced
  33. // against as a trigger. It's only valid to call these methods if the solid flags
  34. // have the FSOLID_USE_TRIGGER_BOUNDS flag set.
  35. virtual void WorldSpaceTriggerBounds( Vector *pVecWorldMins, Vector *pVecWorldMaxs ) const = 0;
  36. // custom collision test
  37. virtual bool TestCollision( const Ray_t &ray, unsigned int fContentsMask, trace_t& tr ) = 0;
  38. // Perform hitbox test, returns true *if hitboxes were tested at all*!!
  39. virtual bool TestHitboxes( const Ray_t &ray, unsigned int fContentsMask, trace_t& tr ) = 0;
  40. // Returns the BRUSH model index if this is a brush model. Otherwise, returns -1.
  41. virtual int GetCollisionModelIndex() = 0;
  42. // Return the model, if it's a studio model.
  43. virtual const model_t* GetCollisionModel() = 0;
  44. // Get angles and origin.
  45. virtual const Vector& GetCollisionOrigin() const = 0;
  46. virtual const QAngle& GetCollisionAngles() const = 0;
  47. virtual const matrix3x4_t& CollisionToWorldTransform() const = 0;
  48. // Return a SOLID_ define.
  49. virtual SolidType_t GetSolid() const = 0;
  50. virtual int GetSolidFlags() const = 0;
  51. // Gets at the containing class...
  52. virtual IClientUnknown* GetIClientUnknown() = 0;
  53. // We can filter out collisions based on collision group
  54. virtual int GetCollisionGroup() const = 0;
  55. // Returns a world-aligned box guaranteed to surround *everything* in the collision representation
  56. // Note that this will surround hitboxes, trigger bounds, physics.
  57. // It may or may not be a tight-fitting box and its volume may suddenly change
  58. virtual void WorldSpaceSurroundingBounds( Vector *pVecMins, Vector *pVecMaxs ) = 0;
  59. virtual uint GetRequiredTriggerFlags() const = 0;
  60. // returns NULL unless this collideable has specified FSOLID_ROOT_PARENT_ALIGNED
  61. virtual const matrix3x4_t *GetRootParentToWorldTransform() const = 0;
  62. virtual IPhysicsObject *GetVPhysicsObject() const = 0;
  63. };
  64. #endif // ENGINE_ICOLLIDEABLE_H