1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-09-19 20:16:10 +08:00

Update CCollisionProperty.

This commit is contained in:
Nicholas Hastings
2016-08-25 10:55:55 -04:00
parent 737599c056
commit 9559b62bdd

View File

@ -72,8 +72,10 @@ public:
// Methods of ICollideable // Methods of ICollideable
virtual IHandleEntity *GetEntityHandle(); virtual IHandleEntity *GetEntityHandle();
virtual const Vector& OBBMins( ) const; virtual const Vector& OBBMinsPreScaled() const { return m_vecMinsPreScaled.Get(); }
virtual const Vector& OBBMaxs( ) const; 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 void WorldSpaceTriggerBounds( Vector *pVecWorldMins, Vector *pVecWorldMaxs ) const;
virtual bool TestCollision( const Ray_t &ray, unsigned int fContentsMask, trace_t& tr ); 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 ); 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) // Sets the collision bounds + the size (OBB)
void SetCollisionBounds( const Vector& mins, const Vector &maxs ); 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 // Sets special trigger bounds. The bloat amount indicates how much bigger the
// trigger bounds should be beyond the bounds set in SetCollisionBounds // trigger bounds should be beyond the bounds set in SetCollisionBounds
// This method will also set the FSOLID flag FSOLID_USE_TRIGGER_BOUNDS // 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 // Computes a bounding box in world space surrounding the collision bounds
void WorldSpaceAABB( Vector *pWorldMins, Vector *pWorldMaxs ) const; 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 // 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 // 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; const Vector & NormalizedToCollisionSpace( const Vector &in, Vector *pResult ) const;
@ -228,6 +239,8 @@ private:
private: private:
CBaseEntity *m_pOuter; CBaseEntity *m_pOuter;
CNetworkVector( m_vecMinsPreScaled );
CNetworkVector( m_vecMaxsPreScaled );
CNetworkVector( m_vecMins ); CNetworkVector( m_vecMins );
CNetworkVector( m_vecMaxs ); CNetworkVector( m_vecMaxs );
float m_flRadius; float m_flRadius;
@ -245,6 +258,8 @@ private:
// SUCKY: We didn't use to have to store this previously // 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 // but storing it here means that we can network it + avoid a ton of
// client-side mismatch problems // client-side mismatch problems
CNetworkVector( m_vecSpecifiedSurroundingMinsPreScaled );
CNetworkVector( m_vecSpecifiedSurroundingMaxsPreScaled );
CNetworkVector( m_vecSpecifiedSurroundingMins ); CNetworkVector( m_vecSpecifiedSurroundingMins );
CNetworkVector( m_vecSpecifiedSurroundingMaxs ); 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? // Does a rotation make us need to recompute the surrounding box?
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------