fixed windows builds
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define ENTITY_H
|
||||
|
||||
#include "engine.h"
|
||||
#include "interface.h"
|
||||
#include "tier1/utlvector.h"
|
||||
#include "math3d.h"
|
||||
|
||||
@@ -72,10 +73,11 @@ public:
|
||||
typedef CBaseEntity*(*EntityRegistryFn)( void );
|
||||
typedef C_BaseEntity*(*ClientEntityRegistryFn)( void );
|
||||
|
||||
interface CEntityRegistry
|
||||
|
||||
class CEntityRegistryObject
|
||||
{
|
||||
public:
|
||||
CEntityRegistry( const char *szName, const char *szClass, EntityRegistryFn pfn );
|
||||
CEntityRegistryObject( const char *szName, const char *szClass, EntityRegistryFn pfn );
|
||||
|
||||
const char *m_szName;
|
||||
const char *m_szClass;
|
||||
@@ -83,6 +85,14 @@ public:
|
||||
ClientEntityRegistryFn m_pClientfn = 0;
|
||||
};
|
||||
|
||||
interface IEntityManager: public IInterface
|
||||
{
|
||||
public:
|
||||
CUtlVector<CBaseEntity*> m_entities;
|
||||
CUtlVector<CEntityRegistryObject*> m_RegisteredEntities;
|
||||
};
|
||||
|
||||
IEntityManager *EntityManager();
|
||||
|
||||
|
||||
#define DECLARE_ENTITY(name, class) \
|
||||
@@ -90,7 +100,7 @@ CBaseEntity *__entity_alloc_##name() \
|
||||
{ \
|
||||
return new class; \
|
||||
}; \
|
||||
CEntityRegistry __entity_##name##_registry(#name, #class, __entity_alloc_##name); \
|
||||
CEntityRegistryObject __entity_##name##_registry(#name, #class, __entity_alloc_##name); \
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -127,8 +137,4 @@ C_BaseEntity *__c_entity_alloc_##server() \
|
||||
C_EntityRegistry __c_entity_##server##_registry(#server, __c_entity_alloc_##server); \
|
||||
|
||||
|
||||
extern CUtlVector<CBaseEntity*> g_entities;
|
||||
extern CUtlVector<CEntityRegistry*> g_RegisteredEntities;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define CONSOLE_H
|
||||
|
||||
#include "engine.h"
|
||||
#include "interface.h"
|
||||
#include "tier1/utlstring.h"
|
||||
#include "tier1/utlvector.h"
|
||||
|
||||
@@ -21,33 +22,37 @@ public:
|
||||
static bool IsVisibile();
|
||||
};
|
||||
|
||||
interface IConsole
|
||||
interface IConsole: public IInterface
|
||||
{
|
||||
public:
|
||||
static void Init();
|
||||
static void Frame();
|
||||
static void Deinit();
|
||||
virtual void Init() = 0;
|
||||
virtual void Frame() = 0;
|
||||
virtual void Deinit() = 0;
|
||||
|
||||
// Variables
|
||||
static void RegisterVar( ConVar *cvar );
|
||||
static void UnRegisterVar( ConVar *cvar );
|
||||
static ConVar *FindVar( const char *pName );
|
||||
virtual void RegisterVar( ConVar *cvar ) = 0;
|
||||
virtual void UnRegisterVar( ConVar *cvar ) = 0;
|
||||
virtual ConVar *FindVar( const char *pName ) = 0;
|
||||
|
||||
// Commands
|
||||
static void RegisterCommand( ConCommand *cvar );
|
||||
static void UnRegisterCommand( ConCommand *cvar );
|
||||
static ConCommand *FindCommand( const char *pName );
|
||||
virtual void RegisterCommand( ConCommand *cvar ) = 0;
|
||||
virtual void UnRegisterCommand( ConCommand *cvar ) = 0;
|
||||
virtual ConCommand *FindCommand( const char *pName ) = 0;
|
||||
|
||||
// Command buffer
|
||||
static void Execute( void );
|
||||
static CUtlVector<CUtlVector<CUtlString>> ParseCommandLine( CUtlString psz );
|
||||
virtual void Execute( void ) = 0;
|
||||
virtual void ExecuteArguments( CUtlVector<CUtlString> &args ) = 0;
|
||||
virtual CUtlVector<CUtlVector<CUtlString>> ParseCommandLine( CUtlString psz ) = 0;
|
||||
|
||||
static void AddCommand( const char *psz );
|
||||
static void InsertCommand( const char *psz );
|
||||
private:
|
||||
static void Execute2( CUtlVector<CUtlString> &args );
|
||||
virtual void AddCommand( const char *psz ) = 0;
|
||||
virtual void InsertCommand( const char *psz ) = 0;
|
||||
|
||||
CUtlVector<ConVar*> m_convars;
|
||||
CUtlVector<ConCommand*> m_commands;
|
||||
};
|
||||
|
||||
IConsole *Console();
|
||||
|
||||
|
||||
#define FCVAR_NONE 0
|
||||
#define FCVAR_DEVELOPMENTONLY 0x1
|
||||
|
||||
@@ -24,8 +24,8 @@ public:
|
||||
virtual void Frame() = 0;
|
||||
virtual void SetVisibility( bool bValue );
|
||||
|
||||
int32_t m_iPosition[2];
|
||||
uint32_t m_iSize[2];
|
||||
int32_t m_iPosition[2] = {0, 0};
|
||||
uint32_t m_iSize[2] = {0, 0};
|
||||
CFGUI_Widget *m_pParent = NULL;
|
||||
bool m_bIsVisible = true;
|
||||
};
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "tier0/platform.h"
|
||||
#include "tier1/utlbuffer.h"
|
||||
#include "tier1/utlstring.h"
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
enum EFileOptions
|
||||
{
|
||||
@@ -22,22 +22,24 @@ typedef struct FileHandle_s
|
||||
size_t nPtr;
|
||||
} *FileHandle_t;
|
||||
|
||||
interface IFileSystem
|
||||
interface IFileSystem: public IInterface
|
||||
{
|
||||
public:
|
||||
static void InitFilesystem( void );
|
||||
static void AddGameDirectory( const char *psz );
|
||||
static bool LoadPackFile( const char *szFilename );
|
||||
static void CreatePath( const char *szPath );
|
||||
static FileHandle_t Open( const char *szFilename, EFileOptions options );
|
||||
static void Close( FileHandle_t file );
|
||||
static size_t Size( FileHandle_t file );
|
||||
static size_t Read( FileHandle_t file, void *pOutput, size_t nSize);
|
||||
static size_t ReadLine( FileHandle_t file, void *pOutput, size_t nSize);
|
||||
static size_t Write( FileHandle_t file, void *pInput, size_t nSize);
|
||||
static size_t Seek( FileHandle_t file, size_t nSize);
|
||||
static size_t Tell( FileHandle_t file, size_t nSize);
|
||||
static size_t fprintf( FileHandle_t file, const char *szFormat, ...);
|
||||
virtual void InitFilesystem( void ) = 0;
|
||||
virtual void AddGameDirectory( const char *psz ) = 0;
|
||||
virtual bool LoadPackFile( const char *szFilename ) = 0;
|
||||
virtual void CreatePath( const char *szPath ) = 0;
|
||||
virtual FileHandle_t Open( const char *szFilename, EFileOptions options ) = 0;
|
||||
virtual void Close( FileHandle_t file ) = 0;
|
||||
virtual size_t Size( FileHandle_t file ) = 0;
|
||||
virtual size_t Read( FileHandle_t file, void *pOutput, size_t nSize) = 0;
|
||||
virtual size_t ReadLine( FileHandle_t file, void *pOutput, size_t nSize) = 0;
|
||||
virtual size_t Write( FileHandle_t file, void *pInput, size_t nSize) = 0;
|
||||
virtual size_t Seek( FileHandle_t file, size_t nSize) = 0;
|
||||
virtual size_t Tell( FileHandle_t file, size_t nSize) = 0;
|
||||
virtual size_t fprintf( FileHandle_t file, const char *szFormat, ...) = 0;
|
||||
};
|
||||
|
||||
IFileSystem *FileSystem();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "interface.h"
|
||||
#include "tier0/platform.h"
|
||||
#include "tier1/utlvector.h"
|
||||
|
||||
class CGameMode
|
||||
{
|
||||
@@ -12,16 +13,6 @@ public:
|
||||
bool bCanPlayerSpawnMidRound;
|
||||
};
|
||||
|
||||
interface IGameModeManager: public IInterface
|
||||
{
|
||||
public:
|
||||
virtual void StartGameMode( const char *szName ) = 0;
|
||||
virtual const char *GetCurrentGameMode( void ) = 0;
|
||||
virtual CGameMode *GetCurrentGameModeClass( void ) = 0;
|
||||
virtual void RestartCurrentGameMode( void ) = 0;
|
||||
};
|
||||
|
||||
extern IGameModeManager *GameModeManager();
|
||||
|
||||
typedef CGameMode*(*GameModeRegistryFn)();
|
||||
class CGameModeRegistry
|
||||
@@ -39,5 +30,17 @@ CGameMode *__gamemode_alloc_##name() \
|
||||
}; \
|
||||
CGameModeRegistry __gamemode_##name##_registry(#name, __gamemode_alloc_##name); \
|
||||
|
||||
interface IGameModeManager: public IInterface
|
||||
{
|
||||
public:
|
||||
virtual void StartGameMode( const char *szName ) = 0;
|
||||
virtual const char *GetCurrentGameMode( void ) = 0;
|
||||
virtual CGameMode *GetCurrentGameModeClass( void ) = 0;
|
||||
virtual void RestartCurrentGameMode( void ) = 0;
|
||||
|
||||
CUtlVector<CGameModeRegistry*> m_RegisteredGameModes;
|
||||
};
|
||||
|
||||
extern IGameModeManager *GameModeManager();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,12 +20,12 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#define DECLARE_INTERFACE(iface, impl) \
|
||||
#define DECLARE_ENGINE_INTERFACE(iface, impl) \
|
||||
IInterface *__interface_alloc_##impl() \
|
||||
{ \
|
||||
return new impl; \
|
||||
}; \
|
||||
CInterfaceRegistry __interface_##name##_registry(#iface, __interface_alloc_##impl); \
|
||||
CInterfaceRegistry __interface_##iface##_registry(#iface, __interface_alloc_##impl); \
|
||||
I##iface *iface() { \
|
||||
static I##iface *pInterface = (I##iface*)__interface_alloc_##impl(); \
|
||||
return pInterface; \
|
||||
|
||||
@@ -2,11 +2,14 @@
|
||||
#define LEVEL_H
|
||||
|
||||
#include "engine.h"
|
||||
#include "interface.h"
|
||||
|
||||
interface ILevel
|
||||
interface ILevelManager: public IInterface
|
||||
{
|
||||
public:
|
||||
static void LoadLevel( const char *szLevelName );
|
||||
virtual void LoadLevel( const char *szLevelName ) = 0;
|
||||
};
|
||||
|
||||
ILevelManager *LevelManager();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef RENDERING_H
|
||||
#define RENDERING_H
|
||||
|
||||
#include "interface.h"
|
||||
#include "math3d.h"
|
||||
#include "tier0/platform.h"
|
||||
#include "tier1/utlbuffer.h"
|
||||
@@ -304,66 +305,6 @@ struct RenderingDepthAttachment_t
|
||||
EMSAAMode msaaMode;
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Manages all buffers and pipelines.
|
||||
// It is meant to be used in render pipelines
|
||||
//----------------------------------------------------------------------------
|
||||
interface IRenderer
|
||||
{
|
||||
public:
|
||||
|
||||
static IStorageBuffer *CreateStorageBuffer( uint32_t uSize );
|
||||
static IUniformBuffer *CreateUniformBuffer( uint32_t uSize );
|
||||
static IVertexBuffer *CreateVertexBuffer( uint32_t uSize );
|
||||
static IIndexBuffer *CreateIndexBuffer( uint32_t uSize );
|
||||
static IImage *CreateImage( EImageFormat format, uint32_t usage, uint32_t nWidth, uint32_t nHeight, uint32_t nSamples = 1 );
|
||||
|
||||
static void DestroyBuffer( IBuffer *pBuffer );
|
||||
static void DestroyImage( IImage *pImage );
|
||||
|
||||
static void SetConstants( uint32_t nSize, void *pData );
|
||||
static void Barrier( uint32_t stageIn, uint32_t stageOut, CUtlVector<BufferBarrier_t> buffers, CUtlVector<ImageBarrier_t> images );
|
||||
static void BindPipeline( IPipeline *pPipeline );
|
||||
|
||||
static void Begin( uint32_t nWidth, uint32_t nHeight, CUtlVector<RenderingColorAttachment_t> attachments, RenderingDepthAttachment_t depth );
|
||||
static void ResetState();
|
||||
static void SetDepthMode( EDepthMode mode );
|
||||
static void Draw( IVertexBuffer *pVertex, IIndexBuffer *pIndex );
|
||||
static void End();
|
||||
|
||||
static void Dispatch( uint32_t x, uint32_t y, uint32_t z );
|
||||
static void TraceRays( uint32_t x, uint32_t y, uint32_t z );
|
||||
|
||||
static IGraphicsPipeline *CreateGraphicsPipeline(
|
||||
CUtlVector<Shader_t> shaders,
|
||||
CUtlVector<ShaderInput_t> inputs,
|
||||
uint32_t nConstantsSize,
|
||||
uint32_t nVertexSize,
|
||||
CUtlVector<VertexAttribute_t> vertexFormat,
|
||||
CUtlVector<EImageFormat> outputFormats,
|
||||
bool bDepth
|
||||
);
|
||||
static IComputePipeline *CreateComputePipeline(
|
||||
Shader_t szShader,
|
||||
CUtlVector<ShaderInput_t> inputs,
|
||||
uint32_t nConstantsSize
|
||||
);
|
||||
|
||||
static IRayTracingPipeline *CreateRayTracingPipeline(
|
||||
CUtlVector<Shader_t> shaders,
|
||||
CUtlVector<ShaderInput_t> inputs,
|
||||
uint32_t nConstantsSize
|
||||
);
|
||||
|
||||
static IBuffer *GetCameraMatrix();
|
||||
static IImage *GetOutputImage();
|
||||
};
|
||||
|
||||
extern char g_bConfigNotify;
|
||||
extern uint32_t g_nWindowWidth;
|
||||
extern uint32_t g_nWindowHeight;
|
||||
|
||||
abstract_class IRenderingPipelineStep
|
||||
{
|
||||
public:
|
||||
@@ -372,20 +313,82 @@ public:
|
||||
virtual void Deinit() = 0;
|
||||
};
|
||||
|
||||
typedef IRenderingPipelineStep*(*CreateRenderStepFn)();
|
||||
struct RenderingStep_t
|
||||
{
|
||||
IRenderingPipelineStep *pPipeline;
|
||||
const char *szName;
|
||||
};
|
||||
|
||||
extern CUtlVector<RenderingStep_t> g_StepPrepass;
|
||||
extern CUtlVector<RenderingStep_t> g_StepMeshRendering;
|
||||
extern CUtlVector<RenderingStep_t> g_StepShading;
|
||||
extern CUtlVector<RenderingStep_t> g_StepPostProcessing;
|
||||
extern CUtlVector<RenderingStep_t> g_StepUI;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Manages all buffers and pipelines.
|
||||
// It is meant to be used in render pipelines
|
||||
//----------------------------------------------------------------------------
|
||||
interface IRenderer: public IInterface
|
||||
{
|
||||
public:
|
||||
|
||||
virtual IStorageBuffer *CreateStorageBuffer( uint32_t uSize ) = 0;
|
||||
virtual IUniformBuffer *CreateUniformBuffer( uint32_t uSize ) = 0;
|
||||
virtual IVertexBuffer *CreateVertexBuffer( uint32_t uSize ) = 0;
|
||||
virtual IIndexBuffer *CreateIndexBuffer( uint32_t uSize ) = 0;
|
||||
virtual IImage *CreateImage( EImageFormat format, uint32_t usage, uint32_t nWidth, uint32_t nHeight, uint32_t nSamples = 1 ) = 0;
|
||||
|
||||
virtual void DestroyBuffer( IBuffer *pBuffer ) = 0;
|
||||
virtual void DestroyImage( IImage *pImage ) = 0;
|
||||
|
||||
virtual void SetConstants( uint32_t nSize, void *pData ) = 0;
|
||||
virtual void Barrier( uint32_t stageIn, uint32_t stageOut, CUtlVector<BufferBarrier_t> buffers, CUtlVector<ImageBarrier_t> images ) = 0;
|
||||
virtual void BindPipeline( IPipeline *pPipeline ) = 0;
|
||||
|
||||
virtual void Begin( uint32_t nWidth, uint32_t nHeight, CUtlVector<RenderingColorAttachment_t> attachments, RenderingDepthAttachment_t depth ) = 0;
|
||||
virtual void ResetState() = 0;
|
||||
virtual void SetDepthMode( EDepthMode mode ) = 0;
|
||||
virtual void Draw( IVertexBuffer *pVertex, IIndexBuffer *pIndex ) = 0;
|
||||
virtual void End() = 0;
|
||||
|
||||
virtual void Dispatch( uint32_t x, uint32_t y, uint32_t z ) = 0;
|
||||
virtual void TraceRays( uint32_t x, uint32_t y, uint32_t z ) = 0;
|
||||
|
||||
virtual IGraphicsPipeline *CreateGraphicsPipeline(
|
||||
CUtlVector<Shader_t> shaders,
|
||||
CUtlVector<ShaderInput_t> inputs,
|
||||
uint32_t nConstantsSize,
|
||||
uint32_t nVertexSize,
|
||||
CUtlVector<VertexAttribute_t> vertexFormat,
|
||||
CUtlVector<EImageFormat> outputFormats,
|
||||
bool bDepth
|
||||
) = 0;
|
||||
virtual IComputePipeline *CreateComputePipeline(
|
||||
Shader_t szShader,
|
||||
CUtlVector<ShaderInput_t> inputs,
|
||||
uint32_t nConstantsSize
|
||||
) = 0;
|
||||
|
||||
virtual IRayTracingPipeline *CreateRayTracingPipeline(
|
||||
CUtlVector<Shader_t> shaders,
|
||||
CUtlVector<ShaderInput_t> inputs,
|
||||
uint32_t nConstantsSize
|
||||
) = 0;
|
||||
|
||||
virtual IBuffer *GetCameraMatrix() = 0;
|
||||
virtual IImage *GetOutputImage() = 0;
|
||||
|
||||
CUtlVector<RenderingStep_t> m_StepPrepass;
|
||||
CUtlVector<RenderingStep_t> m_StepMeshRendering;
|
||||
CUtlVector<RenderingStep_t> m_StepShading;
|
||||
CUtlVector<RenderingStep_t> m_StepPostProcessing;
|
||||
CUtlVector<RenderingStep_t> m_StepUI;
|
||||
};
|
||||
|
||||
IRenderer *Renderer();
|
||||
|
||||
extern char g_bConfigNotify;
|
||||
extern uint32_t g_nWindowWidth;
|
||||
extern uint32_t g_nWindowHeight;
|
||||
|
||||
|
||||
typedef IRenderingPipelineStep*(*CreateRenderStepFn)();
|
||||
class CRenderingStep
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user