initial
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $Revision: $
|
||||
// $NoKeywords: $
|
||||
//
|
||||
// This file contains code to allow us to associate client data with bsp leaves.
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#if !defined( ICLIENTLEAFSYSTEM_H )
|
||||
#define ICLIENTLEAFSYSTEM_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
#include "tier0/platform.h"
|
||||
#include "client_render_handle.h"
|
||||
#include "engine/ivmodelinfo.h"
|
||||
|
||||
|
||||
#define CLIENTLEAFSYSTEM_INTERFACE_VERSION "ClientLeafSystem002"
|
||||
|
||||
|
||||
enum RenderableModelType_t
|
||||
{
|
||||
RENDERABLE_MODEL_UNKNOWN_TYPE = -1,
|
||||
RENDERABLE_MODEL_ENTITY = 0,
|
||||
RENDERABLE_MODEL_STUDIOMDL,
|
||||
RENDERABLE_MODEL_STATIC_PROP,
|
||||
RENDERABLE_MODEL_BRUSH,
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// The client leaf system
|
||||
//-----------------------------------------------------------------------------
|
||||
abstract_class IClientLeafSystemEngine
|
||||
{
|
||||
public:
|
||||
// Adds and removes renderables from the leaf lists
|
||||
// CreateRenderableHandle stores the handle inside pRenderable.
|
||||
virtual void CreateRenderableHandle( IClientRenderable* pRenderable, bool bRenderWithViewModels, RenderableTranslucencyType_t nType, RenderableModelType_t nModelType, uint32 nSplitscreenEnabled = 0xFFFFFFFF ) = 0; // = RENDERABLE_MODEL_UNKNOWN_TYPE ) = 0;
|
||||
virtual void RemoveRenderable( ClientRenderHandle_t handle ) = 0;
|
||||
virtual void AddRenderableToLeaves( ClientRenderHandle_t renderable, int nLeafCount, unsigned short *pLeaves ) = 0;
|
||||
virtual void SetTranslucencyType( ClientRenderHandle_t handle, RenderableTranslucencyType_t nType ) = 0;
|
||||
virtual void RenderInFastReflections( ClientRenderHandle_t handle, bool bRenderInFastReflections ) = 0;
|
||||
virtual void DisableShadowDepthRendering( ClientRenderHandle_t handle, bool bDisable ) = 0;
|
||||
virtual void DisableCSMRendering( ClientRenderHandle_t handle, bool bDisable ) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif // ICLIENTLEAFSYSTEM_H
|
||||
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef ENGINE_ICOLLIDEABLE_H
|
||||
#define ENGINE_ICOLLIDEABLE_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
enum SolidType_t;
|
||||
class IHandleEntity;
|
||||
struct Ray_t;
|
||||
struct model_t;
|
||||
class Vector;
|
||||
class QAngle;
|
||||
class CGameTrace;
|
||||
typedef CGameTrace trace_t;
|
||||
class IClientUnknown;
|
||||
class IPhysicsObject;
|
||||
|
||||
abstract_class ICollideable
|
||||
{
|
||||
public:
|
||||
// Gets at the entity handle associated with the collideable
|
||||
virtual IHandleEntity *GetEntityHandle() = 0;
|
||||
|
||||
// These methods return the bounds of an OBB measured in "collision" space
|
||||
// which can be retreived through the CollisionToWorldTransform or
|
||||
// GetCollisionOrigin/GetCollisionAngles methods
|
||||
virtual const Vector& OBBMins( ) const = 0;
|
||||
virtual const Vector& OBBMaxs( ) const = 0;
|
||||
|
||||
// Returns the bounds of a world-space box used when the collideable is being traced
|
||||
// against as a trigger. It's only valid to call these methods if the solid flags
|
||||
// have the FSOLID_USE_TRIGGER_BOUNDS flag set.
|
||||
virtual void WorldSpaceTriggerBounds( Vector *pVecWorldMins, Vector *pVecWorldMaxs ) const = 0;
|
||||
|
||||
// custom collision test
|
||||
virtual bool TestCollision( const Ray_t &ray, unsigned int fContentsMask, trace_t& tr ) = 0;
|
||||
|
||||
// Perform hitbox test, returns true *if hitboxes were tested at all*!!
|
||||
virtual bool TestHitboxes( const Ray_t &ray, unsigned int fContentsMask, trace_t& tr ) = 0;
|
||||
|
||||
// Returns the BRUSH model index if this is a brush model. Otherwise, returns -1.
|
||||
virtual int GetCollisionModelIndex() = 0;
|
||||
|
||||
// Return the model, if it's a studio model.
|
||||
virtual const model_t* GetCollisionModel() = 0;
|
||||
|
||||
// Get angles and origin.
|
||||
virtual const Vector& GetCollisionOrigin() const = 0;
|
||||
virtual const QAngle& GetCollisionAngles() const = 0;
|
||||
virtual const matrix3x4_t& CollisionToWorldTransform() const = 0;
|
||||
|
||||
// Return a SOLID_ define.
|
||||
virtual SolidType_t GetSolid() const = 0;
|
||||
virtual int GetSolidFlags() const = 0;
|
||||
|
||||
// Gets at the containing class...
|
||||
virtual IClientUnknown* GetIClientUnknown() = 0;
|
||||
|
||||
// We can filter out collisions based on collision group
|
||||
virtual int GetCollisionGroup() const = 0;
|
||||
|
||||
// Returns a world-aligned box guaranteed to surround *everything* in the collision representation
|
||||
// Note that this will surround hitboxes, trigger bounds, physics.
|
||||
// It may or may not be a tight-fitting box and its volume may suddenly change
|
||||
virtual void WorldSpaceSurroundingBounds( Vector *pVecMins, Vector *pVecMaxs ) = 0;
|
||||
|
||||
virtual uint GetRequiredTriggerFlags() const = 0;
|
||||
|
||||
// returns NULL unless this collideable has specified FSOLID_ROOT_PARENT_ALIGNED
|
||||
virtual const matrix3x4_t *GetRootParentToWorldTransform() const = 0;
|
||||
virtual IPhysicsObject *GetVPhysicsObject() const = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif // ENGINE_ICOLLIDEABLE_H
|
||||
@@ -0,0 +1,140 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Client-server neutral sound interface
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef IENGINESOUND_H
|
||||
#define IENGINESOUND_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
#include "basetypes.h"
|
||||
#include "interface.h"
|
||||
#include "soundflags.h"
|
||||
#include "irecipientfilter.h"
|
||||
#include "utlvector.h"
|
||||
#include "engine/SndInfo.h"
|
||||
#include "SoundEmitterSystem/isoundemittersystembase.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// forward declaration
|
||||
//-----------------------------------------------------------------------------
|
||||
class Vector;
|
||||
|
||||
// Handy defines for EmitSound
|
||||
#define SOUND_FROM_LOCAL_PLAYER -1
|
||||
#define SOUND_FROM_WORLD 0
|
||||
|
||||
|
||||
|
||||
// These are used to feed a soundlevel to the sound system and have it use
|
||||
// goldsrc-type attenuation. We should use this as little as possible and
|
||||
// phase it out as soon as possible.
|
||||
|
||||
// Take a regular sndlevel and convert it to compatibility mode.
|
||||
#define SNDLEVEL_TO_COMPATIBILITY_MODE( x ) ((soundlevel_t)(int)( (x) + 256 ))
|
||||
|
||||
// Take a compatibility-mode sndlevel and get the REAL sndlevel out of it.
|
||||
#define SNDLEVEL_FROM_COMPATIBILITY_MODE( x ) ((soundlevel_t)(int)( (x) - 256 ))
|
||||
|
||||
// Tells if the given sndlevel is marked as compatibility mode.
|
||||
#define SNDLEVEL_IS_COMPATIBILITY_MODE( x ) ( (x) >= 256 )
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Client-server neutral effects interface
|
||||
//-----------------------------------------------------------------------------
|
||||
#define IENGINESOUND_CLIENT_INTERFACE_VERSION "IEngineSoundClient003"
|
||||
#define IENGINESOUND_SERVER_INTERFACE_VERSION "IEngineSoundServer003"
|
||||
|
||||
abstract_class IEngineSound
|
||||
{
|
||||
public:
|
||||
// Precache a particular sample
|
||||
virtual bool PrecacheSound( const char *pSample, bool bPreload = false, bool bIsUISound = false ) = 0;
|
||||
virtual bool IsSoundPrecached( const char *pSample ) = 0;
|
||||
virtual void PrefetchSound( const char *pSample ) = 0;
|
||||
virtual bool IsLoopingSound( const char *pSample ) = 0;
|
||||
|
||||
// Just loads the file header and checks for duration (not hooked up for .mp3's yet)
|
||||
// Is accessible to server and client though
|
||||
virtual float GetSoundDuration( const char *pSample ) = 0;
|
||||
|
||||
// Pitch of 100 is no pitch shift. Pitch > 100 up to 255 is a higher pitch, pitch < 100
|
||||
// down to 1 is a lower pitch. 150 to 70 is the realistic range.
|
||||
// EmitSound with pitch != 100 should be used sparingly, as it's not quite as
|
||||
// fast (the pitchshift mixer is not native coded).
|
||||
|
||||
// NOTE: setting iEntIndex to -1 will cause the sound to be emitted from the local
|
||||
// player (client-side only)
|
||||
// Will return the sound guid. If negative, the guid is unknown (call may be successful or not). 0 if the sound was not emitted. Positive if the guid is valid.
|
||||
virtual int EmitSound( IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSoundEntry, HSOUNDSCRIPTHASH nSoundEntryHash, const char *pSample,
|
||||
float flVolume, float flAttenuation, int nSeed, int iFlags = 0, int iPitch = PITCH_NORM,
|
||||
const Vector *pOrigin = NULL, const Vector *pDirection = NULL, CUtlVector< Vector >* pUtlVecOrigins = NULL, bool bUpdatePositions = true, float soundtime = 0.0f, int speakerentity = -1 ) = 0;
|
||||
|
||||
virtual int EmitSound( IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSoundEntry, HSOUNDSCRIPTHASH nSoundEntryHash, const char *pSample,
|
||||
float flVolume, soundlevel_t iSoundlevel, int nSeed, int iFlags = 0, int iPitch = PITCH_NORM,
|
||||
const Vector *pOrigin = NULL, const Vector *pDirection = NULL, CUtlVector< Vector >* pUtlVecOrigins = NULL, bool bUpdatePositions = true, float soundtime = 0.0f, int speakerentity = -1 ) = 0;
|
||||
|
||||
virtual void EmitSentenceByIndex( IRecipientFilter& filter, int iEntIndex, int iChannel, int iSentenceIndex,
|
||||
float flVolume, soundlevel_t iSoundlevel, int nSeed, int iFlags = 0, int iPitch = PITCH_NORM,
|
||||
const Vector *pOrigin = NULL, const Vector *pDirection = NULL, CUtlVector< Vector >* pUtlVecOrigins = NULL, bool bUpdatePositions = true, float soundtime = 0.0f, int speakerentity = -1 ) = 0;
|
||||
|
||||
virtual void StopSound( int iEntIndex, int iChannel, const char *pSample, HSOUNDSCRIPTHASH nSoundEntryHash = SOUNDEMITTER_INVALID_HASH ) = 0;
|
||||
|
||||
// stop all active sounds (client only)
|
||||
virtual void StopAllSounds(bool bClearBuffers) = 0;
|
||||
|
||||
// Set the room type for a player (client only)
|
||||
virtual void SetRoomType( IRecipientFilter& filter, int roomType ) = 0;
|
||||
|
||||
// Set the dsp preset for a player (client only)
|
||||
virtual void SetPlayerDSP( IRecipientFilter& filter, int dspType, bool fastReset ) = 0;
|
||||
|
||||
// emit an "ambient" sound that isn't spatialized
|
||||
// only available on the client, assert on server
|
||||
virtual int EmitAmbientSound( const char *pSample, float flVolume, int iPitch = PITCH_NORM, int flags = 0, float soundtime = 0.0f ) = 0;
|
||||
|
||||
|
||||
// virtual EntChannel_t CreateEntChannel() = 0;
|
||||
|
||||
virtual float GetDistGainFromSoundLevel( soundlevel_t soundlevel, float dist ) = 0;
|
||||
|
||||
// Client .dll only functions
|
||||
virtual int GetGuidForLastSoundEmitted() = 0;
|
||||
virtual bool IsSoundStillPlaying( int guid ) = 0;
|
||||
virtual void StopSoundByGuid( int guid, bool bForceSync = false ) = 0;
|
||||
// Set's master volume (0.0->1.0)
|
||||
virtual void SetVolumeByGuid( int guid, float fvol ) = 0;
|
||||
|
||||
// Retrieves list of all active sounds
|
||||
virtual void GetActiveSounds( CUtlVector< SndInfo_t >& sndlist ) = 0;
|
||||
|
||||
virtual void PrecacheSentenceGroup( const char *pGroupName ) = 0;
|
||||
virtual void NotifyBeginMoviePlayback() = 0;
|
||||
virtual void NotifyEndMoviePlayback() = 0;
|
||||
virtual bool IsMoviePlaying() = 0;
|
||||
|
||||
virtual bool GetSoundChannelVolume( const char* sound, float &flVolumeLeft, float &flVolumeRight ) = 0;
|
||||
|
||||
virtual float GetElapsedTimeByGuid( int guid ) = 0;
|
||||
|
||||
// engine capable of playing sounds?
|
||||
virtual bool GetPreventSound( void ) = 0;
|
||||
|
||||
virtual void SetReplaySoundFade( float flReplayVolume ) = 0;
|
||||
virtual float GetReplaySoundFade()const = 0;
|
||||
#if defined( _GAMECONSOLE )
|
||||
virtual void UnloadSound( const char *pSample ) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#endif // IENGINESOUND_H
|
||||
@@ -0,0 +1,304 @@
|
||||
//========= Copyright © 1996-2005, 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"
|
||||
#include "bspflags.h"
|
||||
|
||||
class Vector;
|
||||
class IHandleEntity;
|
||||
struct Ray_t;
|
||||
class CGameTrace;
|
||||
typedef CGameTrace trace_t;
|
||||
class ICollideable;
|
||||
class QAngle;
|
||||
class ITraceListData;
|
||||
class CPhysCollide;
|
||||
struct cplane_t;
|
||||
struct virtualmeshlist_t;
|
||||
struct AABB_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;
|
||||
};
|
||||
|
||||
struct OcclusionTestResults_t
|
||||
{
|
||||
VectorAligned vEndMin, vEndMax; // the bounding box enclosing the end of the occlusion test, to be used to extend the bounding box of an object shadow
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
enum DebugTraceCounterBehavior_t
|
||||
{
|
||||
kTRACE_COUNTER_SET = 0,
|
||||
kTRACE_COUNTER_INC,
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Enumeration interface for EnumerateLinkEntities
|
||||
//-----------------------------------------------------------------------------
|
||||
abstract_class IEntityEnumerator
|
||||
{
|
||||
public:
|
||||
// This gets called with each handle
|
||||
virtual bool EnumEntity( IHandleEntity *pHandleEntity ) = 0;
|
||||
};
|
||||
|
||||
|
||||
struct BrushSideInfo_t
|
||||
{
|
||||
cplane_t plane; // The plane of the brush side
|
||||
unsigned short bevel; // Bevel plane?
|
||||
unsigned short thin; // Thin?
|
||||
};
|
||||
|
||||
//something we can easily create on the stack while easily maintaining our data release contract with IEngineTrace
|
||||
class CBrushQuery
|
||||
{
|
||||
public:
|
||||
CBrushQuery( void )
|
||||
{
|
||||
m_iCount = 0;
|
||||
m_pBrushes = NULL;
|
||||
m_iMaxBrushSides = 0;
|
||||
m_pReleaseFunc = NULL;
|
||||
m_pData = NULL;
|
||||
}
|
||||
~CBrushQuery( void )
|
||||
{
|
||||
ReleasePrivateData();
|
||||
}
|
||||
void ReleasePrivateData( void )
|
||||
{
|
||||
if( m_pReleaseFunc )
|
||||
{
|
||||
m_pReleaseFunc( this );
|
||||
}
|
||||
|
||||
m_iCount = 0;
|
||||
m_pBrushes = NULL;
|
||||
m_iMaxBrushSides = 0;
|
||||
m_pReleaseFunc = NULL;
|
||||
m_pData = NULL;
|
||||
}
|
||||
|
||||
inline int Count( void ) const { return m_iCount; }
|
||||
inline uint32 *Base( void ) { return m_pBrushes; }
|
||||
inline uint32 operator[]( int iIndex ) const { return m_pBrushes[iIndex]; }
|
||||
inline uint32 GetBrushNumber( int iIndex ) const { return m_pBrushes[iIndex]; }
|
||||
|
||||
//maximum number of sides of any 1 brush in the query results
|
||||
inline int MaxBrushSides( void ) const { return m_iMaxBrushSides; }
|
||||
|
||||
protected:
|
||||
int m_iCount;
|
||||
uint32 *m_pBrushes;
|
||||
int m_iMaxBrushSides;
|
||||
void (*m_pReleaseFunc)(CBrushQuery *); //release function is almost always in a different dll than calling code
|
||||
void *m_pData;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Interface the engine exposes to the game DLL
|
||||
//-----------------------------------------------------------------------------
|
||||
#define INTERFACEVERSION_ENGINETRACE_SERVER "EngineTraceServer004"
|
||||
#define INTERFACEVERSION_ENGINETRACE_CLIENT "EngineTraceClient004"
|
||||
abstract_class IEngineTrace
|
||||
{
|
||||
public:
|
||||
// Returns the contents mask + entity at a particular world-space position
|
||||
virtual int GetPointContents( const Vector &vecAbsPosition, int contentsMask = MASK_ALL, IHandleEntity** ppEntity = NULL ) = 0;
|
||||
|
||||
// Returns the contents mask of the world only @ the world-space position (static props are ignored)
|
||||
virtual int GetPointContents_WorldOnly( const Vector &vecAbsPosition, int contentsMask = MASK_ALL ) = 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, ITraceListData *pTraceData ) = 0;
|
||||
virtual void SetupLeafAndEntityListBox( const Vector &vecBoxMin, const Vector &vecBoxMax, ITraceListData *pTraceData ) = 0;
|
||||
virtual void TraceRayAgainstLeafAndEntityList( const Ray_t &ray, ITraceListData *pTraceData, 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, CBrushQuery &BrushQuery, int iContentsMask = 0xFFFFFFFF, int cmodelIndex = 0 ) = 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;
|
||||
|
||||
// gets the number of displacements in the world
|
||||
virtual int GetNumDisplacements( ) = 0;
|
||||
|
||||
// gets a specific diplacement mesh
|
||||
virtual void GetDisplacementMesh( int nIndex, virtualmeshlist_t *pMeshTriList ) = 0;
|
||||
|
||||
//retrieve brush planes and contents, returns zero if the brush doesn't exist,
|
||||
//returns positive number of sides filled out if the array can hold them all, negative number of slots needed to hold info if the array is too small
|
||||
virtual int GetBrushInfo( int iBrush, int &ContentsOut, BrushSideInfo_t *pBrushSideInfoOut, int iBrushSideInfoArraySize ) = 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;
|
||||
|
||||
virtual ITraceListData *AllocTraceListData() = 0;
|
||||
virtual void FreeTraceListData(ITraceListData *) = 0;
|
||||
|
||||
/// Used only in debugging: get/set/clear/increment the trace debug counter. See comment below for details.
|
||||
virtual int GetSetDebugTraceCounter( int value, DebugTraceCounterBehavior_t behavior ) = 0;
|
||||
|
||||
//Similar to GetCollidableFromDisplacementsInAABB(). But returns the intermediate mesh data instead of a collideable
|
||||
virtual int GetMeshesFromDisplacementsInAABB( const Vector& vMins, const Vector& vMaxs, virtualmeshlist_t *pOutputMeshes, int iMaxOutputMeshes ) = 0;
|
||||
|
||||
virtual void GetBrushesInCollideable( ICollideable *pCollideable, CBrushQuery &BrushQuery ) = 0;
|
||||
|
||||
virtual bool IsFullyOccluded( int nOcclusionKey, const AABB_t &aabb1, const AABB_t &aabb2, const Vector &vShadow ) = 0;
|
||||
|
||||
virtual void SuspendOcclusionTests() = 0;
|
||||
virtual void ResumeOcclusionTests() = 0;
|
||||
class CAutoSuspendOcclusionTests
|
||||
{
|
||||
IEngineTrace *m_pEngineTrace;
|
||||
public:
|
||||
CAutoSuspendOcclusionTests( IEngineTrace *pEngineTrace ) : m_pEngineTrace( pEngineTrace ) { pEngineTrace->SuspendOcclusionTests(); }
|
||||
~CAutoSuspendOcclusionTests() { m_pEngineTrace->ResumeOcclusionTests(); }
|
||||
};
|
||||
|
||||
virtual void FlushOcclusionQueries() = 0;
|
||||
};
|
||||
|
||||
/// IEngineTrace::GetSetDebugTraceCounter
|
||||
/// SET to a negative number to disable. SET to a positive number to reset the counter; it'll tick down by
|
||||
/// one for each trace, and break into the debugger on hitting zero. INC lets you add or subtract from the
|
||||
/// counter. In each case it will return the value of the counter BEFORE you set or incremented it. INC 0
|
||||
/// to query. This end-around approach is necessary for security: because only the engine knows when we
|
||||
/// are in a trace, and only the server knows when we are in a think, data must somehow be shared between
|
||||
/// them. Simply returning a pointer to an address inside the engine in a retail build is unacceptable,
|
||||
/// and in the PC there is no way to distinguish between retail and non-retail builds at compile time
|
||||
/// (there is no #define for it).
|
||||
/// This may seem redundant with the VPROF_INCREMENT_COUNTER( "TraceRay" ), but it's not, because while
|
||||
/// that's readable across DLLs, there's no way to trap on its exceeding a certain value, nor can we reset
|
||||
/// it for each think.
|
||||
|
||||
#endif // ENGINE_IENGINETRACE_H
|
||||
@@ -0,0 +1,103 @@
|
||||
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef ISTATICPROPMGR_H
|
||||
#define ISTATICPROPMGR_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "interface.h"
|
||||
#include "mathlib/vector.h"
|
||||
#include "utlvector.h"
|
||||
#include "basehandle.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Forward declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
struct vcollide_t;
|
||||
struct Ray_t;
|
||||
class IClientRenderable;
|
||||
class CGameTrace;
|
||||
typedef CGameTrace trace_t;
|
||||
class IVPhysicsKeyHandler;
|
||||
class IPhysicsEnvironment;
|
||||
class ICollideable;
|
||||
struct RenderableInstance_t;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Interface versions for static props
|
||||
//-----------------------------------------------------------------------------
|
||||
#define INTERFACEVERSION_STATICPROPMGR_CLIENT "StaticPropMgrClient005"
|
||||
#define INTERFACEVERSION_STATICPROPMGR_SERVER "StaticPropMgrServer002"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Interface for static props
|
||||
//-----------------------------------------------------------------------------
|
||||
abstract_class IStaticPropMgr
|
||||
{
|
||||
public:
|
||||
// Create physics representations of props
|
||||
virtual void CreateVPhysicsRepresentations( IPhysicsEnvironment *physenv, IVPhysicsKeyHandler *pDefaults, void *pGameData ) = 0;
|
||||
|
||||
// Purpose: Trace a ray against the specified static Prop. Returns point of intersection in trace_t
|
||||
virtual void TraceRayAgainstStaticProp( const Ray_t& ray, int staticPropIndex, trace_t& tr ) = 0;
|
||||
|
||||
// Is a base handle a static prop?
|
||||
virtual bool IsStaticProp( IHandleEntity *pHandleEntity ) const = 0;
|
||||
virtual bool IsStaticProp( CBaseHandle handle ) const = 0;
|
||||
|
||||
// returns a collideable interface to static props
|
||||
virtual ICollideable *GetStaticPropByIndex( int propIndex ) = 0;
|
||||
};
|
||||
|
||||
abstract_class IStaticPropMgrClient : public IStaticPropMgr
|
||||
{
|
||||
public:
|
||||
// Adds decals to static props, returns point of decal in trace_t
|
||||
virtual void AddDecalToStaticProp( const Vector& rayStart, const Vector& rayEnd,
|
||||
int staticPropIndex, int decalIndex, bool doTrace, trace_t& tr, void *pvProxyUserData = NULL, const Vector* saxis = NULL, int nAdditionalDecalFlags = 0 ) = 0;
|
||||
|
||||
// Adds/removes shadows from static props
|
||||
virtual void AddShadowToStaticProp( unsigned short shadowHandle, IClientRenderable* pRenderable ) = 0;
|
||||
virtual void RemoveAllShadowsFromStaticProp( IClientRenderable* pRenderable ) = 0;
|
||||
|
||||
// Gets the lighting + material color of a static prop
|
||||
virtual void GetStaticPropMaterialColorAndLighting( trace_t* pTrace,
|
||||
int staticPropIndex, Vector& lighting, Vector& matColor ) = 0;
|
||||
|
||||
//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)
|
||||
//===================================================================
|
||||
virtual void GetAllStaticProps( CUtlVector<ICollideable *> *pOutput ) = 0; //testing function that will eventually be removed
|
||||
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
|
||||
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
|
||||
//===================================================================
|
||||
|
||||
virtual void DrawStaticProps( IClientRenderable **pProps, const RenderableInstance_t *pInstances, int count, bool bShadowDepth, bool drawVCollideWireframe ) = 0;
|
||||
|
||||
// Returns the lighting origins of a number of static props
|
||||
virtual void GetLightingOrigins( Vector *pLightingOrigins, int nOriginStride, int nCount, IClientRenderable **ppRenderable, int nRenderableStride ) = 0;
|
||||
};
|
||||
|
||||
class IStaticPropMgrServer : public IStaticPropMgr
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
//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)
|
||||
//===================================================================
|
||||
virtual void GetAllStaticProps( CUtlVector<ICollideable *> *pOutput ) = 0; //testing function that will eventually be removed
|
||||
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
|
||||
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
|
||||
//===================================================================
|
||||
};
|
||||
|
||||
|
||||
#endif // IPROPS_H
|
||||
@@ -0,0 +1,66 @@
|
||||
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#ifndef SNDINFO_H
|
||||
#define SNDINFO_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
class Vector;
|
||||
#include "utlsymbol.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Client side only
|
||||
//-----------------------------------------------------------------------------
|
||||
struct SndInfo_t
|
||||
{
|
||||
// Sound Guid
|
||||
int m_nGuid;
|
||||
FileNameHandle_t m_filenameHandle; // filesystem filename handle - call IFilesystem to conver this to a string
|
||||
int m_nSoundSource;
|
||||
int m_nChannel;
|
||||
// If a sound is being played through a speaker entity (e.g., on a monitor,), this is the
|
||||
// entity upon which to show the lips moving, if the sound has sentence data
|
||||
int m_nSpeakerEntity;
|
||||
float m_flVolume;
|
||||
float m_flLastSpatializedVolume;
|
||||
// Radius of this sound effect (spatialization is different within the radius)
|
||||
float m_flRadius;
|
||||
int m_nPitch;
|
||||
Vector *m_pOrigin;
|
||||
Vector *m_pDirection;
|
||||
|
||||
// if true, assume sound source can move and update according to entity
|
||||
bool m_bUpdatePositions;
|
||||
// true if playing linked sentence
|
||||
bool m_bIsSentence;
|
||||
// if true, bypass all dsp processing for this sound (ie: music)
|
||||
bool m_bDryMix;
|
||||
// true if sound is playing through in-game speaker entity.
|
||||
bool m_bSpeaker;
|
||||
// for snd_show, networked sounds get colored differently than local sounds
|
||||
bool m_bFromServer;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Hearing info
|
||||
//-----------------------------------------------------------------------------
|
||||
struct AudioState_t
|
||||
{
|
||||
AudioState_t()
|
||||
{
|
||||
m_Origin.Init();
|
||||
m_Angles.Init();
|
||||
m_bIsUnderwater = false;
|
||||
}
|
||||
|
||||
Vector m_Origin;
|
||||
QAngle m_Angles;
|
||||
bool m_bIsUnderwater;
|
||||
};
|
||||
|
||||
#endif // SNDINFO_H
|
||||
@@ -0,0 +1,12 @@
|
||||
//=========== Copyright © Valve Corporation, All rights reserved. ===========//
|
||||
//
|
||||
// Purpose: Decal flags that can be set publicly by other modules for the decal system.
|
||||
//
|
||||
//===========================================================================//
|
||||
#pragma once
|
||||
|
||||
// NOTE: If you add a flag here, make sure to add one to the private set of flags as well,
|
||||
// and update R_ConvertToPrivateDecalFlags
|
||||
|
||||
#define EDF_PLAYERSPRAY 0x00000001
|
||||
#define EDF_IMMEDIATECLEANUP 0x00000002
|
||||
@@ -0,0 +1,43 @@
|
||||
//========= Copyright (c) 1996-2009, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef HTTP_H
|
||||
#define HTTP_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Status of the download thread, as set in RequestContext::status.
|
||||
*/
|
||||
enum HTTPStatus_t
|
||||
{
|
||||
HTTP_CONNECTING = 0,///< This is set in the main thread before the download thread starts.
|
||||
HTTP_FETCH, ///< The download thread sets this when it starts reading data.
|
||||
HTTP_DONE, ///< The download thread sets this if it has read all the data successfully.
|
||||
HTTP_ABORTED, ///< The download thread sets this if it aborts because it's RequestContext::shouldStop has been set.
|
||||
HTTP_ERROR ///< The download thread sets this if there is an error connecting or downloading. Partial data may be present, so the main thread can check.
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Error encountered in the download thread, as set in RequestContext::error.
|
||||
*/
|
||||
enum HTTPError_t
|
||||
{
|
||||
HTTP_ERROR_NONE = 0,
|
||||
HTTP_ERROR_ZERO_LENGTH_FILE,
|
||||
HTTP_ERROR_CONNECTION_CLOSED,
|
||||
HTTP_ERROR_INVALID_URL, ///< InternetCrackUrl failed
|
||||
HTTP_ERROR_INVALID_PROTOCOL, ///< URL didn't start with http:// or https://
|
||||
HTTP_ERROR_CANT_BIND_SOCKET,
|
||||
HTTP_ERROR_CANT_CONNECT,
|
||||
HTTP_ERROR_NO_HEADERS, ///< Cannot read HTTP headers
|
||||
HTTP_ERROR_FILE_NONEXISTENT,
|
||||
HTTP_ERROR_MAX
|
||||
};
|
||||
|
||||
#endif // HTTP_H
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef IBLACKBOX_H
|
||||
#define IBLACKBOX_H
|
||||
|
||||
#define BLACKBOX_INTERFACE_VERSION "BlackBoxVersion001"
|
||||
|
||||
class IBlackBox
|
||||
{
|
||||
public:
|
||||
virtual void Record(int type, const char *fmt) = 0;
|
||||
virtual void SetLimit(int type, unsigned int count) = 0;
|
||||
virtual const char *Get(int type, unsigned int index) = 0;
|
||||
virtual int Count(int type) = 0;
|
||||
virtual void Flush(int type) = 0;
|
||||
|
||||
virtual const char *GetTypeName(int type) = 0;
|
||||
virtual int GetTypeCount() = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,47 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Engine voice interface
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef IENGINEVOICE_H
|
||||
#define IENGINEVOICE_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
#include "basetypes.h"
|
||||
|
||||
#define IENGINEVOICE_INTERFACE_VERSION "IEngineVoice001"
|
||||
|
||||
enum EngineVoiceFlags_t
|
||||
{
|
||||
ENGINE_VOICE_FLAG_PS3 = ( 1 << 0 )
|
||||
};
|
||||
|
||||
abstract_class IEngineVoice
|
||||
{
|
||||
public:
|
||||
virtual bool IsHeadsetPresent( int iController ) = 0;
|
||||
virtual bool IsLocalPlayerTalking( int iController ) = 0;
|
||||
|
||||
virtual void AddPlayerToVoiceList( XUID xPlayer, int iController, uint64 uiFlags ) = 0;
|
||||
virtual void RemovePlayerFromVoiceList( XUID xPlayer, int iController ) = 0;
|
||||
|
||||
virtual void GetRemoteTalkers( int *pNumTalkers, XUID *pRemoteTalkers ) = 0;
|
||||
|
||||
virtual bool VoiceUpdateData( int iController ) = 0;
|
||||
virtual void GetVoiceData( int iController, const byte **ppvVoiceDataBuffer, unsigned int *pnumVoiceDataBytes ) = 0;
|
||||
virtual void VoiceResetLocalData( int iController ) = 0;
|
||||
|
||||
virtual void SetPlaybackPriority( XUID remoteTalker, int iController, int iAllowPlayback ) = 0;
|
||||
virtual void PlayIncomingVoiceData( XUID xuid, const byte *pbData, unsigned int dwDataSize, const bool *bAudiblePlayers = NULL ) = 0;
|
||||
|
||||
virtual void RemoveAllTalkers() = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif // IENGINEVOICE_H
|
||||
@@ -0,0 +1,129 @@
|
||||
//===== Copyright c 1996-2009, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef INETSUPPORT_H
|
||||
#define INETSUPPORT_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "tier1/interface.h"
|
||||
#include "keyvalues.h"
|
||||
#include "bitbuf.h"
|
||||
#include "inetchannel.h"
|
||||
#include "inetmsghandler.h"
|
||||
#include "matchmaking/imatchasync.h"
|
||||
|
||||
class ISteamNetworkingUtils;
|
||||
|
||||
abstract_class INetSupport : public IAppSystem
|
||||
{
|
||||
public:
|
||||
enum NetworkConsts_t
|
||||
{
|
||||
NC_MAX_ROUTABLE_PAYLOAD = 1200,
|
||||
};
|
||||
|
||||
enum NetworkSocket_t
|
||||
{
|
||||
NS_SOCK_CLIENT = 0, // client socket
|
||||
NS_SOCK_SERVER, // server socket
|
||||
#ifdef _X360
|
||||
NS_SOCK_SYSTEMLINK, // X360 system link
|
||||
NS_SOCK_LOBBY, // X360 matchmaking lobby
|
||||
NS_SOCK_TEAMLINK, // X360 matchmaking inter-team link
|
||||
#endif
|
||||
};
|
||||
|
||||
enum SteamP2PChannelId_t
|
||||
{
|
||||
// see top of net_steamsocketmgr.cpp for why we need seperate channels for client & server
|
||||
SP2PC_RECV_CLIENT = 0,
|
||||
SP2PC_RECV_SERVER,
|
||||
SP2PC_LOBBY
|
||||
};
|
||||
|
||||
struct ServerInfo_t
|
||||
{
|
||||
netadr_t m_netAdr;
|
||||
netadr_t m_netAdrOnline;
|
||||
uint16 m_nPort;
|
||||
|
||||
bool m_bActive; // sv.IsActive
|
||||
bool m_bDedicated; // sv.IsDedicated
|
||||
bool m_bLobbyExclusive; // Exclusive to lobby connections
|
||||
bool m_bGroupExclusive; // Exclusive to Steam Group
|
||||
bool m_bInMainMenuBkgnd; // Server is in a background map
|
||||
|
||||
char const *m_szServerName;
|
||||
char const *m_szMapName;
|
||||
char const *m_szMapGroupName;
|
||||
|
||||
int m_numMaxHumanPlayers;
|
||||
int m_numHumanPlayers;
|
||||
};
|
||||
|
||||
struct ClientInfo_t
|
||||
{
|
||||
int m_nSignonState; // client signon state
|
||||
int m_nSocket; // client socket
|
||||
INetChannel *m_pNetChannel;
|
||||
|
||||
int m_numHumanPlayers; // Number of human players on the server
|
||||
};
|
||||
|
||||
public:
|
||||
// Get engine build number
|
||||
virtual int GetEngineBuildNumber() = 0;
|
||||
|
||||
// Get server info
|
||||
virtual void GetServerInfo( ServerInfo_t *pServerInfo ) = 0;
|
||||
|
||||
// Get client info
|
||||
virtual void GetClientInfo( ClientInfo_t *pClientInfo ) = 0;
|
||||
|
||||
// Update a local server reservation
|
||||
virtual void UpdateServerReservation( uint64 uiReservation ) = 0;
|
||||
|
||||
// Update a client reservation before connecting to a server
|
||||
virtual void UpdateClientReservation( uint64 uiReservation, uint64 uiMachineIdHost ) = 0;
|
||||
|
||||
// Submit a server reservation packet
|
||||
virtual void ReserveServer(
|
||||
const ns_address &netAdrPublic, const ns_address &netAdrPrivate,
|
||||
uint64 nServerReservationCookie, KeyValues *pKVGameSettings,
|
||||
IMatchAsyncOperationCallback *pCallback, IMatchAsyncOperation **ppAsyncOperation ) = 0;
|
||||
|
||||
// Check server reservation cookie matches cookie held by client
|
||||
virtual bool CheckServerReservation(
|
||||
const ns_address &netAdrPublic, uint64 nServerReservationCookie, uint32 uiReservationStage,
|
||||
IMatchAsyncOperationCallback *pCallback, IMatchAsyncOperation **ppAsyncOperation ) = 0;
|
||||
|
||||
virtual bool ServerPing( const ns_address &netAdrPublic,
|
||||
IMatchAsyncOperationCallback *pCallback, IMatchAsyncOperation **ppAsyncOperation ) = 0;
|
||||
|
||||
// When client event is fired
|
||||
virtual void OnMatchEvent( KeyValues *pEvent ) = 0;
|
||||
|
||||
// Process incoming net packets on the socket
|
||||
virtual void ProcessSocket( int sock, IConnectionlessPacketHandler * pHandler ) = 0;
|
||||
|
||||
// Send a network packet
|
||||
virtual int SendPacket (
|
||||
INetChannel *chan, int sock, const netadr_t &to,
|
||||
const void *data, int length,
|
||||
bf_write *pVoicePayload = NULL,
|
||||
bool bUseCompression = false ) = 0;
|
||||
|
||||
virtual ISteamNetworkingUtils *GetSteamNetworkingUtils() = 0;
|
||||
};
|
||||
|
||||
#define INETSUPPORT_VERSION_STRING "INETSUPPORT_003"
|
||||
|
||||
|
||||
#endif // INETSUPPORT_H
|
||||
@@ -0,0 +1,105 @@
|
||||
//===== Copyright 1996-2005, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// Purpose: Access to the cuter features of the PS3
|
||||
// devkit, like the front LEDs.
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef PS3_FRONTPANELLED_H
|
||||
#define PS3_FRONTPANELLED_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
/// encapsulates the DECR-1000's front panel LEDs, dip switches, and foot pedal
|
||||
/// the system only lets you set a subset of the LEDs; there are FOUR LIGHTS.
|
||||
/// (really. you can set LEDs 0..3)
|
||||
namespace CPS3FrontPanelLED
|
||||
{
|
||||
// sets the on/off state of the LEDs on the front panel.
|
||||
// you simply specify them as a bitmask -- ie, LED0 | LED 2 would light the zeroth and twoth LED and darken the other two.
|
||||
inline bool SetLEDs( uint64 lights );
|
||||
|
||||
// you can use this to eg set LED1 while leaving the rest undisturbed. a 1 bit in the mask means the corresponding
|
||||
// bit in value will be written to the hardware.
|
||||
inline bool SetLEDsMasked( uint64 mask, uint64 lights );
|
||||
|
||||
// gets the on/off state of the LEDs on the front panel
|
||||
inline uint64 GetLEDs();
|
||||
|
||||
// gets the on/off state of the switches on the front panel
|
||||
inline uint64 GetSwitches();
|
||||
|
||||
// you will notice there is no function to set the state of the DIP switches from software.
|
||||
|
||||
// you don't actually need to use these, but just to be obvious:
|
||||
enum eLEDIndex_t
|
||||
{
|
||||
kPS3LED0 = 1,
|
||||
kPS3LED1 = 2,
|
||||
kPS3LED2 = 4,
|
||||
kPS3LED3 = 8
|
||||
};
|
||||
|
||||
enum eSwitchIndex_t
|
||||
{
|
||||
kPS3SWITCH0 = 1,
|
||||
kPS3SWITCH1 = 2,
|
||||
kPS3SWITCH2 = 4,
|
||||
kPS3SWITCH3 = 8
|
||||
};
|
||||
};
|
||||
|
||||
#if !defined(_PS3)
|
||||
inline bool CPS3FrontPanelLED::SetLEDs( uint64 lights ) {return false;}
|
||||
inline bool CPS3FrontPanelLED::SetLEDsMasked( uint64 mask, uint64 lights ) {return false;}
|
||||
inline uint64 CPS3FrontPanelLED::GetLEDs() {return 0;}
|
||||
inline uint64 CPS3FrontPanelLED::GetSwitches() {return 0;}
|
||||
#else
|
||||
|
||||
#include <sys/gpio.h>
|
||||
|
||||
inline bool CPS3FrontPanelLED::SetLEDs( uint64 lights )
|
||||
{
|
||||
return sys_gpio_set( SYS_GPIO_LED_DEVICE_ID, SYS_GPIO_LED_USER_AVAILABLE_BITS, lights ) == CELL_OK;
|
||||
}
|
||||
|
||||
inline bool CPS3FrontPanelLED::SetLEDsMasked( uint64 mask, uint64 lights )
|
||||
{
|
||||
return sys_gpio_set( SYS_GPIO_LED_DEVICE_ID, SYS_GPIO_LED_USER_AVAILABLE_BITS & mask, SYS_GPIO_LED_USER_AVAILABLE_BITS & lights ) == CELL_OK;
|
||||
}
|
||||
|
||||
inline uint64 CPS3FrontPanelLED::GetLEDs()
|
||||
{
|
||||
uint64 val;
|
||||
if ( sys_gpio_get( SYS_GPIO_LED_DEVICE_ID, &val ) == CELL_OK )
|
||||
{
|
||||
return val & SYS_GPIO_LED_USER_AVAILABLE_BITS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
inline uint64 CPS3FrontPanelLED::GetSwitches()
|
||||
{
|
||||
uint64 val;
|
||||
if ( sys_gpio_get( SYS_GPIO_DIP_SWITCH_DEVICE_ID, &val ) == CELL_OK )
|
||||
{
|
||||
return val & SYS_GPIO_DIP_SWITCH_USER_AVAILABLE_BITS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif // PS3_FRONTPANELLED_H
|
||||
@@ -0,0 +1,92 @@
|
||||
//========= Copyright (c) 1996-2009, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYHISTORYMANAGER_H
|
||||
#define IREPLAYHISTORYMANAGER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
#include "timeutils.h"
|
||||
#include "qlimits.h"
|
||||
#include "convar.h"
|
||||
#include "tier1/utllinkedlist.h"
|
||||
#include <time.h>
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define REPLAYHISTORYMANAGER_INTERFACE_VERSION "VENGINE_REPLAY_HISTORY_MANAGER_001"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class CBaseReplayHistoryEntryData
|
||||
{
|
||||
public:
|
||||
virtual ~CBaseReplayHistoryEntryData() {}
|
||||
|
||||
char m_szFilename[ MAX_OSPATH ];
|
||||
char m_szMapName[ MAX_OSPATH ];
|
||||
int m_nRecordTime; // Gets cast to a time_t
|
||||
int m_nLifeSpan; // How many seconds from the record time until deletion
|
||||
DmeTime_t m_DemoLength; // Length of the demo
|
||||
int m_nBytesTransferred;
|
||||
int m_nSize; // Size in bytes
|
||||
int m_nTransferId; // CNetChan transfer id
|
||||
bool m_bTransferComplete;
|
||||
bool m_bTransferring; // File currently transferring?
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class CClientReplayHistoryEntryData : public CBaseReplayHistoryEntryData
|
||||
{
|
||||
public:
|
||||
void BeginDownload();
|
||||
|
||||
char m_szServerAddress[ MAX_OSPATH ]; // In the form <IP address>:<port number>
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class CServerReplayHistoryEntryData : public CBaseReplayHistoryEntryData
|
||||
{
|
||||
public:
|
||||
uint64 m_uClientSteamId;
|
||||
|
||||
enum EFileStatus
|
||||
{
|
||||
FILESTATUS_NOTONDISK,
|
||||
FILESTATUS_EXISTS,
|
||||
FILESTATUS_EXPIRED
|
||||
};
|
||||
int m_nFileStatus;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IReplayHistoryManager : IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual void Init() = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
|
||||
virtual bool IsInitialized() const = 0;
|
||||
|
||||
virtual void Update() = 0;
|
||||
|
||||
virtual void FlushEntriesToDisk() = 0;
|
||||
virtual void StopDownloads() = 0;
|
||||
|
||||
virtual int GetNumEntries() const = 0;
|
||||
virtual const CBaseReplayHistoryEntryData *GetEntryAtIndex( int iIndex ) const = 0;
|
||||
virtual CBaseReplayHistoryEntryData *FindEntry( const char *pFilename ) = 0;
|
||||
virtual bool RecordEntry( CBaseReplayHistoryEntryData *pNewEntry ) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYHISTORYMANAGER_H
|
||||
@@ -0,0 +1,199 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef ISERVERPLUGIN_H
|
||||
#define ISERVERPLUGIN_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "edict.h"
|
||||
#include "tier1/interface.h"
|
||||
#include "tier1/keyvalues.h"
|
||||
|
||||
class CCommand;
|
||||
|
||||
//
|
||||
// you will also want to listen for game events via IGameEventManager::AddListener()
|
||||
//
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PLUGIN_CONTINUE = 0, // keep going
|
||||
PLUGIN_OVERRIDE, // run the game dll function but use our return value instead
|
||||
PLUGIN_STOP, // don't run the game dll function at all
|
||||
} PLUGIN_RESULT;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
eQueryCvarValueStatus_ValueIntact=0, // It got the value fine.
|
||||
eQueryCvarValueStatus_CvarNotFound=1,
|
||||
eQueryCvarValueStatus_NotACvar=2, // There's a ConCommand, but it's not a ConVar.
|
||||
eQueryCvarValueStatus_CvarProtected=3 // The cvar was marked with FCVAR_SERVER_CAN_NOT_QUERY, so the server is not allowed to have its value.
|
||||
} EQueryCvarValueStatus;
|
||||
|
||||
|
||||
typedef int QueryCvarCookie_t;
|
||||
#define InvalidQueryCvarCookie -1
|
||||
|
||||
|
||||
#define INTERFACEVERSION_ISERVERPLUGINCALLBACKS_VERSION_1 "ISERVERPLUGINCALLBACKS001"
|
||||
#define INTERFACEVERSION_ISERVERPLUGINCALLBACKS_VERSION_2 "ISERVERPLUGINCALLBACKS002"
|
||||
#define INTERFACEVERSION_ISERVERPLUGINCALLBACKS_VERSION_3 "ISERVERPLUGINCALLBACKS003"
|
||||
#define INTERFACEVERSION_ISERVERPLUGINCALLBACKS "ISERVERPLUGINCALLBACKS004"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: callbacks the engine exposes to the 3rd party plugins (ala MetaMod)
|
||||
//-----------------------------------------------------------------------------
|
||||
abstract_class IServerPluginCallbacks
|
||||
{
|
||||
public:
|
||||
// Initialize the plugin to run
|
||||
// Return false if there is an error during startup.
|
||||
virtual bool Load( CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory ) = 0;
|
||||
|
||||
// Called when the plugin should be shutdown
|
||||
virtual void Unload( void ) = 0;
|
||||
|
||||
// called when a plugins execution is stopped but the plugin is not unloaded
|
||||
virtual void Pause( void ) = 0;
|
||||
|
||||
// called when a plugin should start executing again (sometime after a Pause() call)
|
||||
virtual void UnPause( void ) = 0;
|
||||
|
||||
// Returns string describing current plugin. e.g., Admin-Mod.
|
||||
virtual const char *GetPluginDescription( void ) = 0;
|
||||
|
||||
// Called any time a new level is started (after GameInit() also on level transitions within a game)
|
||||
virtual void LevelInit( char const *pMapName ) = 0;
|
||||
|
||||
// The server is about to activate
|
||||
virtual void ServerActivate( edict_t *pEdictList, int edictCount, int clientMax ) = 0;
|
||||
|
||||
// The server should run physics/think on all edicts
|
||||
virtual void GameFrame( bool simulating ) = 0;
|
||||
|
||||
// Called when a level is shutdown (including changing levels)
|
||||
virtual void LevelShutdown( void ) = 0;
|
||||
|
||||
// Client is going active
|
||||
virtual void ClientActive( edict_t *pEntity ) = 0;
|
||||
|
||||
// Client is fully connected ( has received initial baseline of entities )
|
||||
virtual void ClientFullyConnect( edict_t *pEntity ) = 0;
|
||||
|
||||
// Client is disconnecting from server
|
||||
virtual void ClientDisconnect( edict_t *pEntity ) = 0;
|
||||
|
||||
// Client is connected and should be put in the game
|
||||
virtual void ClientPutInServer( edict_t *pEntity, char const *playername ) = 0;
|
||||
|
||||
// Sets the client index for the client who typed the command into their console
|
||||
virtual void SetCommandClient( int index ) = 0;
|
||||
|
||||
// A player changed one/several replicated cvars (name etc)
|
||||
virtual void ClientSettingsChanged( edict_t *pEdict ) = 0;
|
||||
|
||||
// Client is connecting to server ( set retVal to false to reject the connection )
|
||||
// You can specify a rejection message by writing it into reject
|
||||
virtual PLUGIN_RESULT ClientConnect( bool *bAllowConnect, edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen ) = 0;
|
||||
|
||||
// The client has typed a command at the console
|
||||
virtual PLUGIN_RESULT ClientCommand( edict_t *pEntity, const CCommand &args ) = 0;
|
||||
|
||||
// A user has had their network id setup and validated
|
||||
virtual PLUGIN_RESULT NetworkIDValidated( const char *pszUserName, const char *pszNetworkID ) = 0;
|
||||
|
||||
// This is called when a query from IServerPluginHelpers::StartQueryCvarValue is finished.
|
||||
// iCookie is the value returned by IServerPluginHelpers::StartQueryCvarValue.
|
||||
// Added with version 2 of the interface.
|
||||
virtual void OnQueryCvarValueFinished( QueryCvarCookie_t iCookie, edict_t *pPlayerEntity, EQueryCvarValueStatus eStatus, const char *pCvarName, const char *pCvarValue ) = 0;
|
||||
|
||||
// added with version 3 of the interface.
|
||||
virtual void OnEdictAllocated( edict_t *edict ) = 0;
|
||||
virtual void OnEdictFreed( const edict_t *edict ) = 0;
|
||||
|
||||
//
|
||||
// Allow plugins to validate and configure network encryption keys (added in Version 4 of the interface)
|
||||
// Game server must run with -externalnetworkcryptkey flag, and 3rd party client software must set the
|
||||
// matching encryption key in the client game process.
|
||||
//
|
||||
|
||||
// BNetworkCryptKeyCheckRequired allows the server to allow connections from clients or relays that don't have
|
||||
// an encryption key. The function must return true if the client encryption key is required, and false if the client
|
||||
// is allowed to connect without an encryption key. It is recommended that if client wants to use encryption key
|
||||
// this function should return true to require it on the server side as well.
|
||||
// Any plugin in the chain that returns true will flag connection to require encryption key for the engine and check
|
||||
// with other plugins will not be continued.
|
||||
// If no plugin returns true to require encryption key then the default implementation will require encryption key
|
||||
// if the client wants to use it.
|
||||
virtual bool BNetworkCryptKeyCheckRequired( uint32 unFromIP, uint16 usFromPort, uint32 unAccountIdProvidedByClient,
|
||||
bool bClientWantsToUseCryptKey ) = 0;
|
||||
|
||||
// BNetworkCryptKeyValidate allows the server to validate client's over the wire encrypted payload cookie and return
|
||||
// false if the client cookie is malformed to prevent connection to the server. If this function returns true then
|
||||
// the plugin allows the client to connect with the encryption key, and upon return the engine expects the plugin
|
||||
// to have copied 16-bytes of client encryption key into the buffer pointed at by pbPlainTextKeyForNetChan. That key
|
||||
// must match the plaintext key supplied by 3rd party client software to the client game process, not the client cookie
|
||||
// transmitted unencrypted over the wire as part of the connection packet.
|
||||
// Any plugin in the chain that returns true will stop evaluation of other plugins and the 16-bytes encryption key
|
||||
// copied into pbPlainTextKeyForNetchan will be used. If a plugin returns false then evaluation of other plugins will
|
||||
// continue and buffer data in pbPlainTextKeyForNetchan will be preserved from previous calls.
|
||||
// If no plugin returns true and the encryption key is required then the client connection will be rejected with
|
||||
// an invalid certificate error.
|
||||
virtual bool BNetworkCryptKeyValidate( uint32 unFromIP, uint16 usFromPort, uint32 unAccountIdProvidedByClient,
|
||||
int nEncryptionKeyIndexFromClient, int numEncryptedBytesFromClient, byte *pbEncryptedBufferFromClient,
|
||||
byte *pbPlainTextKeyForNetchan ) = 0;
|
||||
};
|
||||
|
||||
#define INTERFACEVERSION_ISERVERPLUGINHELPERS "ISERVERPLUGINHELPERS001"
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DIALOG_MSG = 0, // just an on screen message
|
||||
DIALOG_MENU, // an options menu
|
||||
DIALOG_TEXT, // a richtext dialog
|
||||
DIALOG_ENTRY, // an entry box
|
||||
DIALOG_ASKCONNECT // Ask the client to connect to a specified IP address. Only the "time" and "title" keys are used.
|
||||
} DIALOG_TYPE;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: functions that only 3rd party plugins need
|
||||
//-----------------------------------------------------------------------------
|
||||
abstract_class IServerPluginHelpers
|
||||
{
|
||||
public:
|
||||
// creates an onscreen menu with various option buttons
|
||||
// The keyvalues param can contain these fields:
|
||||
// "title" - (string) the title to show in the hud and in the title bar
|
||||
// "msg" - (string) a longer message shown in the GameUI
|
||||
// "color" - (color) the color to display the message in the hud (white by default)
|
||||
// "level" - (int) the priority of this message (closer to 0 is higher), only 1 message can be outstanding at a time
|
||||
// "time" - (int) the time in seconds this message should stay active in the GameUI (min 10 sec, max 200 sec)
|
||||
//
|
||||
// For DIALOG_MENU add sub keys for each option with these fields:
|
||||
// "command" - (string) client command to run if selected
|
||||
// "msg" - (string) button text for this option
|
||||
//
|
||||
virtual void CreateMessage( edict_t *pEntity, DIALOG_TYPE type, KeyValues *data, IServerPluginCallbacks *plugin ) = 0;
|
||||
virtual void ClientCommand( edict_t *pEntity, const char *cmd ) = 0;
|
||||
|
||||
// Call this to find out the value of a cvar on the client.
|
||||
//
|
||||
// It is an asynchronous query, and it will call IServerPluginCallbacks::OnQueryCvarValueFinished when
|
||||
// the value comes in from the client.
|
||||
//
|
||||
// Store the return value if you want to match this specific query to the OnQueryCvarValueFinished call.
|
||||
// Returns InvalidQueryCvarCookie if the entity is invalid.
|
||||
virtual QueryCvarCookie_t StartQueryCvarValue( edict_t *pEntity, const char *pName ) = 0;
|
||||
};
|
||||
|
||||
#endif //ISERVERPLUGIN_H
|
||||
@@ -0,0 +1,234 @@
|
||||
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =====//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef ISHADOWMGR_H
|
||||
#define ISHADOWMGR_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "tier1/interface.h"
|
||||
#include "mathlib/vmatrix.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class IMaterial;
|
||||
class Vector;
|
||||
class Vector2D;
|
||||
struct model_t;
|
||||
typedef unsigned short ModelInstanceHandle_t;
|
||||
class IClientRenderable;
|
||||
class ITexture;
|
||||
struct FlashlightInstance_t;
|
||||
struct FlashlightState_t;
|
||||
|
||||
// change this when the new version is incompatable with the old
|
||||
#define ENGINE_SHADOWMGR_INTERFACE_VERSION "VEngineShadowMgr002"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Flags for the creation method
|
||||
//-----------------------------------------------------------------------------
|
||||
enum ShadowFlags_t
|
||||
{
|
||||
SHADOW_FLAGS_FLASHLIGHT = (1 << 0),
|
||||
SHADOW_FLAGS_SHADOW = (1 << 1),
|
||||
SHADOW_FLAGS_SIMPLE_PROJECTION = (1 << 2),
|
||||
|
||||
// Update this if you add flags
|
||||
SHADOW_FLAGS_LAST_FLAG = SHADOW_FLAGS_SIMPLE_PROJECTION
|
||||
};
|
||||
|
||||
#define SHADOW_FLAGS_PROJECTED_TEXTURE_TYPE_MASK ( SHADOW_FLAGS_FLASHLIGHT | SHADOW_FLAGS_SHADOW | SHADOW_FLAGS_SIMPLE_PROJECTION )
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Shadow-related functionality exported by the engine
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// This is a handle to shadows, clients can create as many as they want
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef unsigned short ShadowHandle_t;
|
||||
|
||||
enum
|
||||
{
|
||||
SHADOW_HANDLE_INVALID = (ShadowHandle_t)~0
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Used for the creation Flags field of CreateShadow
|
||||
//-----------------------------------------------------------------------------
|
||||
enum ShadowCreateFlags_t
|
||||
{
|
||||
SHADOW_CACHE_VERTS = ( 1 << 0 ),
|
||||
SHADOW_FLASHLIGHT = ( 1 << 1 ),
|
||||
SHADOW_SIMPLE_PROJECTION = ( 1 << 2 ),
|
||||
SHADOW_ANY_SPLITSCREEN_SLOT = ( 1 << 3 ),
|
||||
|
||||
SHADOW_LAST_FLAG = SHADOW_SIMPLE_PROJECTION,
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Information about a particular shadow
|
||||
//-----------------------------------------------------------------------------
|
||||
struct ShadowInfo_t
|
||||
{
|
||||
// Transforms from world space into texture space of the shadow
|
||||
VMatrix m_WorldToShadow;
|
||||
|
||||
// The shadow should no longer be drawn once it's further than MaxDist
|
||||
// along z in shadow texture coordinates.
|
||||
float m_FalloffOffset;
|
||||
float m_MaxDist;
|
||||
float m_FalloffAmount; // how much to lighten the shadow maximally
|
||||
Vector2D m_TexOrigin;
|
||||
Vector2D m_TexSize;
|
||||
unsigned char m_FalloffBias;
|
||||
};
|
||||
|
||||
typedef void (*ShadowDrawCallbackFn_t)( void * );
|
||||
|
||||
typedef void (*ShadowDrawCallbackFn_t)( void * );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// The engine's interface to the shadow manager
|
||||
//-----------------------------------------------------------------------------
|
||||
abstract_class IShadowMgr
|
||||
{
|
||||
public:
|
||||
// Create, destroy shadows (see ShadowCreateFlags_t for creationFlags)
|
||||
virtual ShadowHandle_t CreateShadow( IMaterial* pMaterial, IMaterial* pModelMaterial, void* pBindProxy, int creationFlags ) = 0;
|
||||
virtual void DestroyShadow( ShadowHandle_t handle ) = 0;
|
||||
|
||||
// Resets the shadow material (useful for shadow LOD.. doing blobby at distance)
|
||||
virtual void SetShadowMaterial( ShadowHandle_t handle, IMaterial* pMaterial, IMaterial* pModelMaterial, void* pBindProxy ) = 0;
|
||||
|
||||
// Shadow opacity
|
||||
// virtual void SetShadowOpacity( ShadowHandle_t handle, float alpha ) = 0;
|
||||
// virtual float GetShadowOpacity( ShadowHandle_t handle ) const = 0;
|
||||
|
||||
// Project a shadow into the world
|
||||
// The two points specify the upper left coordinate and the lower-right
|
||||
// coordinate of the shadow specified in a shadow "viewplane". The
|
||||
// projection matrix is a shadow viewplane->world transformation,
|
||||
// and can be orthographic orperspective.
|
||||
|
||||
// I expect that the client DLL will call this method any time the shadow
|
||||
// changes because the light changes, or because the entity casting the
|
||||
// shadow moves
|
||||
|
||||
// Note that we can't really control the shadows from the engine because
|
||||
// the engine only knows about pevs, which don't exist on the client
|
||||
|
||||
// The shadow matrix specifies a world-space transform for the shadow
|
||||
// the shadow is projected down the z direction, and the origin of the
|
||||
// shadow matrix is the origin of the projection ray. The size indicates
|
||||
// the shadow size measured in the space of the shadow matrix; the
|
||||
// shadow goes from +/- size.x/2 along the x axis of the shadow matrix
|
||||
// and +/- size.y/2 along the y axis of the shadow matrix.
|
||||
virtual void ProjectShadow( ShadowHandle_t handle, const Vector &origin,
|
||||
const Vector& projectionDir, const VMatrix& worldToShadow, const Vector2D& size,
|
||||
int nLeafCount, const int *pLeafList,
|
||||
float maxHeight, float falloffOffset, float falloffAmount, const Vector &vecCasterOrigin ) = 0;
|
||||
|
||||
virtual void ProjectFlashlight( ShadowHandle_t handle, const VMatrix &worldToShadow, int nLeafCount, const int *pLeafList ) = 0;
|
||||
|
||||
// Gets at information about a particular shadow
|
||||
virtual const ShadowInfo_t &GetInfo( ShadowHandle_t handle ) = 0;
|
||||
|
||||
virtual const Frustum_t &GetFlashlightFrustum( ShadowHandle_t handle ) = 0;
|
||||
|
||||
// Methods related to shadows on brush models
|
||||
virtual void AddShadowToBrushModel( ShadowHandle_t handle,
|
||||
model_t* pModel, const Vector& origin, const QAngle& angles ) = 0;
|
||||
|
||||
// Removes all shadows from a brush model
|
||||
virtual void RemoveAllShadowsFromBrushModel( model_t* pModel ) = 0;
|
||||
|
||||
// Sets the texture coordinate range for a shadow...
|
||||
virtual void SetShadowTexCoord( ShadowHandle_t handle, float x, float y, float w, float h ) = 0;
|
||||
|
||||
// Methods related to shadows on studio models
|
||||
virtual void AddShadowToModel( ShadowHandle_t shadow, ModelInstanceHandle_t instance ) = 0;
|
||||
virtual void RemoveAllShadowsFromModel( ModelInstanceHandle_t instance ) = 0;
|
||||
|
||||
// Set extra clip planes related to shadows...
|
||||
// These are used to prevent pokethru and back-casting
|
||||
virtual void ClearExtraClipPlanes( ShadowHandle_t shadow ) = 0;
|
||||
virtual void AddExtraClipPlane( ShadowHandle_t shadow, const Vector& normal, float dist ) = 0;
|
||||
|
||||
// Allows us to disable particular shadows
|
||||
virtual void EnableShadow( ShadowHandle_t shadow, bool bEnable ) = 0;
|
||||
|
||||
// Set the darkness falloff bias
|
||||
virtual void SetFalloffBias( ShadowHandle_t shadow, unsigned char ucBias ) = 0;
|
||||
|
||||
// Update the state for a flashlight.
|
||||
virtual void UpdateFlashlightState( ShadowHandle_t shadowHandle, const FlashlightState_t &lightState ) = 0;
|
||||
|
||||
virtual void DrawFlashlightDepthTexture( ) = 0;
|
||||
|
||||
virtual ShadowHandle_t CreateShadowEx( IMaterial* pMaterial, IMaterial* pModelMaterial, void* pBindProxy, int creationFlags, int nEntIndex ) = 0;
|
||||
|
||||
virtual void SetFlashlightDepthTexture( ShadowHandle_t shadowHandle, ITexture *pFlashlightDepthTexture, unsigned char ucShadowStencilBit ) = 0;
|
||||
|
||||
virtual const FlashlightState_t &GetFlashlightState( ShadowHandle_t handle ) = 0;
|
||||
|
||||
virtual void SetFlashlightRenderState( ShadowHandle_t handle ) = 0;
|
||||
|
||||
virtual void DrawVolumetrics() = 0;
|
||||
|
||||
virtual int GetNumShadowsOnModel( ModelInstanceHandle_t instance ) = 0;
|
||||
virtual int GetShadowsOnModel( ModelInstanceHandle_t instance, ShadowHandle_t* pShadowArray, bool bNormalShadows, bool bFlashlightShadows ) = 0;
|
||||
|
||||
virtual void FlashlightDrawCallback( ShadowDrawCallbackFn_t pCallback, void *pData ) = 0; //used to draw each additive flashlight pass. The callback is called once per flashlight state for an additive pass.
|
||||
|
||||
//Way for the client to determine which flashlight to use in single-pass modes. Does not actually enable the flashlight in any way.
|
||||
virtual void SetSinglePassFlashlightRenderState( ShadowHandle_t handle ) = 0;
|
||||
|
||||
//Enable/Disable the flashlight state set with SetSinglePassFlashlightRenderState.
|
||||
virtual void PushSinglePassFlashlightStateEnabled( bool bEnable ) = 0;
|
||||
virtual void PopSinglePassFlashlightStateEnabled( void ) = 0;
|
||||
|
||||
virtual bool SinglePassFlashlightModeEnabled( void ) = 0;
|
||||
|
||||
// Determine a unique list of flashlights which hit at least one of the specified models
|
||||
// Accepts an instance count and an array of ModelInstanceHandle_ts.
|
||||
// Returns the number of FlashlightInstance_ts it's found that affect the models.
|
||||
// Also fills in a mask of which flashlights affect each ModelInstanceHandle_t
|
||||
// There can be at most MAX_FLASHLIGHTS_PER_INSTANCE_DRAW_CALL pFlashlights,
|
||||
// and the size of the pModelUsageMask array must be nInstanceCount.
|
||||
virtual int SetupFlashlightRenderInstanceInfo( ShadowHandle_t *pUniqueFlashlights, uint32 *pModelUsageMask, int nUsageStride, int nInstanceCount, const ModelInstanceHandle_t *pInstance ) = 0;
|
||||
|
||||
// Returns the flashlight state for multiple flashlights
|
||||
virtual void GetFlashlightRenderInfo( FlashlightInstance_t *pFlashlightState, int nCount, const ShadowHandle_t *pHandles ) = 0;
|
||||
|
||||
virtual void RemoveAllDecalsFromShadow( ShadowHandle_t handle ) = 0;
|
||||
|
||||
virtual void SkipShadowForEntity( int nEntIndex ) = 0;
|
||||
|
||||
//designed for portal usage. Recursive drawing leaves the scissor rect in a bad state for translucents
|
||||
virtual void PushFlashlightScissorBounds( void ) = 0;
|
||||
virtual void PopFlashlightScissorBounds( void ) = 0;
|
||||
|
||||
// Disables projected shadows
|
||||
virtual void DisableDropShadows() = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,72 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//
|
||||
//=============================================================================//
|
||||
//
|
||||
// cdll_int.h
|
||||
//
|
||||
// 4-23-98
|
||||
// JOHN: client dll interface declarations
|
||||
//
|
||||
|
||||
#ifndef IVDEBUGOVERLAY_H
|
||||
#define IVDEBUGOVERLAY_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
class Vector;
|
||||
|
||||
#define VDEBUG_OVERLAY_INTERFACE_VERSION "VDebugOverlay004"
|
||||
|
||||
// When used as a duration by a server-side NDebugOverlay:: call,
|
||||
// causes the overlay to persist until the next server update.
|
||||
#define NDEBUG_PERSIST_TILL_NEXT_SERVER (0.01023f)
|
||||
|
||||
class OverlayText_t;
|
||||
|
||||
abstract_class IVDebugOverlay
|
||||
{
|
||||
public:
|
||||
virtual void AddEntityTextOverlay(int ent_index, int line_offset, float duration, int r, int g, int b, int a, PRINTF_FORMAT_STRING const char *format, ...) = 0;
|
||||
virtual void AddBoxOverlay(const Vector& origin, const Vector& mins, const Vector& max, QAngle const& orientation, int r, int g, int b, int a, float duration) = 0;
|
||||
virtual void AddSphereOverlay(const Vector& vOrigin, float flRadius, int nTheta, int nPhi, int r, int g, int b, int a, float flDuration) = 0;
|
||||
virtual void AddTriangleOverlay(const Vector& p1, const Vector& p2, const Vector& p3, int r, int g, int b, int a, bool noDepthTest, float duration) = 0;
|
||||
virtual void AddLineOverlay(const Vector& origin, const Vector& dest, int r, int g, int b,bool noDepthTest, float duration) = 0;
|
||||
virtual void AddTextOverlay(const Vector& origin, float duration, PRINTF_FORMAT_STRING const char *format, ...) FMTFUNCTION( 4, 5 ) = 0;
|
||||
virtual void AddTextOverlay(const Vector& origin, int line_offset, float duration, PRINTF_FORMAT_STRING const char *format, ...) FMTFUNCTION( 5, 6 ) = 0;
|
||||
virtual void AddScreenTextOverlay(float flXPos, float flYPos,float flDuration, int r, int g, int b, int a, const char *text) = 0;
|
||||
virtual void AddSweptBoxOverlay(const Vector& start, const Vector& end, const Vector& mins, const Vector& max, const QAngle & angles, int r, int g, int b, int a, float flDuration) = 0;
|
||||
virtual void AddGridOverlay(const Vector& origin) = 0;
|
||||
virtual void AddCoordFrameOverlay(const matrix3x4_t& frame, float flScale, int vColorTable[3][3] = NULL) = 0;
|
||||
|
||||
virtual int ScreenPosition(const Vector& point, Vector& screen) = 0;
|
||||
virtual int ScreenPosition(float flXPos, float flYPos, Vector& screen) = 0;
|
||||
|
||||
virtual OverlayText_t *GetFirst( void ) = 0;
|
||||
virtual OverlayText_t *GetNext( OverlayText_t *current ) = 0;
|
||||
virtual void ClearDeadOverlays( void ) = 0;
|
||||
virtual void ClearAllOverlays() = 0;
|
||||
|
||||
virtual void AddTextOverlayRGB(const Vector& origin, int line_offset, float duration, float r, float g, float b, float alpha, PRINTF_FORMAT_STRING const char *format, ...) FMTFUNCTION( 9, 10 ) = 0;
|
||||
virtual void AddTextOverlayRGB(const Vector& origin, int line_offset, float duration, int r, int g, int b, int a, PRINTF_FORMAT_STRING const char *format, ...) FMTFUNCTION( 9, 10 ) = 0;
|
||||
|
||||
virtual void AddLineOverlayAlpha(const Vector& origin, const Vector& dest, int r, int g, int b, int a, bool noDepthTest, float duration) = 0;
|
||||
virtual void AddBoxOverlay2( const Vector& origin, const Vector& mins, const Vector& max, QAngle const& orientation, const Color& faceColor, const Color& edgeColor, float duration ) = 0;
|
||||
|
||||
virtual void AddLineOverlay(const Vector& origin, const Vector& dest, int r, int g, int b, int a, float thickness, float duration) = 0;
|
||||
|
||||
virtual void PurgeTextOverlays() = 0;
|
||||
|
||||
virtual void AddCapsuleOverlay( const Vector &vStart, const Vector &vEnd, const float &flRadius, int r, int g, int b, int a, float flDuration ) = 0;
|
||||
|
||||
private:
|
||||
inline void AddTextOverlay(const Vector& origin, int line_offset, float duration, int r, int g, int b, int a, PRINTF_FORMAT_STRING const char *format, ...) {} /* catch improper use of bad interface. Needed because '0' duration can be resolved by compiler to NULL format string (i.e., compiles but calls wrong function) */
|
||||
};
|
||||
|
||||
|
||||
#endif // IVDEBUGOVERLAY_H
|
||||
@@ -0,0 +1,241 @@
|
||||
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef IVMODELINFO_H
|
||||
#define IVMODELINFO_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "tier0/platform.h"
|
||||
#include "datacache/imdlcache.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Forward declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
class IMaterial;
|
||||
class KeyValues;
|
||||
struct vcollide_t;
|
||||
struct model_t;
|
||||
class Vector;
|
||||
class QAngle;
|
||||
class CGameTrace;
|
||||
struct cplane_t;
|
||||
typedef CGameTrace trace_t;
|
||||
struct studiohdr_t;
|
||||
struct virtualmodel_t;
|
||||
typedef unsigned char byte;
|
||||
struct virtualterrainparams_t;
|
||||
class CPhysCollide;
|
||||
typedef unsigned short MDLHandle_t;
|
||||
class CUtlBuffer;
|
||||
class IClientRenderable;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Indicates the type of translucency of an unmodulated renderable
|
||||
//-----------------------------------------------------------------------------
|
||||
enum RenderableTranslucencyType_t
|
||||
{
|
||||
RENDERABLE_IS_OPAQUE = 0,
|
||||
RENDERABLE_IS_TRANSLUCENT,
|
||||
RENDERABLE_IS_TWO_PASS, // has both translucent and opaque sub-partsa
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: a callback class that is notified when a model has finished loading
|
||||
//-----------------------------------------------------------------------------
|
||||
abstract_class IModelLoadCallback
|
||||
{
|
||||
public:
|
||||
virtual void OnModelLoadComplete( const model_t* pModel ) = 0;
|
||||
|
||||
protected:
|
||||
// Protected destructor so that nobody tries to delete via this interface.
|
||||
// Automatically unregisters if the callback is destroyed while still pending.
|
||||
~IModelLoadCallback();
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Automate refcount tracking on a model index
|
||||
//-----------------------------------------------------------------------------
|
||||
class CRefCountedModelIndex
|
||||
{
|
||||
private:
|
||||
int m_nIndex;
|
||||
public:
|
||||
CRefCountedModelIndex() : m_nIndex( -1 ) { }
|
||||
~CRefCountedModelIndex() { Set( -1 ); }
|
||||
|
||||
CRefCountedModelIndex( const CRefCountedModelIndex& src ) : m_nIndex( -1 ) { Set( src.m_nIndex ); }
|
||||
CRefCountedModelIndex& operator=( const CRefCountedModelIndex& src ) { Set( src.m_nIndex ); return *this; }
|
||||
|
||||
explicit CRefCountedModelIndex( int i ) : m_nIndex( -1 ) { Set( i ); }
|
||||
CRefCountedModelIndex& operator=( int i ) { Set( i ); return *this; }
|
||||
|
||||
int Get() const { return m_nIndex; }
|
||||
void Set( int i );
|
||||
void Clear() { Set( -1 ); }
|
||||
|
||||
operator int () const { return m_nIndex; }
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Model info interface
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// change this when the new version is incompatable with the old
|
||||
#define VMODELINFO_CLIENT_INTERFACE_VERSION "VModelInfoClient004"
|
||||
#define VMODELINFO_SERVER_INTERFACE_VERSION "VModelInfoServer002"
|
||||
|
||||
// MODEL INDEX RULES
|
||||
// If index >= 0, then index references the precached model string table
|
||||
// If index == -1, then the model is invalid
|
||||
// If index < -1, then the model is DYNAMIC and has a DYNAMIC INDEX of (-2 - index)
|
||||
// - if the dynamic index is ODD, then the model is CLIENT ONLY
|
||||
// and has a m_LocalDynamicModels lookup index of (dynamic index)>>1
|
||||
// - if the dynamic index is EVEN, then the model is NETWORKED
|
||||
// and has a dynamic model string table index of (dynamic index)>>1
|
||||
|
||||
inline bool IsDynamicModelIndex( int modelindex ) { return modelindex < -1; }
|
||||
inline bool IsClientOnlyModelIndex( int modelindex ) { return modelindex < -1 && (modelindex & 1); }
|
||||
|
||||
class IVModelInfo
|
||||
{
|
||||
public:
|
||||
virtual ~IVModelInfo( void ) { }
|
||||
|
||||
virtual const model_t *GetModel( int modelindex ) const = 0;
|
||||
// Returns index of model by name
|
||||
virtual int GetModelIndex( const char *name ) const = 0;
|
||||
|
||||
// Returns name of model
|
||||
virtual const char *GetModelName( const model_t *model ) const = 0;
|
||||
virtual vcollide_t *GetVCollide( const model_t *model ) const = 0;
|
||||
virtual vcollide_t *GetVCollide( int modelindex ) const = 0;
|
||||
virtual void GetModelBounds( const model_t *model, Vector& mins, Vector& maxs ) const = 0;
|
||||
virtual void GetModelRenderBounds( const model_t *model, Vector& mins, Vector& maxs ) const = 0;
|
||||
virtual int GetModelFrameCount( const model_t *model ) const = 0;
|
||||
virtual int GetModelType( const model_t *model ) const = 0;
|
||||
virtual void *GetModelExtraData( const model_t *model ) = 0;
|
||||
virtual bool ModelHasMaterialProxy( const model_t *model ) const = 0;
|
||||
virtual bool IsTranslucent( model_t const* model ) const = 0;
|
||||
virtual bool IsTranslucentTwoPass( const model_t *model ) const = 0;
|
||||
virtual void Unused0() {};
|
||||
virtual RenderableTranslucencyType_t ComputeTranslucencyType( const model_t *model, int nSkin, int nBody ) = 0;
|
||||
virtual int GetModelMaterialCount( const model_t* model ) const = 0;
|
||||
virtual int GetModelMaterials( const model_t *model, int count, IMaterial** ppMaterial ) = 0;
|
||||
virtual bool IsModelVertexLit( const model_t *model ) const = 0;
|
||||
virtual const char *GetModelKeyValueText( const model_t *model ) = 0;
|
||||
virtual bool GetModelKeyValue( const model_t *model, CUtlBuffer &buf ) = 0; // supports keyvalue blocks in submodels
|
||||
virtual float GetModelRadius( const model_t *model ) = 0;
|
||||
|
||||
virtual const studiohdr_t *FindModel( const studiohdr_t *pStudioHdr, void **cache, const char *modelname ) const = 0;
|
||||
virtual const studiohdr_t *FindModel( void *cache ) const = 0;
|
||||
virtual virtualmodel_t *GetVirtualModel( const studiohdr_t *pStudioHdr ) const = 0;
|
||||
virtual byte *GetAnimBlock( const studiohdr_t *pStudioHdr, int nBlock, bool bPreloadIfMissing ) const = 0;
|
||||
virtual bool HasAnimBlockBeenPreloaded( const studiohdr_t *pStudioHdr, int nBlock ) const = 0;
|
||||
|
||||
// Available on client only!!!
|
||||
virtual void GetModelMaterialColorAndLighting( const model_t *model, Vector const& origin,
|
||||
QAngle const& angles, trace_t* pTrace,
|
||||
Vector& lighting, Vector& matColor ) = 0;
|
||||
virtual void GetIlluminationPoint( const model_t *model, IClientRenderable *pRenderable, Vector const& origin,
|
||||
QAngle const& angles, Vector* pLightingCenter ) = 0;
|
||||
|
||||
virtual int GetModelContents( int modelIndex ) const = 0;
|
||||
virtual studiohdr_t *GetStudiomodel( const model_t *mod ) = 0;
|
||||
virtual int GetModelSpriteWidth( const model_t *model ) const = 0;
|
||||
virtual int GetModelSpriteHeight( const model_t *model ) const = 0;
|
||||
|
||||
// Sets/gets a map-specified fade range (client only)
|
||||
virtual void SetLevelScreenFadeRange( float flMinSize, float flMaxSize ) = 0;
|
||||
virtual void GetLevelScreenFadeRange( float *pMinArea, float *pMaxArea ) const = 0;
|
||||
|
||||
// Sets/gets a map-specified per-view fade range (client only)
|
||||
virtual void SetViewScreenFadeRange( float flMinSize, float flMaxSize ) = 0;
|
||||
|
||||
// Computes fade alpha based on distance fade + screen fade (client only)
|
||||
virtual unsigned char ComputeLevelScreenFade( const Vector &vecAbsOrigin, float flRadius, float flFadeScale ) const = 0;
|
||||
virtual unsigned char ComputeViewScreenFade( const Vector &vecAbsOrigin, float flRadius, float flFadeScale ) const = 0;
|
||||
|
||||
// both client and server
|
||||
virtual int GetAutoplayList( const studiohdr_t *pStudioHdr, unsigned short **pAutoplayList ) const = 0;
|
||||
|
||||
// Gets a virtual terrain collision model (creates if necessary)
|
||||
// NOTE: This may return NULL if the terrain model cannot be virtualized
|
||||
virtual CPhysCollide *GetCollideForVirtualTerrain( int index ) = 0;
|
||||
|
||||
virtual bool IsUsingFBTexture( const model_t *model, int nSkin, int nBody, void /*IClientRenderable*/ *pClientRenderable ) const = 0;
|
||||
|
||||
virtual const model_t *FindOrLoadModel( const char *name ) const = 0;
|
||||
|
||||
virtual MDLHandle_t GetCacheHandle( const model_t *model ) const = 0;
|
||||
|
||||
// Returns planes of non-nodraw brush model surfaces
|
||||
virtual int GetBrushModelPlaneCount( const model_t *model ) const = 0;
|
||||
virtual void GetBrushModelPlane( const model_t *model, int nIndex, cplane_t &plane, Vector *pOrigin ) const = 0;
|
||||
virtual int GetSurfacepropsForVirtualTerrain( int index ) = 0;
|
||||
virtual bool UsesEnvCubemap( const model_t *model ) const = 0;
|
||||
virtual bool UsesStaticLighting( const model_t *model ) const = 0;
|
||||
|
||||
// Returns index of model by name, dynamically registered if not already known.
|
||||
virtual int RegisterDynamicModel( const char *name, bool bClientSide ) = 0;
|
||||
virtual int RegisterCombinedDynamicModel( const char *pszName, MDLHandle_t Handle ) = 0;
|
||||
virtual void UpdateCombinedDynamicModel( int nModelIndex, MDLHandle_t Handle ) = 0;
|
||||
|
||||
virtual int BeginCombinedModel( const char *pszName, bool bReuseExisting ) = 0;
|
||||
virtual bool SetCombineModels( int nModelIndex, const CUtlVector< SCombinerModelInput_t > &vecModelsToCombine ) = 0;
|
||||
virtual bool FinishCombinedModel( int nModelIndex, CombinedModelLoadedCallback pFunc, void *pUserData = NULL ) = 0;
|
||||
virtual void ReleaseCombinedModel( int nModelIndex ) = 0;
|
||||
|
||||
virtual bool IsDynamicModelLoading( int modelIndex ) = 0;
|
||||
virtual void AddRefDynamicModel( int modelIndex ) = 0;
|
||||
virtual void ReleaseDynamicModel( int modelIndex ) = 0;
|
||||
|
||||
// Registers callback for when dynamic model has finished loading.
|
||||
virtual bool RegisterModelLoadCallback( int modelindex, IModelLoadCallback* pCallback, bool bCallImmediatelyIfLoaded = true ) = 0;
|
||||
virtual void UnregisterModelLoadCallback( int modelindex, IModelLoadCallback* pCallback ) = 0;
|
||||
|
||||
// Poked by engine
|
||||
virtual void OnLevelChange() = 0;
|
||||
|
||||
virtual KeyValues *GetModelKeyValues( const model_t *pModel ) = 0;
|
||||
|
||||
virtual void UpdateViewWeaponModelCache( const char **ppWeaponModels, int nWeaponModels ) = 0;
|
||||
virtual void TouchWorldWeaponModelCache( const char **ppWeaponModels, int nWeaponModels ) = 0;
|
||||
};
|
||||
|
||||
|
||||
class IVModelInfoClient : public IVModelInfo
|
||||
{
|
||||
public:
|
||||
// Returns a model as a client-side index which is stable across server changes
|
||||
virtual int GetModelClientSideIndex( const char *name ) const = 0;
|
||||
|
||||
// Poked by engine
|
||||
virtual void OnDynamicModelStringTableChanged( int nStringIndex, const char *pString, const void *pData ) = 0;
|
||||
|
||||
// Reference and Unload
|
||||
// Don't assume Reference flags - doing this for now
|
||||
virtual model_t *ReferenceModel( const char *name ) = 0;
|
||||
virtual void UnreferenceModel( model_t *model ) = 0;
|
||||
virtual void UnloadUnreferencedModels( void ) = 0;
|
||||
};
|
||||
|
||||
|
||||
struct virtualterrainparams_t
|
||||
{
|
||||
// UNDONE: Add grouping here, specified in BSP file? (test grouping to see if this is necessary)
|
||||
int index;
|
||||
};
|
||||
|
||||
#endif // IVMODELINFO_H
|
||||
@@ -0,0 +1,220 @@
|
||||
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef IVMODELRENDER_H
|
||||
#define IVMODELRENDER_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "interface.h"
|
||||
#include "mathlib/mathlib.h"
|
||||
#include "istudiorender.h"
|
||||
#include "datacache/idatacache.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
struct mstudioanimdesc_t;
|
||||
struct mstudioseqdesc_t;
|
||||
struct model_t;
|
||||
class IClientRenderable;
|
||||
class Vector;
|
||||
struct studiohdr_t;
|
||||
class IMaterial;
|
||||
class CStudioHdr;
|
||||
struct MaterialLightingState_t;
|
||||
|
||||
FORWARD_DECLARE_HANDLE( LightCacheHandle_t );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Model rendering state
|
||||
//-----------------------------------------------------------------------------
|
||||
struct DrawModelState_t
|
||||
{
|
||||
studiohdr_t* m_pStudioHdr;
|
||||
studiohwdata_t* m_pStudioHWData;
|
||||
IClientRenderable* m_pRenderable;
|
||||
const matrix3x4_t *m_pModelToWorld;
|
||||
StudioDecalHandle_t m_decals;
|
||||
int m_drawFlags;
|
||||
int m_lod;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Model Rendering + instance data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// change this when the new version is incompatable with the old
|
||||
#define VENGINE_HUDMODEL_INTERFACE_VERSION "VEngineModel016"
|
||||
|
||||
typedef unsigned short ModelInstanceHandle_t;
|
||||
|
||||
enum
|
||||
{
|
||||
MODEL_INSTANCE_INVALID = (ModelInstanceHandle_t)~0
|
||||
};
|
||||
|
||||
struct ModelRenderInfo_t
|
||||
{
|
||||
Vector origin;
|
||||
QAngle angles;
|
||||
IClientRenderable *pRenderable;
|
||||
const model_t *pModel;
|
||||
const matrix3x4_t *pModelToWorld;
|
||||
const matrix3x4_t *pLightingOffset;
|
||||
const Vector *pLightingOrigin;
|
||||
int flags;
|
||||
int entity_index;
|
||||
int skin;
|
||||
int body;
|
||||
int hitboxset;
|
||||
ModelInstanceHandle_t instance;
|
||||
|
||||
ModelRenderInfo_t()
|
||||
{
|
||||
pModelToWorld = NULL;
|
||||
pLightingOffset = NULL;
|
||||
pLightingOrigin = NULL;
|
||||
}
|
||||
};
|
||||
|
||||
struct StaticPropRenderInfo_t
|
||||
{
|
||||
const matrix3x4_t *pModelToWorld;
|
||||
const model_t *pModel;
|
||||
IClientRenderable *pRenderable;
|
||||
Vector *pLightingOrigin;
|
||||
ModelInstanceHandle_t instance;
|
||||
uint8 skin;
|
||||
uint8 alpha;
|
||||
};
|
||||
|
||||
struct LightingQuery_t
|
||||
{
|
||||
Vector m_LightingOrigin;
|
||||
ModelInstanceHandle_t m_InstanceHandle;
|
||||
bool m_bAmbientBoost;
|
||||
};
|
||||
|
||||
struct StaticLightingQuery_t : public LightingQuery_t
|
||||
{
|
||||
IClientRenderable *m_pRenderable;
|
||||
};
|
||||
|
||||
|
||||
// UNDONE: Move this to hud export code, subsume previous functions
|
||||
abstract_class IVModelRender
|
||||
{
|
||||
public:
|
||||
virtual int DrawModel( int flags,
|
||||
IClientRenderable *pRenderable,
|
||||
ModelInstanceHandle_t instance,
|
||||
int entity_index,
|
||||
const model_t *model,
|
||||
Vector const& origin,
|
||||
QAngle const& angles,
|
||||
int skin,
|
||||
int body,
|
||||
int hitboxset,
|
||||
const matrix3x4_t *modelToWorld = NULL,
|
||||
const matrix3x4_t *pLightingOffset = NULL ) = 0;
|
||||
|
||||
// This causes a material to be used when rendering the model instead
|
||||
// of the materials the model was compiled with
|
||||
virtual void ForcedMaterialOverride( IMaterial *newMaterial, OverrideType_t nOverrideType = OVERRIDE_NORMAL, int nMaterialIndex = -1 ) = 0;
|
||||
virtual bool IsForcedMaterialOverride() = 0;
|
||||
|
||||
virtual void SetViewTarget( const CStudioHdr *pStudioHdr, int nBodyIndex, const Vector& target ) = 0;
|
||||
|
||||
// Creates, destroys instance data to be associated with the model
|
||||
virtual ModelInstanceHandle_t CreateInstance( IClientRenderable *pRenderable, LightCacheHandle_t *pCache = NULL ) = 0;
|
||||
virtual void DestroyInstance( ModelInstanceHandle_t handle ) = 0;
|
||||
|
||||
// Associates a particular lighting condition with a model instance handle.
|
||||
// FIXME: This feature currently only works for static props. To make it work for entities, etc.,
|
||||
// we must clean up the lightcache handles as the model instances are removed.
|
||||
// At the moment, since only the static prop manager uses this, it cleans up all LightCacheHandles
|
||||
// at level shutdown.
|
||||
virtual void SetStaticLighting( ModelInstanceHandle_t handle, LightCacheHandle_t* pHandle ) = 0;
|
||||
virtual LightCacheHandle_t GetStaticLighting( ModelInstanceHandle_t handle ) = 0;
|
||||
|
||||
// moves an existing InstanceHandle to a nex Renderable to keep decals etc. Models must be the same
|
||||
virtual bool ChangeInstance( ModelInstanceHandle_t handle, IClientRenderable *pRenderable ) = 0;
|
||||
|
||||
// Creates a decal on a model instance by doing a planar projection
|
||||
// along the ray. The material is the decal material, the radius is the
|
||||
// radius of the decal to create.
|
||||
virtual void AddDecal( ModelInstanceHandle_t handle, Ray_t const& ray,
|
||||
Vector const& decalUp, int decalIndex, int body, bool noPokeThru = false, int maxLODToDecal = ADDDECAL_TO_ALL_LODS, IMaterial *pSpecifyMaterial = NULL, float w=1.0f, float h=1.0f, void *pvProxyUserData = NULL, int nAdditionalDecalFlags = 0 ) = 0;
|
||||
|
||||
// Removes all the decals on a model instance
|
||||
virtual void RemoveAllDecals( ModelInstanceHandle_t handle ) = 0;
|
||||
|
||||
// Returns true if the model instance is valid and the decal list is not empty
|
||||
virtual bool ModelHasDecals( ModelInstanceHandle_t handle ) = 0;
|
||||
|
||||
// Remove all decals from all models
|
||||
virtual void RemoveAllDecalsFromAllModels( bool bRenderContextValid ) = 0;
|
||||
|
||||
// Shadow rendering, DrawModelShadowSetup returns the address of the bone-to-world array, NULL in case of error
|
||||
virtual matrix3x4a_t* DrawModelShadowSetup( IClientRenderable *pRenderable, int body, int skin, DrawModelInfo_t *pInfo, matrix3x4a_t *pCustomBoneToWorld = NULL ) = 0;
|
||||
virtual void DrawModelShadow( IClientRenderable *pRenderable, const DrawModelInfo_t &info, matrix3x4a_t *pCustomBoneToWorld = NULL ) = 0;
|
||||
|
||||
// This gets called when overbright, etc gets changed to recompute static prop lighting.
|
||||
virtual bool RecomputeStaticLighting( ModelInstanceHandle_t handle ) = 0;
|
||||
|
||||
virtual void ReleaseAllStaticPropColorData( void ) = 0;
|
||||
virtual void RestoreAllStaticPropColorData( void ) = 0;
|
||||
|
||||
// Extended version of drawmodel
|
||||
virtual int DrawModelEx( ModelRenderInfo_t &pInfo ) = 0;
|
||||
|
||||
virtual int DrawModelExStaticProp( IMatRenderContext *pRenderContext, ModelRenderInfo_t &pInfo ) = 0;
|
||||
|
||||
virtual bool DrawModelSetup( IMatRenderContext *pRenderContext, ModelRenderInfo_t &pInfo, DrawModelState_t *pState, matrix3x4_t **ppBoneToWorldOut ) = 0;
|
||||
virtual void DrawModelExecute( IMatRenderContext *pRenderContext, const DrawModelState_t &state, const ModelRenderInfo_t &pInfo, matrix3x4_t *pCustomBoneToWorld = NULL ) = 0;
|
||||
|
||||
// Sets up lighting context for a point in space
|
||||
virtual void SetupLighting( const Vector &vecCenter ) = 0;
|
||||
|
||||
// doesn't support any debug visualization modes or other model options, but draws static props in the
|
||||
// fastest way possible
|
||||
virtual int DrawStaticPropArrayFast( StaticPropRenderInfo_t *pProps, int count, bool bShadowDepth ) = 0;
|
||||
|
||||
// Allow client to override lighting state
|
||||
virtual void SuppressEngineLighting( bool bSuppress ) = 0;
|
||||
|
||||
virtual void SetupColorMeshes( int nTotalVerts ) = 0;
|
||||
|
||||
// Sets up lighting context for a point in space, with smooth interpolation per model.
|
||||
// Passing MODEL_INSTANCE_INVALID as a handle is equivalent to calling SetupLighting.
|
||||
virtual void SetupLightingEx( const Vector &vecCenter, ModelInstanceHandle_t handle ) = 0;
|
||||
|
||||
// Finds the brightest light source illuminating a point. Returns false if there isn't any.
|
||||
virtual bool GetBrightestShadowingLightSource( const Vector &vecCenter, Vector& lightPos, Vector& lightBrightness, bool bAllowNonTaggedLights ) = 0;
|
||||
|
||||
// Computes lighting state for an array of lighting requests
|
||||
virtual void ComputeLightingState( int nCount, const LightingQuery_t *pQuery, MaterialLightingState_t *pState, ITexture **ppEnvCubemapTexture ) = 0;
|
||||
|
||||
// Gets an array of decal handles given model instances
|
||||
virtual void GetModelDecalHandles( StudioDecalHandle_t *pDecals, int nDecalStride, int nCount, const ModelInstanceHandle_t *pHandles ) = 0;
|
||||
|
||||
// Computes lighting state for an array of lighting requests for renderables which use static lighting
|
||||
virtual void ComputeStaticLightingState( int nCount, const StaticLightingQuery_t *pQuery, MaterialLightingState_t *pState, MaterialLightingState_t *pDecalState, ColorMeshInfo_t **ppStaticLighting, ITexture **ppEnvCubemapTexture, DataCacheHandle_t *pColorMeshHandles ) = 0;
|
||||
|
||||
// Cleans up lighting state. Must be called after the draw call that uses
|
||||
// the color meshes return from ComputeStaticLightingState has been issued
|
||||
virtual void CleanupStaticLightingState( int nCount, DataCacheHandle_t *pColorMeshHandles ) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif // IVMODELRENDER_H
|
||||
@@ -0,0 +1,49 @@
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Some macros for the raytraces-in-think-function-counter.
|
||||
// They're in a header because they're included in a bunch of
|
||||
// places, but on some cases they need to define files and in
|
||||
// others only extern them.
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef THINK_TRACE_COUNTER_H
|
||||
#define THINK_TRACE_COUNTER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#define THINK_TRACE_COUNTER_COMPILED 1 // without this, all the code is elided.
|
||||
|
||||
|
||||
#ifdef THINK_TRACE_COUNTER_COMPILED
|
||||
// create a macro that is true if we are allowed to debug traces during thinks, and compiles out to nothing otherwise.
|
||||
#if defined( _GAMECONSOLE ) || defined( NO_STEAM )
|
||||
#define DEBUG_THINK_TRACE_COUNTER_ALLOWED() (!IsCert())
|
||||
#else
|
||||
#ifdef THINK_TRACE_COUNTER_COMPILE_FUNCTIONS_ENGINE
|
||||
bool DEBUG_THINK_TRACE_COUNTER_ALLOWED()
|
||||
{
|
||||
// done as a static var to defer initialization until Steam is ready,
|
||||
// but also to have the fastest check at runtime (rather than calling through
|
||||
// the API each time)
|
||||
static bool bIsPublic = GetSteamUniverse() == k_EUniversePublic;
|
||||
return !bIsPublic;
|
||||
}
|
||||
#elif defined( THINK_TRACE_COUNTER_COMPILE_FUNCTIONS_SERVER )
|
||||
bool DEBUG_THINK_TRACE_COUNTER_ALLOWED()
|
||||
{
|
||||
// done as a static var to defer initialization until Steam is ready,
|
||||
// but also to have the fastest check at runtime (rather than calling through
|
||||
// the API each time)
|
||||
static bool bIsPublic = steamapicontext->SteamUtils() != NULL && steamapicontext->SteamUtils()->GetConnectedUniverse() == k_EUniversePublic;
|
||||
return !bIsPublic;
|
||||
}
|
||||
#else
|
||||
extern bool DEBUG_THINK_TRACE_COUNTER_ALLOWED();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif // THINK_TRACE_COUNTER_H
|
||||
@@ -0,0 +1,94 @@
|
||||
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef VIEW_SHAREDV1_H
|
||||
#define VIEW_SHAREDV1_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Renderer setup data.
|
||||
//-----------------------------------------------------------------------------
|
||||
class CViewSetupV1
|
||||
{
|
||||
public:
|
||||
CViewSetupV1()
|
||||
{
|
||||
m_bForceAspectRatio1To1 = false;
|
||||
m_bRenderToSubrectOfLargerScreen = false;
|
||||
bForceClearWholeRenderTarget = false;
|
||||
m_bUseRenderTargetAspectRatio = false;
|
||||
}
|
||||
|
||||
// shared by 2D & 3D views
|
||||
|
||||
// User specified context
|
||||
int context;
|
||||
|
||||
// left side of view window
|
||||
int x;
|
||||
// top side of view window
|
||||
int y;
|
||||
// width of view window
|
||||
int width;
|
||||
// height of view window
|
||||
int height;
|
||||
|
||||
// clear the color buffer before rendering this view?
|
||||
bool clearColor;
|
||||
// clear the Depth buffer before rendering this view?
|
||||
bool clearDepth;
|
||||
// NOTE: This is for a workaround on ATI with building cubemaps. Clearing just the viewport doesn't seem to work properly.
|
||||
bool bForceClearWholeRenderTarget;
|
||||
|
||||
// the rest are only used by 3D views
|
||||
|
||||
// Orthographic projection?
|
||||
bool m_bOrtho;
|
||||
// View-space rectangle for ortho projection.
|
||||
float m_OrthoLeft;
|
||||
float m_OrthoTop;
|
||||
float m_OrthoRight;
|
||||
float m_OrthoBottom;
|
||||
|
||||
// horizontal FOV in degrees
|
||||
float fov;
|
||||
// horizontal FOV in degrees for in-view model
|
||||
float fovViewmodel;
|
||||
|
||||
// 3D origin of camera
|
||||
Vector origin;
|
||||
// Origin gets reflected on the water surface, but things like
|
||||
// displacement LOD need to be calculated from the viewer's
|
||||
// real position.
|
||||
Vector m_vUnreflectedOrigin;
|
||||
|
||||
// heading of camera (pitch, yaw, roll)
|
||||
QAngle angles;
|
||||
// local Z coordinate of near plane of camera
|
||||
float zNear;
|
||||
// local Z coordinate of far plane of camera
|
||||
float zFar;
|
||||
|
||||
// local Z coordinate of near plane of camera ( when rendering view model )
|
||||
float zNearViewmodel;
|
||||
// local Z coordinate of far plane of camera ( when rendering view model )
|
||||
float zFarViewmodel;
|
||||
|
||||
bool m_bForceAspectRatio1To1;
|
||||
|
||||
// set to true if this is to draw into a subrect of the larger screen
|
||||
// this really is a hack, but no more than the rest of the way this class is used
|
||||
bool m_bRenderToSubrectOfLargerScreen;
|
||||
|
||||
// Use this for situations like water where you want to render the aspect ratio of the
|
||||
// back buffer into a square (or otherwise) render target.
|
||||
bool m_bUseRenderTargetAspectRatio;
|
||||
};
|
||||
|
||||
#endif // VIEW_SHAREDV1_H
|
||||
Reference in New Issue
Block a user