From 177a18b2b6826cd00be444dbfed9e148c0cfe56d Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Mon, 29 Oct 2012 21:53:07 -0400 Subject: [PATCH] Updated collisionproperty.h. --- game/shared/collisionproperty.h | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/game/shared/collisionproperty.h b/game/shared/collisionproperty.h index 21ce3480..499c004f 100644 --- a/game/shared/collisionproperty.h +++ b/game/shared/collisionproperty.h @@ -72,8 +72,10 @@ public: // Methods of ICollideable virtual IHandleEntity *GetEntityHandle(); - virtual const Vector& OBBMins( ) const; - virtual const Vector& OBBMaxs( ) const; + virtual const Vector& OBBMinsPreScaled() const { return m_vecMinsPreScaled.Get(); } + virtual const Vector& OBBMaxsPreScaled() const { return m_vecMaxsPreScaled.Get(); } + virtual const Vector& OBBMins() const { return m_vecMins.Get(); } + virtual const Vector& OBBMaxs() const { return m_vecMaxs.Get(); } virtual void WorldSpaceTriggerBounds( Vector *pVecWorldMins, Vector *pVecWorldMaxs ) const; virtual bool TestCollision( const Ray_t &ray, unsigned int fContentsMask, trace_t& tr ); virtual bool TestHitboxes( const Ray_t &ray, unsigned int fContentsMask, trace_t& tr ); @@ -102,6 +104,9 @@ public: // Sets the collision bounds + the size (OBB) void SetCollisionBounds( const Vector& mins, const Vector &maxs ); + // Rebuilds the scaled bounds from the pre-scaled bounds after a model's scale has changed + void RefreshScaledCollisionBounds( void ); + // Sets special trigger bounds. The bloat amount indicates how much bigger the // trigger bounds should be beyond the bounds set in SetCollisionBounds // This method will also set the FSOLID flag FSOLID_USE_TRIGGER_BOUNDS @@ -164,6 +169,12 @@ public: // Computes a bounding box in world space surrounding the collision bounds void WorldSpaceAABB( Vector *pWorldMins, Vector *pWorldMaxs ) const; + // Get the collision space mins directly + const Vector & CollisionSpaceMins( void ) const; + + // Get the collision space maxs directly + const Vector & CollisionSpaceMaxs( void ) const; + // Computes a "normalized" point (range 0,0,0 - 1,1,1) in collision space // Useful for things like getting a point 75% of the way along z on the OBB, for example const Vector & NormalizedToCollisionSpace( const Vector &in, Vector *pResult ) const; @@ -228,6 +239,8 @@ private: private: CBaseEntity *m_pOuter; + CNetworkVector( m_vecMinsPreScaled ); + CNetworkVector( m_vecMaxsPreScaled ); CNetworkVector( m_vecMins ); CNetworkVector( m_vecMaxs ); float m_flRadius; @@ -245,6 +258,8 @@ private: // SUCKY: We didn't use to have to store this previously // but storing it here means that we can network it + avoid a ton of // client-side mismatch problems + CNetworkVector( m_vecSpecifiedSurroundingMinsPreScaled ); + CNetworkVector( m_vecSpecifiedSurroundingMaxsPreScaled ); CNetworkVector( m_vecSpecifiedSurroundingMins ); CNetworkVector( m_vecSpecifiedSurroundingMaxs ); @@ -441,6 +456,19 @@ inline void CCollisionProperty::WorldSpaceAABB( Vector *pWorldMins, Vector *pWor } +// Get the collision space mins directly +inline const Vector & CCollisionProperty::CollisionSpaceMins( void ) const +{ + return m_vecMins; +} + +// Get the collision space maxs directly +inline const Vector & CCollisionProperty::CollisionSpaceMaxs( void ) const +{ + return m_vecMaxs; +} + + //----------------------------------------------------------------------------- // Does a rotation make us need to recompute the surrounding box? //-----------------------------------------------------------------------------