diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /sp/src/public/engine/IEngineTrace.h | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'sp/src/public/engine/IEngineTrace.h')
| -rw-r--r-- | sp/src/public/engine/IEngineTrace.h | 384 |
1 files changed, 192 insertions, 192 deletions
diff --git a/sp/src/public/engine/IEngineTrace.h b/sp/src/public/engine/IEngineTrace.h index 0a28fa37..6e497719 100644 --- a/sp/src/public/engine/IEngineTrace.h +++ b/sp/src/public/engine/IEngineTrace.h @@ -1,192 +1,192 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-// $NoKeywords: $
-//
-//=============================================================================//
-
-#ifndef ENGINE_IENGINETRACE_H
-#define ENGINE_IENGINETRACE_H
-#ifdef _WIN32
-#pragma once
-#endif
-
-#include "basehandle.h"
-#include "utlvector.h" //need CUtlVector for IEngineTrace::GetBrushesIn*()
-#include "mathlib/vector4d.h"
-
-class Vector;
-class IHandleEntity;
-struct Ray_t;
-class CGameTrace;
-typedef CGameTrace trace_t;
-class ICollideable;
-class QAngle;
-class CTraceListData;
-class CPhysCollide;
-struct cplane_t;
-
-//-----------------------------------------------------------------------------
-// The standard trace filter... NOTE: Most normal traces inherit from CTraceFilter!!!
-//-----------------------------------------------------------------------------
-enum TraceType_t
-{
- TRACE_EVERYTHING = 0,
- TRACE_WORLD_ONLY, // NOTE: This does *not* test static props!!!
- TRACE_ENTITIES_ONLY, // NOTE: This version will *not* test static props
- TRACE_EVERYTHING_FILTER_PROPS, // NOTE: This version will pass the IHandleEntity for props through the filter, unlike all other filters
-};
-
-abstract_class ITraceFilter
-{
-public:
- virtual bool ShouldHitEntity( IHandleEntity *pEntity, int contentsMask ) = 0;
- virtual TraceType_t GetTraceType() const = 0;
-};
-
-
-//-----------------------------------------------------------------------------
-// Classes are expected to inherit these + implement the ShouldHitEntity method
-//-----------------------------------------------------------------------------
-
-// This is the one most normal traces will inherit from
-class CTraceFilter : public ITraceFilter
-{
-public:
- virtual TraceType_t GetTraceType() const
- {
- return TRACE_EVERYTHING;
- }
-};
-
-class CTraceFilterEntitiesOnly : public ITraceFilter
-{
-public:
- virtual TraceType_t GetTraceType() const
- {
- return TRACE_ENTITIES_ONLY;
- }
-};
-
-
-//-----------------------------------------------------------------------------
-// Classes need not inherit from these
-//-----------------------------------------------------------------------------
-class CTraceFilterWorldOnly : public ITraceFilter
-{
-public:
- bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask )
- {
- return false;
- }
- virtual TraceType_t GetTraceType() const
- {
- return TRACE_WORLD_ONLY;
- }
-};
-
-class CTraceFilterWorldAndPropsOnly : public ITraceFilter
-{
-public:
- bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask )
- {
- return false;
- }
- virtual TraceType_t GetTraceType() const
- {
- return TRACE_EVERYTHING;
- }
-};
-
-class CTraceFilterHitAll : public CTraceFilter
-{
-public:
- virtual bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask )
- {
- return true;
- }
-};
-
-
-//-----------------------------------------------------------------------------
-// Enumeration interface for EnumerateLinkEntities
-//-----------------------------------------------------------------------------
-abstract_class IEntityEnumerator
-{
-public:
- // This gets called with each handle
- virtual bool EnumEntity( IHandleEntity *pHandleEntity ) = 0;
-};
-
-
-//-----------------------------------------------------------------------------
-// Interface the engine exposes to the game DLL
-//-----------------------------------------------------------------------------
-#define INTERFACEVERSION_ENGINETRACE_SERVER "EngineTraceServer003"
-#define INTERFACEVERSION_ENGINETRACE_CLIENT "EngineTraceClient003"
-abstract_class IEngineTrace
-{
-public:
- // Returns the contents mask + entity at a particular world-space position
- virtual int GetPointContents( const Vector &vecAbsPosition, IHandleEntity** ppEntity = NULL ) = 0;
-
- // Get the point contents, but only test the specific entity. This works
- // on static props and brush models.
- //
- // If the entity isn't a static prop or a brush model, it returns CONTENTS_EMPTY and sets
- // bFailed to true if bFailed is non-null.
- virtual int GetPointContents_Collideable( ICollideable *pCollide, const Vector &vecAbsPosition ) = 0;
-
- // Traces a ray against a particular entity
- virtual void ClipRayToEntity( const Ray_t &ray, unsigned int fMask, IHandleEntity *pEnt, trace_t *pTrace ) = 0;
-
- // Traces a ray against a particular entity
- virtual void ClipRayToCollideable( const Ray_t &ray, unsigned int fMask, ICollideable *pCollide, trace_t *pTrace ) = 0;
-
- // A version that simply accepts a ray (can work as a traceline or tracehull)
- virtual void TraceRay( const Ray_t &ray, unsigned int fMask, ITraceFilter *pTraceFilter, trace_t *pTrace ) = 0;
-
- // A version that sets up the leaf and entity lists and allows you to pass those in for collision.
- virtual void SetupLeafAndEntityListRay( const Ray_t &ray, CTraceListData &traceData ) = 0;
- virtual void SetupLeafAndEntityListBox( const Vector &vecBoxMin, const Vector &vecBoxMax, CTraceListData &traceData ) = 0;
- virtual void TraceRayAgainstLeafAndEntityList( const Ray_t &ray, CTraceListData &traceData, unsigned int fMask, ITraceFilter *pTraceFilter, trace_t *pTrace ) = 0;
-
- // A version that sweeps a collideable through the world
- // abs start + abs end represents the collision origins you want to sweep the collideable through
- // vecAngles represents the collision angles of the collideable during the sweep
- virtual void SweepCollideable( ICollideable *pCollide, const Vector &vecAbsStart, const Vector &vecAbsEnd,
- const QAngle &vecAngles, unsigned int fMask, ITraceFilter *pTraceFilter, trace_t *pTrace ) = 0;
-
- // Enumerates over all entities along a ray
- // If triggers == true, it enumerates all triggers along a ray
- virtual void EnumerateEntities( const Ray_t &ray, bool triggers, IEntityEnumerator *pEnumerator ) = 0;
-
- // Same thing, but enumerate entitys within a box
- virtual void EnumerateEntities( const Vector &vecAbsMins, const Vector &vecAbsMaxs, IEntityEnumerator *pEnumerator ) = 0;
-
- // Convert a handle entity to a collideable. Useful inside enumer
- virtual ICollideable *GetCollideable( IHandleEntity *pEntity ) = 0;
-
- // HACKHACK: Temp for performance measurments
- virtual int GetStatByIndex( int index, bool bClear ) = 0;
-
-
- //finds brushes in an AABB, prone to some false positives
- virtual void GetBrushesInAABB( const Vector &vMins, const Vector &vMaxs, CUtlVector<int> *pOutput, int iContentsMask = 0xFFFFFFFF ) = 0;
-
- //Creates a CPhysCollide out of all displacements wholly or partially contained in the specified AABB
- virtual CPhysCollide* GetCollidableFromDisplacementsInAABB( const Vector& vMins, const Vector& vMaxs ) = 0;
-
- //retrieve brush planes and contents, returns true if data is being returned in the output pointers, false if the brush doesn't exist
- virtual bool GetBrushInfo( int iBrush, CUtlVector<Vector4D> *pPlanesOut, int *pContentsOut ) = 0;
-
- virtual bool PointOutsideWorld( const Vector &ptTest ) = 0; //Tests a point to see if it's outside any playable area
-
- // Walks bsp to find the leaf containing the specified point
- virtual int GetLeafContainingPoint( const Vector &ptTest ) = 0;
-};
-
-
-
-#endif // ENGINE_IENGINETRACE_H
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// + +#ifndef ENGINE_IENGINETRACE_H +#define ENGINE_IENGINETRACE_H +#ifdef _WIN32 +#pragma once +#endif + +#include "basehandle.h" +#include "utlvector.h" //need CUtlVector for IEngineTrace::GetBrushesIn*() +#include "mathlib/vector4d.h" + +class Vector; +class IHandleEntity; +struct Ray_t; +class CGameTrace; +typedef CGameTrace trace_t; +class ICollideable; +class QAngle; +class CTraceListData; +class CPhysCollide; +struct cplane_t; + +//----------------------------------------------------------------------------- +// The standard trace filter... NOTE: Most normal traces inherit from CTraceFilter!!! +//----------------------------------------------------------------------------- +enum TraceType_t +{ + TRACE_EVERYTHING = 0, + TRACE_WORLD_ONLY, // NOTE: This does *not* test static props!!! + TRACE_ENTITIES_ONLY, // NOTE: This version will *not* test static props + TRACE_EVERYTHING_FILTER_PROPS, // NOTE: This version will pass the IHandleEntity for props through the filter, unlike all other filters +}; + +abstract_class ITraceFilter +{ +public: + virtual bool ShouldHitEntity( IHandleEntity *pEntity, int contentsMask ) = 0; + virtual TraceType_t GetTraceType() const = 0; +}; + + +//----------------------------------------------------------------------------- +// Classes are expected to inherit these + implement the ShouldHitEntity method +//----------------------------------------------------------------------------- + +// This is the one most normal traces will inherit from +class CTraceFilter : public ITraceFilter +{ +public: + virtual TraceType_t GetTraceType() const + { + return TRACE_EVERYTHING; + } +}; + +class CTraceFilterEntitiesOnly : public ITraceFilter +{ +public: + virtual TraceType_t GetTraceType() const + { + return TRACE_ENTITIES_ONLY; + } +}; + + +//----------------------------------------------------------------------------- +// Classes need not inherit from these +//----------------------------------------------------------------------------- +class CTraceFilterWorldOnly : public ITraceFilter +{ +public: + bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask ) + { + return false; + } + virtual TraceType_t GetTraceType() const + { + return TRACE_WORLD_ONLY; + } +}; + +class CTraceFilterWorldAndPropsOnly : public ITraceFilter +{ +public: + bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask ) + { + return false; + } + virtual TraceType_t GetTraceType() const + { + return TRACE_EVERYTHING; + } +}; + +class CTraceFilterHitAll : public CTraceFilter +{ +public: + virtual bool ShouldHitEntity( IHandleEntity *pServerEntity, int contentsMask ) + { + return true; + } +}; + + +//----------------------------------------------------------------------------- +// Enumeration interface for EnumerateLinkEntities +//----------------------------------------------------------------------------- +abstract_class IEntityEnumerator +{ +public: + // This gets called with each handle + virtual bool EnumEntity( IHandleEntity *pHandleEntity ) = 0; +}; + + +//----------------------------------------------------------------------------- +// Interface the engine exposes to the game DLL +//----------------------------------------------------------------------------- +#define INTERFACEVERSION_ENGINETRACE_SERVER "EngineTraceServer003" +#define INTERFACEVERSION_ENGINETRACE_CLIENT "EngineTraceClient003" +abstract_class IEngineTrace +{ +public: + // Returns the contents mask + entity at a particular world-space position + virtual int GetPointContents( const Vector &vecAbsPosition, IHandleEntity** ppEntity = NULL ) = 0; + + // Get the point contents, but only test the specific entity. This works + // on static props and brush models. + // + // If the entity isn't a static prop or a brush model, it returns CONTENTS_EMPTY and sets + // bFailed to true if bFailed is non-null. + virtual int GetPointContents_Collideable( ICollideable *pCollide, const Vector &vecAbsPosition ) = 0; + + // Traces a ray against a particular entity + virtual void ClipRayToEntity( const Ray_t &ray, unsigned int fMask, IHandleEntity *pEnt, trace_t *pTrace ) = 0; + + // Traces a ray against a particular entity + virtual void ClipRayToCollideable( const Ray_t &ray, unsigned int fMask, ICollideable *pCollide, trace_t *pTrace ) = 0; + + // A version that simply accepts a ray (can work as a traceline or tracehull) + virtual void TraceRay( const Ray_t &ray, unsigned int fMask, ITraceFilter *pTraceFilter, trace_t *pTrace ) = 0; + + // A version that sets up the leaf and entity lists and allows you to pass those in for collision. + virtual void SetupLeafAndEntityListRay( const Ray_t &ray, CTraceListData &traceData ) = 0; + virtual void SetupLeafAndEntityListBox( const Vector &vecBoxMin, const Vector &vecBoxMax, CTraceListData &traceData ) = 0; + virtual void TraceRayAgainstLeafAndEntityList( const Ray_t &ray, CTraceListData &traceData, unsigned int fMask, ITraceFilter *pTraceFilter, trace_t *pTrace ) = 0; + + // A version that sweeps a collideable through the world + // abs start + abs end represents the collision origins you want to sweep the collideable through + // vecAngles represents the collision angles of the collideable during the sweep + virtual void SweepCollideable( ICollideable *pCollide, const Vector &vecAbsStart, const Vector &vecAbsEnd, + const QAngle &vecAngles, unsigned int fMask, ITraceFilter *pTraceFilter, trace_t *pTrace ) = 0; + + // Enumerates over all entities along a ray + // If triggers == true, it enumerates all triggers along a ray + virtual void EnumerateEntities( const Ray_t &ray, bool triggers, IEntityEnumerator *pEnumerator ) = 0; + + // Same thing, but enumerate entitys within a box + virtual void EnumerateEntities( const Vector &vecAbsMins, const Vector &vecAbsMaxs, IEntityEnumerator *pEnumerator ) = 0; + + // Convert a handle entity to a collideable. Useful inside enumer + virtual ICollideable *GetCollideable( IHandleEntity *pEntity ) = 0; + + // HACKHACK: Temp for performance measurments + virtual int GetStatByIndex( int index, bool bClear ) = 0; + + + //finds brushes in an AABB, prone to some false positives + virtual void GetBrushesInAABB( const Vector &vMins, const Vector &vMaxs, CUtlVector<int> *pOutput, int iContentsMask = 0xFFFFFFFF ) = 0; + + //Creates a CPhysCollide out of all displacements wholly or partially contained in the specified AABB + virtual CPhysCollide* GetCollidableFromDisplacementsInAABB( const Vector& vMins, const Vector& vMaxs ) = 0; + + //retrieve brush planes and contents, returns true if data is being returned in the output pointers, false if the brush doesn't exist + virtual bool GetBrushInfo( int iBrush, CUtlVector<Vector4D> *pPlanesOut, int *pContentsOut ) = 0; + + virtual bool PointOutsideWorld( const Vector &ptTest ) = 0; //Tests a point to see if it's outside any playable area + + // Walks bsp to find the leaf containing the specified point + virtual int GetLeafContainingPoint( const Vector &ptTest ) = 0; +}; + + + +#endif // ENGINE_IENGINETRACE_H |