no engine anymore
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
#ifndef AUDIO_H
|
||||
#define AUDIO_H
|
||||
|
||||
#include "interface.h"
|
||||
#include "tier0/platform.h"
|
||||
|
||||
abstract_class ISound
|
||||
{
|
||||
virtual void SetVolume() = 0;
|
||||
};
|
||||
|
||||
abstract_class I3DSound: public ISound
|
||||
{
|
||||
virtual void SetPosition() = 0;
|
||||
virtual void SetVelocity() = 0;
|
||||
};
|
||||
|
||||
interface IAudioManager: public IInterface
|
||||
{
|
||||
virtual ISound *CreateSound() = 0;
|
||||
virtual I3DSound *Create3DSound() = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,140 +0,0 @@
|
||||
#ifndef ENTITY_H
|
||||
#define ENTITY_H
|
||||
|
||||
#include "engine.h"
|
||||
#include "interface.h"
|
||||
#include "tier1/utlvector.h"
|
||||
#include "math3d.h"
|
||||
|
||||
class CBaseEntity;
|
||||
class C_BaseEntity;
|
||||
enum EPredictionMode {
|
||||
PREDICTION_MODE_CREATED,
|
||||
PREDICTION_MODE_DESTROYED,
|
||||
PREDICTION_MODE_NONE,
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Base server entity class.
|
||||
// It is updated every 1/tickrate (64) of a second. Does not require special
|
||||
// classes to exist.
|
||||
//-----------------------------------------------------------------------------
|
||||
class CBaseEntity
|
||||
{
|
||||
public:
|
||||
CBaseEntity();
|
||||
virtual void Precache() = 0;
|
||||
|
||||
virtual void Spawn( void ) = 0;
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
//
|
||||
//---------------------------------------------------------------------
|
||||
virtual void Destroy( void ) = 0;
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Reads the parameter from the level file. szName indicates of the
|
||||
// parameter that is sent to be deserialized. szValue is value encoded
|
||||
// as a string.
|
||||
//---------------------------------------------------------------------
|
||||
virtual void ReadParameter( const char *szName, const char *szValue );
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Update at constant rate (+-tickrate times a second).
|
||||
//---------------------------------------------------------------------
|
||||
virtual void Think( float fDelta ) = 0;
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Used to send data from an actual server.
|
||||
//---------------------------------------------------------------------
|
||||
virtual void SendToServer() = 0;
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Used to recieve data from an actual server.
|
||||
//---------------------------------------------------------------------
|
||||
virtual void RecieveFromServer( void *pData, uint32_t nDataSize ) = 0;
|
||||
|
||||
void SetPosition( vec3 position );
|
||||
void SetRotationEuler( vec3 euler );
|
||||
void SetRotationQuat( vec4 quaternion );
|
||||
void SetRotationMatrix( mat3 matrix );
|
||||
void SetScale( vec3 scale );
|
||||
|
||||
C_BaseEntity *pClientEntity = NULL;
|
||||
mat3 m_matrix;
|
||||
vec3 m_position;
|
||||
vec3 m_scale;
|
||||
|
||||
uint64_t m_id;
|
||||
EPredictionMode m_prediction;
|
||||
};
|
||||
|
||||
|
||||
typedef CBaseEntity*(*EntityRegistryFn)( void );
|
||||
typedef C_BaseEntity*(*ClientEntityRegistryFn)( void );
|
||||
|
||||
|
||||
class CEntityRegistryObject
|
||||
{
|
||||
public:
|
||||
CEntityRegistryObject( const char *szName, const char *szClass, EntityRegistryFn pfn );
|
||||
|
||||
const char *m_szName;
|
||||
const char *m_szClass;
|
||||
EntityRegistryFn m_pfn;
|
||||
ClientEntityRegistryFn m_pClientfn = 0;
|
||||
};
|
||||
|
||||
interface IEntityManager: public IInterface
|
||||
{
|
||||
public:
|
||||
CUtlVector<CBaseEntity*> m_entities;
|
||||
CUtlVector<CEntityRegistryObject*> m_RegisteredEntities;
|
||||
};
|
||||
|
||||
IEntityManager *EntityManager();
|
||||
|
||||
|
||||
#define DECLARE_ENTITY(name, class) \
|
||||
CBaseEntity *__entity_alloc_##name() \
|
||||
{ \
|
||||
return new class; \
|
||||
}; \
|
||||
CEntityRegistryObject __entity_##name##_registry(#name, #class, __entity_alloc_##name); \
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Base client entity class.
|
||||
// It uses server data directly.
|
||||
//-----------------------------------------------------------------------------
|
||||
class C_BaseEntity
|
||||
{
|
||||
public:
|
||||
CBaseEntity *pEntity;
|
||||
|
||||
virtual void Precache() = 0;
|
||||
virtual void Spawn( void ) = 0;
|
||||
virtual void Destroy( void ) = 0;
|
||||
virtual void Think( float fDelta ) = 0;
|
||||
private:
|
||||
};
|
||||
|
||||
interface C_EntityRegistry
|
||||
{
|
||||
public:
|
||||
C_EntityRegistry( const char *pName, ClientEntityRegistryFn pfn );
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Server-Client sync for entities. When new server entity is created, client
|
||||
// entity gets created as well.
|
||||
//-----------------------------------------------------------------------------
|
||||
#define LINK_CLIENT_ENTITY(client, server) \
|
||||
C_BaseEntity *__c_entity_alloc_##server() \
|
||||
{ \
|
||||
return new client; \
|
||||
}; \
|
||||
C_EntityRegistry __c_entity_##server##_registry(#server, __c_entity_alloc_##server); \
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,14 +0,0 @@
|
||||
#ifndef BASE_PLAYER_H
|
||||
#define BASE_PLAYER_H
|
||||
|
||||
#include "baseentity.h"
|
||||
#include "playerstart.h"
|
||||
class CBaseEntity;
|
||||
|
||||
class CBasePlayer: public CBaseEntity
|
||||
{
|
||||
public:
|
||||
CPlayerStart *pOwningSpawn;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,59 +0,0 @@
|
||||
#ifndef BRUSH_H
|
||||
#define BRUSH_H
|
||||
|
||||
#include "tier1/utlvector.h"
|
||||
#include "rendering.h"
|
||||
#include "baseentity.h"
|
||||
#include "physics.h"
|
||||
#include "mesh.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Basic triangle structure which is used in brush entities.
|
||||
//-----------------------------------------------------------------------------
|
||||
struct Triangle_t
|
||||
{
|
||||
float location[9];
|
||||
float uv[6];
|
||||
float normal[9];
|
||||
uint32_t texture;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Basic brush entity which has its own geometry defined.
|
||||
// They have constant position, shape, and rotation, so it makes them
|
||||
// non-interactable with the game world in terms of ability to modify it at
|
||||
// runtime. Collisions are precise.
|
||||
//-----------------------------------------------------------------------------
|
||||
class CBrushEntity: public CBaseEntity
|
||||
{
|
||||
public:
|
||||
virtual void Precache ( void ) override;
|
||||
virtual void Spawn( void ) override;
|
||||
virtual void ReadParameter( const char *szName, const char *szValue ) override;
|
||||
virtual void Destroy( void ) override;
|
||||
virtual void Think( float fDelta ) override;
|
||||
virtual void SendToServer() override;
|
||||
virtual void RecieveFromServer( void *pData, uint32_t nDataSize ) override;
|
||||
|
||||
CUtlVector<Triangle_t> m_mesh;
|
||||
Collider *m_collider;
|
||||
RigidBodyHandle *m_body;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Client rendering for brush entitites.
|
||||
//-----------------------------------------------------------------------------
|
||||
class C_BrushEntity: public C_BaseEntity
|
||||
{
|
||||
public:
|
||||
virtual void Precache ( void ) override;
|
||||
virtual void Spawn( void ) override;
|
||||
virtual void Destroy( void ) override;
|
||||
virtual void Think( float fDelta ) override;
|
||||
|
||||
IVertexBuffer *vertexBuffer;
|
||||
IIndexBuffer *indexBuffer;
|
||||
IMesh *mesh;
|
||||
};
|
||||
|
||||
#endif
|
||||
0
public/cl_dll.h
Normal file
0
public/cl_dll.h
Normal file
@@ -1,13 +0,0 @@
|
||||
#ifndef CLIENT_H
|
||||
#define CLIENT_H
|
||||
|
||||
#include "tier0/platform.h"
|
||||
|
||||
interface IClient
|
||||
{
|
||||
void LoadGame( const char *psz );
|
||||
void Frame( float flDelta );
|
||||
void UnloadGame( const char *psz );
|
||||
};
|
||||
|
||||
#endif
|
||||
133
public/console.h
133
public/console.h
@@ -1,133 +0,0 @@
|
||||
#ifndef CONSOLE_H
|
||||
#define CONSOLE_H
|
||||
|
||||
#include "engine.h"
|
||||
#include "interface.h"
|
||||
#include "tier1/utlstring.h"
|
||||
#include "tier1/utlvector.h"
|
||||
|
||||
class ConVar;
|
||||
class ConCommand;
|
||||
|
||||
typedef void(*ConCommandFn)(int argc, char **argv);
|
||||
|
||||
interface IConsoleUI
|
||||
{
|
||||
public:
|
||||
static void Init();
|
||||
static void Frame();
|
||||
static void Deinit();
|
||||
|
||||
static void SetVisibility(bool bIsVisisble);
|
||||
static bool IsVisibile();
|
||||
};
|
||||
|
||||
interface IConsole: public IInterface
|
||||
{
|
||||
public:
|
||||
virtual void Init() = 0;
|
||||
virtual void Frame() = 0;
|
||||
virtual void Deinit() = 0;
|
||||
|
||||
// Variables
|
||||
virtual void RegisterVar( ConVar *cvar ) = 0;
|
||||
virtual void UnRegisterVar( ConVar *cvar ) = 0;
|
||||
virtual ConVar *FindVar( const char *pName ) = 0;
|
||||
|
||||
// Commands
|
||||
virtual void RegisterCommand( ConCommand *cvar ) = 0;
|
||||
virtual void UnRegisterCommand( ConCommand *cvar ) = 0;
|
||||
virtual ConCommand *FindCommand( const char *pName ) = 0;
|
||||
|
||||
// Command buffer
|
||||
virtual void Execute( void ) = 0;
|
||||
virtual void ExecuteArguments( CUtlVector<CUtlString> &args ) = 0;
|
||||
virtual CUtlVector<CUtlVector<CUtlString>> ParseCommandLine( CUtlString psz ) = 0;
|
||||
|
||||
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
|
||||
#define FCVAR_GAMEDLL 0x2
|
||||
#define FCVAR_CLIENTDLL 0x4
|
||||
#define FCVAR_HIDDEN 0x8
|
||||
|
||||
#define FCVAR_PROTECTED 0x10
|
||||
#define FCVAR_SPONLY 0x20
|
||||
#define FCVAR_ARCHIVE 0x40
|
||||
#define FCVAR_NOTIFY 0x80
|
||||
#define FCVAR_CHEAT 0x100
|
||||
#define FCVAR_REPLICATED 0x200
|
||||
|
||||
class ConVar
|
||||
{
|
||||
public:
|
||||
ConVar( const char *pName, const char *pDefaultValue, int flags );
|
||||
ConVar( const char *pName, const char *pDefaultValue, int flags,
|
||||
const char *pHelpString );
|
||||
ConVar( const char *pName, const char *pDefaultValue, int flags,
|
||||
const char *pHelpString, ConCommandFn callback );
|
||||
|
||||
bool IsFlagSet( int flag );
|
||||
const char *GetHelpText( void );
|
||||
bool IsRegistered( void );
|
||||
const char *GetName( void );
|
||||
void AddFlags( int flags );
|
||||
bool IsCommand( void );
|
||||
|
||||
void InstallChangeCallback( ConCommandFn );
|
||||
|
||||
float GetFloat( void );
|
||||
int GetInt( void );
|
||||
bool GetBool( void );
|
||||
const char *GetString( void );
|
||||
|
||||
void SetValue( const char *szValue );
|
||||
void SetValue( float fValue );
|
||||
void SetValue( int iValue );
|
||||
private:
|
||||
CUtlString m_szName;
|
||||
CUtlString m_szHelpString;
|
||||
CUtlString m_szDefaultValue;
|
||||
|
||||
CUtlString m_szValue;
|
||||
float m_fValue;
|
||||
int m_nValue;
|
||||
|
||||
int m_flags;
|
||||
};
|
||||
|
||||
|
||||
class ConCommand
|
||||
{
|
||||
public:
|
||||
ConCommand(const char *pName, ConCommandFn callback,
|
||||
const char *pHelpString=0, int flags=0);
|
||||
|
||||
const char *GetName( void );
|
||||
const char *GetHelpText( void );
|
||||
ConCommandFn GetCallback( void );
|
||||
private:
|
||||
CUtlString m_szName;
|
||||
CUtlString m_szHelpString = NULL;
|
||||
ConCommandFn m_callback;
|
||||
|
||||
int m_flags;
|
||||
};
|
||||
|
||||
#undef V_printf
|
||||
#define V_printf(...) Msg(CUtlString(__VA_ARGS__).GetString())
|
||||
|
||||
void Msg( const char* message );
|
||||
void Warning( const char* message );
|
||||
void Error( const char* message );
|
||||
|
||||
#endif
|
||||
@@ -1,36 +0,0 @@
|
||||
#ifndef ENGINE_H
|
||||
#define ENGINE_H
|
||||
|
||||
/* for windows as it sucks */
|
||||
#include "tier0/platform.h"
|
||||
#include "server.h"
|
||||
#include "tier1/utlvector.h"
|
||||
|
||||
class CBaseEntity;
|
||||
|
||||
interface IEngine
|
||||
{
|
||||
public:
|
||||
static void Init();
|
||||
static void Frame(float fDelta);
|
||||
static void Shutdown();
|
||||
};
|
||||
|
||||
extern IIClient *g_localClient;
|
||||
extern CUtlVector<IIClient*> g_clients;
|
||||
|
||||
|
||||
interface IIEngine
|
||||
{
|
||||
public:
|
||||
static CBaseEntity *SpawnEntity( const char *szName );
|
||||
static void InitEntity(CBaseEntity *pEntity);
|
||||
static void DestroyEntity( CBaseEntity *pEntity );
|
||||
static void ConnectClient( IIClient *pClient );
|
||||
static void DisconnectClient( IIClient *pClient );
|
||||
static void DisconnectClient( uint64_t playerID );
|
||||
static void DisconnectClientByHandle( uint32_t playerHandle );
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1 +0,0 @@
|
||||
#include "widget.h"
|
||||
@@ -1,48 +0,0 @@
|
||||
#ifndef FGUI_H
|
||||
#define FGUI_H
|
||||
|
||||
#include "rendering.h"
|
||||
#include "tier0/platform.h"
|
||||
#include "tier1/utlstring.h"
|
||||
|
||||
class CFGUI_Widget;
|
||||
|
||||
struct FGUI_Event_t
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
class CFont
|
||||
{
|
||||
public:
|
||||
CUtlString szName;
|
||||
ITexture *pTexture;
|
||||
uint32_t glyphWidth;
|
||||
uint32_t glyphHeight;
|
||||
uint32_t nGlyphsPerRow;
|
||||
uint32_t nGlyphsPerColumn;
|
||||
char cCharacterSet[256];
|
||||
};
|
||||
|
||||
interface IFGUI
|
||||
{
|
||||
public:
|
||||
static void Init( void );
|
||||
static void Frame( void );
|
||||
static void AppendWidget( CFGUI_Widget *pWidget );
|
||||
static void DestroyWidget( CFGUI_Widget *pWidget );
|
||||
static void AddOffset( float x, float y);
|
||||
static void ResetOffset();
|
||||
|
||||
static void SetRectColor( float r, float g, float b, float a );
|
||||
static void DrawRect( int32_t iPosX, int32_t iPosY, uint32_t uSizeX, uint32_t uSizeY );
|
||||
|
||||
static CFont *LoadFont( CUtlString szFontPath );
|
||||
static void SetTextFont( CFont *pFont );
|
||||
static void SetTextPos( float x, float y );
|
||||
static void SetGlyphScale( float x, float y );
|
||||
static void SetTextColor( float r, float g, float b, float a );
|
||||
static void DrawText( CUtlString psz );
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,31 +0,0 @@
|
||||
#ifndef FGUI_LABEL_H
|
||||
#define FGUI_LABEL_H
|
||||
#include "widget.h"
|
||||
#include "tier1/utlstring.h"
|
||||
#include "rendering.h"
|
||||
|
||||
class CFGUI_Label: public CFGUI_Widget
|
||||
{
|
||||
public:
|
||||
CFGUI_Label();
|
||||
~CFGUI_Label();
|
||||
|
||||
|
||||
void SetFont( CUtlString font );
|
||||
void SetColor( float r, float g, float b );
|
||||
void SetLabel( CUtlString text );
|
||||
void SetGlyphSize( uint32_t nSize );
|
||||
void SetGlyphSize( uint32_t nSizeX, uint32_t nSizeY );
|
||||
|
||||
virtual void Event( FGUI_Event_t event ) override;
|
||||
virtual void Draw() override;
|
||||
virtual void Frame() override;
|
||||
|
||||
private:
|
||||
CUtlString m_szText;
|
||||
float m_fLabelColor[3];
|
||||
float m_fGlyphScale[2] = {1,1};
|
||||
CFont *m_pFont;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,17 +0,0 @@
|
||||
#ifndef FGUI_RECT_H
|
||||
#define FGUI_RECT_H
|
||||
#include "widget.h"
|
||||
|
||||
class CFGUI_Rect: public CFGUI_Widget
|
||||
{
|
||||
public:
|
||||
void SetBoxColor( float r, float g, float b, float a );
|
||||
|
||||
virtual void Event( FGUI_Event_t event ) override;
|
||||
virtual void Draw() override;
|
||||
virtual void Frame() override;
|
||||
|
||||
float m_fBoxColor[4];
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,33 +0,0 @@
|
||||
#ifndef FGUI_WIDGET_H
|
||||
#define FGUI_WIDGET_H
|
||||
|
||||
#include "tier0/platform.h"
|
||||
#include "fgui.h"
|
||||
#include <cstdint>
|
||||
|
||||
class CFGUI_Widget
|
||||
{
|
||||
public:
|
||||
CFGUI_Widget();
|
||||
CFGUI_Widget(CFGUI_Widget *pParent);
|
||||
~CFGUI_Widget();
|
||||
|
||||
void SetPosition( int32_t nX, int32_t nY );
|
||||
void SetSize( uint32_t nX, uint32_t nY );
|
||||
void SetParent( CFGUI_Widget *pParent );
|
||||
|
||||
void ComputeOffset( );
|
||||
bool IsVisible( );
|
||||
|
||||
virtual void Event( FGUI_Event_t event ) = 0;
|
||||
virtual void Draw() = 0;
|
||||
virtual void Frame() = 0;
|
||||
virtual void SetVisibility( bool bValue );
|
||||
|
||||
int32_t m_iPosition[2] = {0, 0};
|
||||
uint32_t m_iSize[2] = {0, 0};
|
||||
CFGUI_Widget *m_pParent = NULL;
|
||||
bool m_bIsVisible = true;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,45 +0,0 @@
|
||||
#ifndef FILESYSTEM_H
|
||||
#define FILESYSTEM_H
|
||||
#include "tier0/platform.h"
|
||||
#include "tier1/utlbuffer.h"
|
||||
#include "tier1/utlstring.h"
|
||||
#include "interface.h"
|
||||
|
||||
enum EFileOptions
|
||||
{
|
||||
IFILE_READ,
|
||||
IFILE_WRITE,
|
||||
IFILE_APPEND
|
||||
};
|
||||
|
||||
typedef struct FileHandle_s
|
||||
{
|
||||
FILE *file;
|
||||
FILE *parent;
|
||||
EFileOptions options;
|
||||
size_t nSize;
|
||||
size_t nOffset;
|
||||
size_t nPtr;
|
||||
} *FileHandle_t;
|
||||
|
||||
interface IFileSystem: public IInterface
|
||||
{
|
||||
public:
|
||||
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
|
||||
26
public/funnyformat.h
Normal file
26
public/funnyformat.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef FUNNY_FORMAT_H
|
||||
#define FUNNY_FORMAT_H
|
||||
|
||||
#include "tier0/platform.h"
|
||||
#include "ifilesystem.h"
|
||||
#include "tier1/utlvector.h"
|
||||
|
||||
struct FunnyFormatParameter_t
|
||||
{
|
||||
const char *szName;
|
||||
uint32_t nDataSize;
|
||||
void *pData;
|
||||
};
|
||||
|
||||
struct FunnyFormatData_t
|
||||
{
|
||||
};
|
||||
|
||||
abstract_class IFunnyFormatManager
|
||||
{
|
||||
public:
|
||||
virtual FunnyFormatData_t ReadFile( IFileHandle *pHandle ) = 0;
|
||||
virtual void WriteFile( IFileHandle *pHandle, FunnyFormatData_t data ) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,46 +0,0 @@
|
||||
#ifndef GAMEMODE_H
|
||||
#define GAMEMODE_H
|
||||
|
||||
#include "interface.h"
|
||||
#include "tier0/platform.h"
|
||||
#include "tier1/utlvector.h"
|
||||
|
||||
class CGameMode
|
||||
{
|
||||
public:
|
||||
virtual void RoundBegin( void );
|
||||
virtual void RoundEnd( void );
|
||||
bool bCanPlayerSpawnMidRound;
|
||||
};
|
||||
|
||||
|
||||
typedef CGameMode*(*GameModeRegistryFn)();
|
||||
class CGameModeRegistry
|
||||
{
|
||||
public:
|
||||
CGameModeRegistry( const char *szName, GameModeRegistryFn pfn );
|
||||
const char *m_szName;
|
||||
GameModeRegistryFn m_pfn;
|
||||
};
|
||||
|
||||
#define DECLARE_GAME_MODE( class, name ) \
|
||||
CGameMode *__gamemode_alloc_##name() \
|
||||
{ \
|
||||
return new class; \
|
||||
}; \
|
||||
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
|
||||
17
public/iappsystem.h
Normal file
17
public/iappsystem.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef APP_SYSTEM_H
|
||||
#define APP_SYSTEM_H
|
||||
|
||||
#include "tier1/interface.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// App system is a module which has different applications based on the user's system.
|
||||
// For example rendering could use either Vulkan or Metal based on the system.
|
||||
//----------------------------------------------------------------------------
|
||||
abstract_class IAppSystem
|
||||
{
|
||||
public:
|
||||
virtual void Init() = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
0
public/icvar.h
Normal file
0
public/icvar.h
Normal file
71
public/ifilesystem.h
Normal file
71
public/ifilesystem.h
Normal file
@@ -0,0 +1,71 @@
|
||||
#ifndef FILESYSTEM_H
|
||||
#define FILESYSTEM_H
|
||||
|
||||
#include "iappsystem.h"
|
||||
#include "tier0/platform.h"
|
||||
|
||||
#define FILESYSTEM_INTERFACE_NAME "FileSystem001"
|
||||
#define FILESYSTEM_BACKEND_INTERFACE_NAME "FileSystemBackend001"
|
||||
#define FILESYSTEM_PAK_INTERFACE_NAME "FileSystemPAK001"
|
||||
|
||||
enum EFileMode
|
||||
{
|
||||
FILEMODE_READ = 0x01,
|
||||
FILEMODE_WRITE = 0x02,
|
||||
FILEMODE_APPEND = 0x04,
|
||||
};
|
||||
|
||||
enum EFileType {
|
||||
FILETYPE_NONE,
|
||||
FILETYPE_SYSTEM,
|
||||
FILETYPE_PAK,
|
||||
};
|
||||
|
||||
enum ESeekMode
|
||||
{
|
||||
SEEKMODE_SET,
|
||||
SEEKMODE_RELATIVE_START,
|
||||
SEEKMODE_RELATIVE_END,
|
||||
};
|
||||
|
||||
abstract_class IFileSystem;
|
||||
|
||||
class IFileHandle
|
||||
{
|
||||
public:
|
||||
IFileSystem *m_pFileSystem;
|
||||
|
||||
size_t Write( const void *pData, size_t nDataSize );
|
||||
size_t Read( void *pData, size_t nDataSize );
|
||||
size_t Seek( ESeekMode eSeekMode, size_t nOffset );
|
||||
size_t Tell( void );
|
||||
void Close( void );
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// IFileSystem is an app system which manages files, could have different
|
||||
// file systems etc. Because of that there is base file system which manages
|
||||
// others. PAK files are opened first, then mounted stuff comes second and
|
||||
// host's system last.
|
||||
//----------------------------------------------------------------------------
|
||||
abstract_class IFileSystem: public IAppSystem
|
||||
{
|
||||
public:
|
||||
virtual IFileHandle *Open( const char *szFileName, int eOpCode ) = 0;
|
||||
virtual size_t Write( IFileHandle *pFile, const void *pData, size_t nDataSize ) = 0;
|
||||
virtual size_t Read( IFileHandle *pFile, void *pData, size_t nDataSize ) = 0;
|
||||
|
||||
virtual size_t Seek( IFileHandle *pFile, ESeekMode eSeekMode, size_t nOffset ) = 0;
|
||||
virtual size_t Tell( IFileHandle *pFile ) = 0;
|
||||
|
||||
virtual void Close( IFileHandle *pFile ) = 0;
|
||||
};
|
||||
|
||||
extern IFileSystem *filesystem;
|
||||
extern IFileSystem *filesystem_backend;
|
||||
extern IFileSystem *filesystem_pak;
|
||||
|
||||
#endif
|
||||
0
public/igamesystem.h
Normal file
0
public/igamesystem.h
Normal file
18
public/igamewindow.h
Normal file
18
public/igamewindow.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef GAME_WINDOW_H
|
||||
#define GAME_WINDOW_H
|
||||
|
||||
#include "iappsystem.h"
|
||||
#include "tier0/platform.h"
|
||||
|
||||
#define GAME_WINDOW_INTERFACE_NAME "GameWindow001"
|
||||
#define GAME_SDL_WINDOW_INTERFACE_NAME "SDLGameWindow001"
|
||||
|
||||
abstract_class IGameWindow: public IAppSystem
|
||||
{
|
||||
public:
|
||||
virtual void UpdateWindow() = 0;
|
||||
};
|
||||
|
||||
extern IGameWindow *gamewindow;
|
||||
|
||||
#endif
|
||||
0
public/inetworkclient.h
Normal file
0
public/inetworkclient.h
Normal file
0
public/inetworkserver.h
Normal file
0
public/inetworkserver.h
Normal file
136
public/input.h
136
public/input.h
@@ -1,136 +0,0 @@
|
||||
#ifndef INPUT_H
|
||||
#define INPUT_H
|
||||
|
||||
#include "interface.h"
|
||||
#include "tier0/platform.h"
|
||||
#include "tier1/utlvector.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Keys include mouse buttons and gamepad buttons as well.
|
||||
// KEY_NONE and AXIS_NONE are garbage, so don't rely on them
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
enum EKeyEventType
|
||||
{
|
||||
KEY_EVENT_TYPE_DOWN,
|
||||
KEY_EVENT_TYPE_UP,
|
||||
};
|
||||
|
||||
enum EInputKey
|
||||
{
|
||||
KEY_NONE = 0,
|
||||
|
||||
KEY_MOUSE_BUTTON_0,
|
||||
KEY_MOUSE_BUTTON_1,
|
||||
KEY_MOUSE_BUTTON_2,
|
||||
KEY_MOUSE_BUTTON_3,
|
||||
KEY_MOUSE_BUTTON_4,
|
||||
|
||||
KEY_ESCAPE,
|
||||
KEY_TAB,
|
||||
KEY_TILDE,
|
||||
KEY_CAPSLOCK,
|
||||
KEY_CONTROL,
|
||||
KEY_SHIFT,
|
||||
KEY_WIN,
|
||||
KEY_ALT,
|
||||
KEY_SPACE,
|
||||
|
||||
KEY_BACKSPACE,
|
||||
KEY_LBRACKET,
|
||||
KEY_RBRACKET,
|
||||
KEY_BACKSLASH,
|
||||
KEY_SEMICOLON,
|
||||
KEY_APOSTROPHE,
|
||||
KEY_SLASH,
|
||||
KEY_ENTER,
|
||||
|
||||
KEY_F1,
|
||||
KEY_F2,
|
||||
KEY_F3,
|
||||
KEY_F4,
|
||||
KEY_F5,
|
||||
KEY_F6,
|
||||
KEY_F7,
|
||||
KEY_F8,
|
||||
KEY_F9,
|
||||
KEY_F10,
|
||||
KEY_F11,
|
||||
KEY_F12,
|
||||
|
||||
KEY_1,
|
||||
KEY_2,
|
||||
KEY_3,
|
||||
KEY_4,
|
||||
KEY_5,
|
||||
KEY_6,
|
||||
KEY_7,
|
||||
KEY_8,
|
||||
KEY_9,
|
||||
KEY_0,
|
||||
|
||||
KEY_A,
|
||||
KEY_B,
|
||||
KEY_C,
|
||||
KEY_D,
|
||||
KEY_E,
|
||||
KEY_F,
|
||||
KEY_G,
|
||||
KEY_H,
|
||||
KEY_I,
|
||||
KEY_J,
|
||||
KEY_K,
|
||||
KEY_L,
|
||||
KEY_M,
|
||||
KEY_N,
|
||||
KEY_O,
|
||||
KEY_P,
|
||||
KEY_Q,
|
||||
KEY_R,
|
||||
KEY_S,
|
||||
KEY_T,
|
||||
KEY_U,
|
||||
KEY_V,
|
||||
KEY_W,
|
||||
KEY_X,
|
||||
KEY_Y,
|
||||
KEY_Z,
|
||||
KEY_MAX,
|
||||
KEY_NUM_KEYS = KEY_MAX - 1,
|
||||
};
|
||||
|
||||
enum EInputAxis
|
||||
{
|
||||
AXIS_NONE,
|
||||
AXIS_MOUSE_X,
|
||||
AXIS_MOUSE_Y,
|
||||
AXIS_MOUSE_SCROLL,
|
||||
AXIS_CONTROLLER_PITCH,
|
||||
AXIS_CONTROLLER_YAW,
|
||||
AXIS_MAX,
|
||||
AXIS_NUM_AXIS = AXIS_MAX,
|
||||
};
|
||||
|
||||
enum EInputMode
|
||||
{
|
||||
INPUT_MODE_GAME,
|
||||
INPUT_MODE_MENU,
|
||||
INPUT_MODE_CONSOLE,
|
||||
INPUT_MODE_INPUT_FIELD,
|
||||
};
|
||||
|
||||
extern CUtlVector<EInputMode> g_inputModeStack;
|
||||
|
||||
interface IInput: public IInterface
|
||||
{
|
||||
public:
|
||||
virtual void KeyEvent( EInputKey key, EKeyEventType event ) = 0;
|
||||
virtual void AxisEvent( EInputAxis axis, float fValue ) = 0;
|
||||
virtual void SetInputMode( EInputMode mode );
|
||||
};
|
||||
|
||||
IInput *Input();
|
||||
|
||||
extern float g_fAxisValues[AXIS_NUM_AXIS];
|
||||
|
||||
#endif
|
||||
@@ -1,34 +0,0 @@
|
||||
#ifndef INTERFACE_H
|
||||
#define INTERFACE_H
|
||||
|
||||
#include "tier0/platform.h"
|
||||
|
||||
abstract_class IInterface
|
||||
{
|
||||
public:
|
||||
virtual void Init() = 0;
|
||||
virtual void Frame() = 0;
|
||||
virtual void Deinit() = 0;
|
||||
};
|
||||
|
||||
typedef IInterface*( *InterfaceRegistryFn )( void );
|
||||
|
||||
class CInterfaceRegistry
|
||||
{
|
||||
public:
|
||||
CInterfaceRegistry( const char *szName, InterfaceRegistryFn pfn );
|
||||
};
|
||||
|
||||
|
||||
#define DECLARE_ENGINE_INTERFACE(iface, impl) \
|
||||
IInterface *__interface_alloc_##impl() \
|
||||
{ \
|
||||
return new impl; \
|
||||
}; \
|
||||
CInterfaceRegistry __interface_##iface##_registry(#iface, __interface_alloc_##impl); \
|
||||
I##iface *iface() { \
|
||||
static I##iface *pInterface = (I##iface*)__interface_alloc_##impl(); \
|
||||
return pInterface; \
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,15 +0,0 @@
|
||||
#ifndef LEVEL_H
|
||||
#define LEVEL_H
|
||||
|
||||
#include "engine.h"
|
||||
#include "interface.h"
|
||||
|
||||
interface ILevelManager: public IInterface
|
||||
{
|
||||
public:
|
||||
virtual void LoadLevel( const char *szLevelName ) = 0;
|
||||
};
|
||||
|
||||
ILevelManager *LevelManager();
|
||||
|
||||
#endif
|
||||
@@ -1,18 +0,0 @@
|
||||
#ifndef MAIN_MENU_H
|
||||
#define MAIN_MENU_H
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
interface IMainMenu: public IInterface
|
||||
{
|
||||
public:
|
||||
virtual void Init() override {}
|
||||
virtual void Frame() override {}
|
||||
virtual void Deinit() override {}
|
||||
|
||||
virtual void SetVisibility( bool bIsVisible ) = 0;
|
||||
};
|
||||
|
||||
extern IMainMenu *MainMenu();
|
||||
|
||||
#endif
|
||||
25
public/materialsystem/icomputeshader.h
Normal file
25
public/materialsystem/icomputeshader.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef MATERIAL_COMPUTE_SHADER_H
|
||||
#define MATERIAL_COMPUTE_SHADER_H
|
||||
|
||||
#include "ishader.h"
|
||||
|
||||
enum EShaderOutput {
|
||||
SHADER_TEXTURE0,
|
||||
SHADER_TEXTURE1,
|
||||
SHADER_TEXTURE2,
|
||||
SHADER_TEXTURE3,
|
||||
SHADER_TEXTURE4,
|
||||
SHADER_TEXTURE5,
|
||||
SHADER_TEXTURE6,
|
||||
SHADER_TEXTURE7,
|
||||
|
||||
SHADER_DEPTH,
|
||||
};
|
||||
|
||||
abstract_class IComputeShader : public IShader
|
||||
{
|
||||
public:
|
||||
virtual void SetShaderSource( const char *szPath ) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
0
public/materialsystem/imaterial.h
Normal file
0
public/materialsystem/imaterial.h
Normal file
85
public/materialsystem/imaterialsystem.h
Normal file
85
public/materialsystem/imaterialsystem.h
Normal file
@@ -0,0 +1,85 @@
|
||||
#ifndef MATERIAL_SYSTEM_H
|
||||
#define MATERIAL_SYSTEM_H
|
||||
|
||||
#include "tier0/platform.h"
|
||||
|
||||
|
||||
abstract_class IRenderingObject
|
||||
{
|
||||
public:
|
||||
virtual void SetDebugName( const char *szName ) = 0;
|
||||
};
|
||||
|
||||
abstract_class IBuffer : public IRenderingObject
|
||||
{
|
||||
public:
|
||||
virtual void Lock() = 0;
|
||||
virtual void Unlock() = 0;
|
||||
virtual void *Map() = 0;
|
||||
virtual void Unmap() = 0;
|
||||
};
|
||||
|
||||
abstract_class IVertexBuffer : public IBuffer
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
abstract_class IIndexBuffer : public IBuffer
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
abstract_class IMesh
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
|
||||
|
||||
enum EImageFormat
|
||||
{
|
||||
IMAGE_FORMAT_R8_UINT,
|
||||
IMAGE_FORMAT_RGBA8_UNORM,
|
||||
IMAGE_FORMAT_BGRA8_UNORM,
|
||||
IMAGE_FORMAT_RGBA8_UINT,
|
||||
IMAGE_FORMAT_RGBA8_SINT,
|
||||
IMAGE_FORMAT_RGBA16_SFLOAT,
|
||||
IMAGE_FORMAT_RGBA32_SFLOAT,
|
||||
|
||||
IMAGE_FORMAT_D32_SFLOAT,
|
||||
};
|
||||
|
||||
enum EMultisampleType
|
||||
{
|
||||
MULTISAMPLE_TYPE_NONE,
|
||||
MULTISAMPLE_TYPE_2_SAMPLES,
|
||||
MULTISAMPLE_TYPE_4_SAMPLES,
|
||||
MULTISAMPLE_TYPE_8_SAMPLES,
|
||||
};
|
||||
|
||||
abstract_class IImage : public IRenderingObject
|
||||
{
|
||||
public:
|
||||
virtual void BlitTo( IImage *pImage );
|
||||
};
|
||||
abstract_class IRenderContext
|
||||
{
|
||||
public:
|
||||
virtual IVertexBuffer *CreateVertexBuffer( uint32_t nSize ) = 0;
|
||||
virtual IIndexBuffer *CreateIndexBuffer( uint32_t nSize ) = 0;
|
||||
virtual IImage *CreateRenderTarget( uint32_t x, uint32_t y, EImageFormat eFormat, EMultisampleType eMultisampleType );
|
||||
virtual IImage *CreateStorageImage( uint32_t x, uint32_t y, EImageFormat eFormat, EMultisampleType eMultisampleType );
|
||||
|
||||
virtual void DestroyBuffer( IBuffer *pBuffer );
|
||||
virtual void DestroyImage( IImage *pImage );
|
||||
};
|
||||
|
||||
abstract_class IMaterialSystem
|
||||
{
|
||||
public:
|
||||
IRenderContext *GetRenderContext();
|
||||
};
|
||||
|
||||
extern IMaterialSystem *materials;
|
||||
|
||||
#endif
|
||||
10
public/materialsystem/ipipeline.h
Normal file
10
public/materialsystem/ipipeline.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef MATERIAL_PIPELINE_H
|
||||
#define MATERIAL_PIPELINE_H
|
||||
|
||||
#include "tier0/platform.h"
|
||||
abstract_class IPipeline
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
#endif
|
||||
27
public/materialsystem/irastershader.h
Normal file
27
public/materialsystem/irastershader.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef MATERIAL_RASTER_SHADER_H
|
||||
#define MATERIAL_RASTER_SHADER_H
|
||||
|
||||
#include "ishader.h"
|
||||
|
||||
enum EShaderOutput {
|
||||
SHADER_TEXTURE0,
|
||||
SHADER_TEXTURE1,
|
||||
SHADER_TEXTURE2,
|
||||
SHADER_TEXTURE3,
|
||||
SHADER_TEXTURE4,
|
||||
SHADER_TEXTURE5,
|
||||
SHADER_TEXTURE6,
|
||||
SHADER_TEXTURE7,
|
||||
|
||||
SHADER_DEPTH,
|
||||
};
|
||||
|
||||
abstract_class IRasterShader : public IShader
|
||||
{
|
||||
public:
|
||||
virtual void SetVertexShader( const char *szPath ) = 0;
|
||||
virtual void SetPixelShader( const char *szPath ) = 0;
|
||||
virtual void EnableTexture( EShaderOutput eTextureID, bool bEnabled ) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
0
public/materialsystem/iraytracingshader.h
Normal file
0
public/materialsystem/iraytracingshader.h
Normal file
36
public/materialsystem/ishader.h
Normal file
36
public/materialsystem/ishader.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef MATERIAL_SHADER_H
|
||||
#define MATERIAL_SHADER_H
|
||||
|
||||
#include "tier0/platform.h"
|
||||
|
||||
enum EShaderInputType
|
||||
{
|
||||
SHADER_INPUT_TYPE_POINTER,
|
||||
|
||||
SHADER_INPUT_TYPE_INT,
|
||||
|
||||
SHADER_INPUT_TYPE_FLOAT,
|
||||
SHADER_INPUT_TYPE_FLOAT2,
|
||||
SHADER_INPUT_TYPE_FLOAT3,
|
||||
SHADER_INPUT_TYPE_FLOAT4,
|
||||
|
||||
SHADER_INPUT_TYPE_MATRIX,
|
||||
|
||||
SHADER_INPUT_TYPE_IMAGE,
|
||||
SHADER_INPUT_TYPE_TEXTURE,
|
||||
|
||||
SHADER_INPUT_TYPE_MODEL,
|
||||
};
|
||||
|
||||
abstract_class IShader
|
||||
{
|
||||
public:
|
||||
virtual void CreateShaderParameter( const char *szName, uint32_t binding, EShaderInputType eType, bool bArray ) = 0;
|
||||
virtual void CreateMaterialParameter( const char *szName, uint32_t binding, EShaderInputType eType, bool bArray ) = 0;
|
||||
virtual void CreateConstants( uint32_t nSize ) = 0;
|
||||
|
||||
virtual void SetShaderParameter( const char *szName, void *pData ) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
#ifndef MATH_3D_H
|
||||
#define MATH_3D_H
|
||||
#include "tier0/minmax_off.h"
|
||||
#include "cglm/cglm.h"
|
||||
#include "cglm/affine.h"
|
||||
#include "cglm/mat4.h"
|
||||
#include "cglm/mat3.h"
|
||||
#include "cglm/mat2.h"
|
||||
#include "tier0/minmax.h"
|
||||
|
||||
#define PX_GLM_VEC3(v) (px_vec3){v[0], v[1], v[2]}
|
||||
#endif
|
||||
@@ -1,39 +0,0 @@
|
||||
#include "rendering.h"
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Mesh instance used in rendering.
|
||||
//----------------------------------------------------------------------------
|
||||
abstract_class IMeshInstance
|
||||
{
|
||||
public:
|
||||
virtual void SetPosition( vec3 position ) = 0;
|
||||
virtual void SetRotationEuler( vec3 angle ) = 0;
|
||||
virtual void SetRotationQuat( vec4 quaternion) = 0;
|
||||
virtual void SetMatrix( mat4 matrix ) = 0;
|
||||
virtual void SetScale( vec3 scale ) = 0;
|
||||
|
||||
virtual void Draw() = 0;
|
||||
};
|
||||
|
||||
|
||||
abstract_class IMesh
|
||||
{
|
||||
public:
|
||||
virtual void SetVertexBuffer( IVertexBuffer *pBuffer ) = 0;
|
||||
virtual void SetIndexBuffer( IIndexBuffer *pBuffer ) = 0;
|
||||
|
||||
virtual IMeshInstance *CreateInstance() = 0;
|
||||
};
|
||||
|
||||
interface IMeshRendering: public IRenderingPipelineStep
|
||||
{
|
||||
public:
|
||||
static IMesh *CreateMesh();
|
||||
};
|
||||
|
||||
interface IModelManager
|
||||
{
|
||||
public:
|
||||
virtual void LoadModel( const char *szPath );
|
||||
};
|
||||
@@ -1,72 +0,0 @@
|
||||
#ifndef NET_H
|
||||
#define NET_H
|
||||
|
||||
#include "steam/steam_api.h"
|
||||
#include "steam/isteamnetworkingsockets.h"
|
||||
#include "tier0/platform.h"
|
||||
#include "tier1/commandline.h"
|
||||
|
||||
abstract_class IIClient;
|
||||
class CBasePlayer;
|
||||
|
||||
enum EPacketType
|
||||
{
|
||||
PACKET_TYPE_CREATE_ENTITTY = 0,
|
||||
PACKET_TYPE_DESTROY_ENTITTY = 1,
|
||||
PACKET_TYPE_ENTITY_UPDATE = 2,
|
||||
|
||||
// Player can only send this
|
||||
PACKET_TYPE_PLAYER_MOVEMENT = 3,
|
||||
|
||||
PACKET_TYPE_PLAYER_JOIN = 4,
|
||||
PACKET_TYPE_PLAYER_LEAVE = 5,
|
||||
|
||||
PACKET_TYPE_GAMEMODE_START = 6,
|
||||
PACKET_TYPE_GAMEMODE_END = 7,
|
||||
};
|
||||
|
||||
struct Packet_t
|
||||
{
|
||||
uint32_t type;
|
||||
};
|
||||
struct PacketPlayer_t: public Packet_t
|
||||
{
|
||||
uint64_t playerID;
|
||||
uint32_t playerHandle;
|
||||
};
|
||||
struct PacketGameMode_t: public Packet_t
|
||||
{
|
||||
char szName[256];
|
||||
};
|
||||
|
||||
enum EMessageMode
|
||||
{
|
||||
MESSAGE_MODE_UNRELIABLE,
|
||||
MESSAGE_MODE_RELIABLE,
|
||||
};
|
||||
|
||||
|
||||
interface INetworking
|
||||
{
|
||||
public:
|
||||
static void Init();
|
||||
static void Deinit();
|
||||
static void Frame();
|
||||
static void SendData( void *pData, uint32_t nSize, IIClient *pClient, EMessageMode messageMode );
|
||||
static void SendDataEverybody( void *pData, uint32_t nSize, EMessageMode messageMode );
|
||||
static void SendDataEverybodyExcept( void *pData, uint32_t nSize, IIClient *pClient, EMessageMode messageMode );
|
||||
static void SendDataEverybodyExcept( void *pData, uint32_t nSize, CBasePlayer *pClient, EMessageMode messageMode );
|
||||
static void ProcessPacket( void *pData, uint32_t nSize, IIClient *pClient );
|
||||
|
||||
static void CreateServer();
|
||||
static void GetServerInfo();
|
||||
static void JoinServer( const char *szIP );
|
||||
static void JoinServer( uint64_t nSteamID );
|
||||
static void ClientConnectedCallback( SteamNetConnectionStatusChangedCallback_t *pCallback );
|
||||
|
||||
static bool IsServer();
|
||||
static bool IsClient();
|
||||
static bool IsConnected();
|
||||
};
|
||||
|
||||
#endif
|
||||
121
public/physics.h
121
public/physics.h
@@ -1,121 +0,0 @@
|
||||
#ifndef PHYSICS_H
|
||||
#define PHYSICS_H
|
||||
|
||||
#include "tier0/lib.h"
|
||||
#include "stdint.h"
|
||||
#include "tier1/utlvector.h"
|
||||
#include "math3d.h"
|
||||
|
||||
|
||||
typedef void Collider;
|
||||
typedef void RigidBodyHandle;
|
||||
|
||||
template <typename T>
|
||||
struct Point {
|
||||
T x, y, z;
|
||||
};
|
||||
|
||||
typedef struct u128 {
|
||||
uint64_t a;
|
||||
uint64_t b;
|
||||
} u128;
|
||||
|
||||
#include "physics_gen.h"
|
||||
|
||||
extern funnyphysics *px;
|
||||
|
||||
struct PxCastResult_t
|
||||
{
|
||||
bool bHit;
|
||||
float fTime;
|
||||
vec3 position;
|
||||
vec3 normal;
|
||||
vec3 normal2;
|
||||
};
|
||||
|
||||
interface IPxWorld
|
||||
{
|
||||
public:
|
||||
static PxCastResult_t BoxCast( vec3 size, vec3 origin, vec3 destination, vec3 rotation = (vec3){0,0,0} );
|
||||
};
|
||||
|
||||
class CPxCollider
|
||||
{
|
||||
public:
|
||||
virtual void Spawn( float fFriction = 0.0 ) = 0;
|
||||
virtual void Destroy( void );
|
||||
Collider *m_pCollider;
|
||||
};
|
||||
|
||||
class CPxBallMesh: public CPxCollider
|
||||
{
|
||||
public:
|
||||
virtual void Spawn( float fFriction = 0.0 ) override;
|
||||
virtual void Destroy( void ) override;
|
||||
float m_fRadius;
|
||||
};
|
||||
|
||||
class CPxBoxMesh: public CPxCollider
|
||||
{
|
||||
public:
|
||||
virtual void Spawn( float fFriction = 0.0 ) override;
|
||||
virtual void Destroy( void ) override;
|
||||
float m_fRadius[3];
|
||||
};
|
||||
|
||||
class CPxTriangleMesh: public CPxCollider
|
||||
{
|
||||
public:
|
||||
virtual void Spawn( float fFriction = 0.0 ) override;
|
||||
virtual void Destroy( void ) override;
|
||||
};
|
||||
|
||||
class CPxRigidKinematicPosition
|
||||
{
|
||||
public:
|
||||
void Spawn( CPxCollider *pCollider, px_matrix matrix, px_rigidbody_params params );
|
||||
void SetPosition( px_vec3 position );
|
||||
void SetPositionTeleport( px_vec3 position );
|
||||
px_vec3 GetPosition( void );
|
||||
px_matrix GetMatrix ( void );
|
||||
void Destroy( void );
|
||||
CPxCollider *m_pCollider;
|
||||
RigidBodyHandle *m_pRigidBody;
|
||||
};
|
||||
|
||||
class CPxRigidBody
|
||||
{
|
||||
public:
|
||||
void Spawn( CPxCollider *pCollider, px_matrix matrix, px_rigidbody_params params );
|
||||
px_vec3 GetPosition( void );
|
||||
px_vec3 GetVelocity( void );
|
||||
void SetPosition( px_vec3 position );
|
||||
void SetVelocity( px_vec3 velocity );
|
||||
px_matrix GetMatrix ( void );
|
||||
void Destroy( void );
|
||||
CPxCollider *m_pCollider;
|
||||
RigidBodyHandle *m_pRigidBody;
|
||||
};
|
||||
|
||||
class CPxStaticBody
|
||||
{
|
||||
public:
|
||||
void Spawn( CPxCollider *pCollider, px_matrix matrix, px_rigidbody_params params );
|
||||
px_vec3 GetPosition( void );
|
||||
px_matrix GetMatrix ( void );
|
||||
void Destroy( void );
|
||||
CPxCollider *m_pCollider;
|
||||
};
|
||||
|
||||
class CPxFixedBody
|
||||
{
|
||||
public:
|
||||
void Spawn( CPxCollider *pCollider, px_matrix matrix, px_rigidbody_params params );
|
||||
px_vec3 GetPosition( void );
|
||||
px_matrix GetMatrix ( void );
|
||||
void Destroy( void );
|
||||
CPxCollider *m_pCollider;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,27 +0,0 @@
|
||||
#ifndef PLAYER_START_H
|
||||
#define PLAYER_START_H
|
||||
|
||||
#include "baseentity.h"
|
||||
#include "server.h"
|
||||
|
||||
|
||||
class CPlayerStart: public CBaseEntity
|
||||
{
|
||||
public:
|
||||
virtual void Precache ( void ) override;
|
||||
virtual void Spawn( void ) override;
|
||||
virtual void ReadParameter( const char *szName, const char *szValue ) override;
|
||||
virtual void Destroy( void ) override;
|
||||
virtual void Think( float fDelta ) override;
|
||||
virtual void SendToServer() override;
|
||||
virtual void RecieveFromServer( void *pData, uint32_t nDataSize ) override;
|
||||
virtual void RoundEnd( void );
|
||||
virtual void RoundStart( IIClient *pClient );
|
||||
|
||||
CBasePlayer *pOwningPlayer = NULL;
|
||||
bool m_bIsRunning = false;
|
||||
};
|
||||
|
||||
extern CUtlVector<CPlayerStart*> g_PlayerStarts;
|
||||
|
||||
#endif
|
||||
@@ -1,459 +0,0 @@
|
||||
#ifndef RENDERING_H
|
||||
#define RENDERING_H
|
||||
|
||||
#include "interface.h"
|
||||
#include "math3d.h"
|
||||
#include "tier0/platform.h"
|
||||
#include "tier1/utlbuffer.h"
|
||||
#include "baseentity.h"
|
||||
#include "tier1/utlstring.h"
|
||||
#include "tier1/utlvector.h"
|
||||
|
||||
extern mat4 g_cameraView;
|
||||
|
||||
|
||||
enum EImageFormat
|
||||
{
|
||||
IMAGE_FORMAT_R8,
|
||||
IMAGE_FORMAT_R8G8,
|
||||
IMAGE_FORMAT_R8G8B8,
|
||||
IMAGE_FORMAT_R8G8B8A8,
|
||||
IMAGE_FORMAT_R16,
|
||||
IMAGE_FORMAT_R16G16,
|
||||
IMAGE_FORMAT_R16G16B16,
|
||||
IMAGE_FORMAT_R16G16B16A16,
|
||||
IMAGE_FORMAT_R32,
|
||||
IMAGE_FORMAT_R32G32,
|
||||
IMAGE_FORMAT_R32G32B32,
|
||||
IMAGE_FORMAT_R32G32B32A32,
|
||||
IMAGE_FORMAT_DEPTH,
|
||||
|
||||
IMAGE_FORMAT_WINDOW,
|
||||
};
|
||||
|
||||
enum EImageUsage
|
||||
{
|
||||
IMAGE_USAGE_COLOR_ATTACHMENT = 0x1,
|
||||
IMAGE_USAGE_DEPTH_ATTACHMENT = 0x2,
|
||||
IMAGE_USAGE_STORAGE = 0x4,
|
||||
};
|
||||
|
||||
enum EVertexFormat
|
||||
{
|
||||
VERTEX_FORMAT_X16,
|
||||
VERTEX_FORMAT_X16Y16,
|
||||
VERTEX_FORMAT_X16Y16Z16,
|
||||
VERTEX_FORMAT_X16Y16Z16W16,
|
||||
VERTEX_FORMAT_X32,
|
||||
VERTEX_FORMAT_X32Y32,
|
||||
VERTEX_FORMAT_X32Y32Z32,
|
||||
VERTEX_FORMAT_X32Y32Z32W32,
|
||||
};
|
||||
|
||||
enum EMSAAMode
|
||||
{
|
||||
MSAA_MODE_DISABLED,
|
||||
MSAA_MODE_MIN,
|
||||
MSAA_MODE_MAX,
|
||||
MSAA_MODE_AVERAGE,
|
||||
};
|
||||
|
||||
enum EDepthMode
|
||||
{
|
||||
DEPTH_MODE_DISABLED,
|
||||
DEPTH_MODE_EQUAL,
|
||||
DEPTH_MODE_NOT_EQUAL,
|
||||
DEPTH_MODE_LESS,
|
||||
DEPTH_MODE_LESS_EQUAL,
|
||||
DEPTH_MODE_GREATER,
|
||||
DEPTH_MODE_GREATER_EQUAL,
|
||||
};
|
||||
|
||||
enum EShaderInputType
|
||||
{
|
||||
SHADER_INPUT_TYPE_STORAGE_BUFFER,
|
||||
SHADER_INPUT_TYPE_UNIFORM_BUFFER,
|
||||
SHADER_INPUT_TYPE_IMAGE,
|
||||
SHADER_INPUT_TYPE_TLAS,
|
||||
|
||||
// All available textures are binded
|
||||
SHADER_INPUT_TYPE_TEXTURES,
|
||||
};
|
||||
|
||||
enum EShaderType
|
||||
{
|
||||
SHADER_TYPE_VERTEX,
|
||||
SHADER_TYPE_GEOMETRY,
|
||||
SHADER_TYPE_FRAGMENT,
|
||||
SHADER_TYPE_COMPUTE,
|
||||
SHADER_TYPE_RAY_GEN,
|
||||
SHADER_TYPE_CLOSEST_HIT,
|
||||
SHADER_TYPE_MISS,
|
||||
SHADER_TYPE_INTERSECTION,
|
||||
SHADER_TYPE_ANY_HIT,
|
||||
};
|
||||
|
||||
enum EBarrierMemoryPermissions
|
||||
{
|
||||
BARRIER_MEMORY_PERMISSIONS_NONE = 0x0,
|
||||
BARRIER_MEMORY_PERMISSIONS_VERTEX_BUFFER_READ = 0x1,
|
||||
BARRIER_MEMORY_PERMISSIONS_INDEX_BUFFER_READ = 0x2,
|
||||
BARRIER_MEMORY_PERMISSIONS_UNIFORM_BUFFER_READ = 0x4,
|
||||
BARRIER_MEMORY_PERMISSIONS_SHADER_READ = 0x8,
|
||||
BARRIER_MEMORY_PERMISSIONS_SHADER_WRITE = 0x10,
|
||||
BARRIER_MEMORY_PERMISSIONS_COLOR_READ = 0x20,
|
||||
BARRIER_MEMORY_PERMISSIONS_COLOR_WRITE = 0x40,
|
||||
BARRIER_MEMORY_PERMISSIONS_DEPTH_READ = 0x80,
|
||||
BARRIER_MEMORY_PERMISSIONS_DEPTH_WRITE = 0x100,
|
||||
BARRIER_MEMORY_PERMISSIONS_COPY_READ = 0x200,
|
||||
BARRIER_MEMORY_PERMISSIONS_COPY_WRITE = 0x400,
|
||||
BARRIER_MEMORY_PERMISSIONS_BLIT_READ = 0x800,
|
||||
BARRIER_MEMORY_PERMISSIONS_BLIT_WRITE = 0x1000,
|
||||
};
|
||||
enum EBarrierStage
|
||||
{
|
||||
BARRIER_STAGE_TOP = 0x1,
|
||||
BARRIER_STAGE_VERTEX_INPUT = 0x2,
|
||||
BARRIER_STAGE_VERTEX_SHADER = 0x4,
|
||||
BARRIER_STAGE_GEOMETRY_SHADER = 0x8,
|
||||
BARRIER_STAGE_FRAGMENT_SHADER = 0x10,
|
||||
BARRIER_STAGE_DEPTH_OUTPUT = 0x20,
|
||||
BARRIER_STAGE_COLOR_OUTPUT = 0x40,
|
||||
BARRIER_STAGE_COMPUTE_SHADER = 0x80,
|
||||
BARRIER_STAGE_RAY_TRACING_SHADER = 0x100,
|
||||
BARRIER_STAGE_BOTTOM = 0x200,
|
||||
BARRIER_STAGE_BLIT = 0x400,
|
||||
BARRIER_STAGE_COPY = 0x800,
|
||||
BARRIER_STAGE_IMAGE_OUPUT = 0x1000,
|
||||
};
|
||||
|
||||
enum EAttachmentLoadMode
|
||||
{
|
||||
ATTACHMENT_LOAD_MODE_DONT_CARE,
|
||||
ATTACHMENT_LOAD_MODE_CLEAR,
|
||||
ATTACHMENT_LOAD_MODE_LOAD,
|
||||
};
|
||||
|
||||
enum EAttachmentStoreMode
|
||||
{
|
||||
ATTACHMENT_STORE_MODE_DONT_CARE,
|
||||
ATTACHMENT_STORE_MODE_STORE,
|
||||
};
|
||||
|
||||
enum EPipelineType
|
||||
{
|
||||
PIPELINE_TYPE_RASTERIZATION,
|
||||
PIPELINE_TYPE_COMPUTE,
|
||||
PIPELINE_TYPE_RAY_TRACING,
|
||||
};
|
||||
|
||||
|
||||
|
||||
interface IVideo
|
||||
{
|
||||
public:
|
||||
static void Init();
|
||||
static void Deinit();
|
||||
static void CreatePipelines( void );
|
||||
static void Frame( float fDelta );
|
||||
};
|
||||
|
||||
abstract_class IBuffer
|
||||
{
|
||||
public:
|
||||
virtual void *Map() = 0;
|
||||
virtual void Unmap() = 0;
|
||||
};
|
||||
|
||||
typedef IBuffer IStorageBuffer;
|
||||
typedef IBuffer IUniformBuffer;
|
||||
typedef IBuffer IVertexBuffer;
|
||||
typedef IBuffer IIndexBuffer;
|
||||
|
||||
abstract_class IImage
|
||||
{
|
||||
public:
|
||||
EImageFormat format;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Bottom level acceleration structure for ray tracing.
|
||||
//----------------------------------------------------------------------------
|
||||
abstract_class IBLAS
|
||||
{
|
||||
public:
|
||||
virtual void Build() = 0;
|
||||
virtual void Update() = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Bottom level acceleration structure with triangle geometry.
|
||||
//----------------------------------------------------------------------------
|
||||
abstract_class IBLASMesh: public IBLAS
|
||||
{
|
||||
public:
|
||||
virtual void SetMesh( IVertexBuffer *pVertex, IIndexBuffer *pIndex ) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Bottom level acceleration structure with AABB geometry.
|
||||
//----------------------------------------------------------------------------
|
||||
abstract_class IBLASAABB: public IBLAS
|
||||
{
|
||||
public:
|
||||
virtual void SetBoundaries( vec4 size );
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Top level acceleration structure for handling worlds
|
||||
//----------------------------------------------------------------------------
|
||||
abstract_class ITLAS
|
||||
{
|
||||
public:
|
||||
virtual void AddInstance( IBLAS *pBLAS, mat4 matrix, uint32_t data ) = 0;
|
||||
virtual void ResetInstances() = 0;
|
||||
};
|
||||
|
||||
|
||||
struct ShaderInput_t
|
||||
{
|
||||
EShaderInputType type;
|
||||
uint32_t binding;
|
||||
};
|
||||
|
||||
struct Shader_t
|
||||
{
|
||||
CUtlString szPath;
|
||||
EShaderType type;
|
||||
};
|
||||
|
||||
abstract_class IPipeline
|
||||
{
|
||||
public:
|
||||
EPipelineType type;
|
||||
virtual void PushBindings() = 0;
|
||||
virtual void BindData( uint32_t binding, IBuffer *pBuffer, IImage* pImage) = 0;
|
||||
};
|
||||
typedef IPipeline IGraphicsPipeline;
|
||||
typedef IPipeline IComputePipeline;
|
||||
typedef IPipeline IRayTracingPipeline;
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Texture handle
|
||||
//----------------------------------------------------------------------------
|
||||
abstract_class ITexture
|
||||
{
|
||||
public:
|
||||
const char *szName;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
uint32_t id;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Manages loaded textures
|
||||
//----------------------------------------------------------------------------
|
||||
interface ITextureManager
|
||||
{
|
||||
public:
|
||||
static uint32_t GetTextureID(ITexture *pTexture);
|
||||
static ITexture *LoadTexture( void *pData, uint32_t X, uint32_t Y, uint32_t numChannels );
|
||||
static ITexture *LoadTexture( const char *szName );
|
||||
};
|
||||
|
||||
struct BufferBarrier_t
|
||||
{
|
||||
uint32_t in;
|
||||
uint32_t out;
|
||||
IBuffer *pBuffer;
|
||||
};
|
||||
struct ImageBarrier_t
|
||||
{
|
||||
uint32_t in;
|
||||
uint32_t out;
|
||||
IImage *pImage;
|
||||
};
|
||||
|
||||
struct VertexAttribute_t
|
||||
{
|
||||
uint32_t offset;
|
||||
uint32_t binding;
|
||||
EVertexFormat format;
|
||||
};
|
||||
|
||||
struct RenderingColorAttachment_t
|
||||
{
|
||||
IImage *pOutput;
|
||||
IImage *pTemporary;
|
||||
EAttachmentLoadMode loadMode;
|
||||
EAttachmentStoreMode storeMode;
|
||||
vec4 clearColor;
|
||||
EMSAAMode msaaMode;
|
||||
};
|
||||
|
||||
struct RenderingDepthAttachment_t
|
||||
{
|
||||
IImage *pOutput;
|
||||
IImage *pTemporary;
|
||||
EAttachmentLoadMode loadMode;
|
||||
EAttachmentStoreMode storeMode;
|
||||
float clearValue;
|
||||
EMSAAMode msaaMode;
|
||||
};
|
||||
|
||||
abstract_class IRenderingPipelineStep
|
||||
{
|
||||
public:
|
||||
virtual void Init() = 0;
|
||||
virtual void Frame( float fDelta ) = 0;
|
||||
virtual void Deinit() = 0;
|
||||
};
|
||||
|
||||
typedef IRenderingPipelineStep*(*CreateRenderStepFn)();
|
||||
struct RenderingStep_t
|
||||
{
|
||||
IRenderingPipelineStep *pPipeline;
|
||||
const char *szName;
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// 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;
|
||||
|
||||
|
||||
class CRenderingStep
|
||||
{
|
||||
public:
|
||||
CRenderingStep();
|
||||
CRenderingStep(const char *szStepName, CreateRenderStepFn pfn);
|
||||
};
|
||||
|
||||
class CPrepassRenderingStep: public CRenderingStep
|
||||
{
|
||||
public:
|
||||
CPrepassRenderingStep(const char *szStepName, CreateRenderStepFn pfn);
|
||||
};
|
||||
class CMeshRenderingStep: public CRenderingStep
|
||||
{
|
||||
public:
|
||||
CMeshRenderingStep(const char *szStepName, CreateRenderStepFn pfn);
|
||||
};
|
||||
|
||||
class CShadingRenderingStep: public CRenderingStep
|
||||
{
|
||||
public:
|
||||
CShadingRenderingStep(const char *szStepName, CreateRenderStepFn pfn);
|
||||
};
|
||||
|
||||
class CPostProcessingRenderingStep: public CRenderingStep
|
||||
{
|
||||
public:
|
||||
CPostProcessingRenderingStep(const char *szStepName, CreateRenderStepFn pfn);
|
||||
};
|
||||
|
||||
class CUIRenderingStep: public CRenderingStep
|
||||
{
|
||||
public:
|
||||
CUIRenderingStep(const char *szStepName, CreateRenderStepFn pfn);
|
||||
};
|
||||
|
||||
#define DECLARE_MESH_PREPASS_STAGE(class, name) \
|
||||
IRenderingPipelineStep *__rendering_stage_##name() \
|
||||
{ \
|
||||
return new class; \
|
||||
}; \
|
||||
CPrepassRenderingStep __renering_##name##_registry(#name, __rendering_stage_##name);
|
||||
#define DECLARE_MESH_RENDERING_STAGE(class, name) \
|
||||
IRenderingPipelineStep *__rendering_stage_##name() \
|
||||
{ \
|
||||
return new class; \
|
||||
}; \
|
||||
CMeshRenderingStep __renering_##name##_registry(#name, __rendering_stage_##name);
|
||||
#define DECLARE_MESH_SHADING_STAGE(class, name) \
|
||||
IRenderingPipelineStep *__rendering_stage_##name() \
|
||||
{ \
|
||||
return new class; \
|
||||
}; \
|
||||
CShadingRenderingStep __renering_##name##_registry(#name, __rendering_stage_##name);
|
||||
#define DECLARE_POST_PROCESSING_STAGE(class, name) \
|
||||
IRenderingPipelineStep *__rendering_stage_##name() \
|
||||
{ \
|
||||
return new class; \
|
||||
}; \
|
||||
CPostProcessingRenderingStep __renering_##name##_registry(#name, __rendering_stage_##name);
|
||||
#define DECLARE_UI_RENDERING_STAGE(class, name) \
|
||||
IRenderingPipelineStep *__rendering_stage_##name() \
|
||||
{ \
|
||||
return new class; \
|
||||
}; \
|
||||
CUIRenderingStep __renering_##name##_registry(#name, __rendering_stage_##name);
|
||||
|
||||
#endif
|
||||
@@ -1,25 +0,0 @@
|
||||
#ifndef SERVER_H
|
||||
#define SERVER_H
|
||||
|
||||
#include "tier0/platform.h"
|
||||
#include "networking.h"
|
||||
|
||||
interface IServer
|
||||
{
|
||||
public:
|
||||
static void LoadGame( const char *psz );
|
||||
static void Think( float fDelta );
|
||||
static void UnloadGame( const char *psz );
|
||||
};
|
||||
|
||||
class CBasePlayer;
|
||||
|
||||
abstract_class IIClient
|
||||
{
|
||||
public:
|
||||
uint64_t playerID;
|
||||
uint32_t playerHandle;
|
||||
CBasePlayer *pBasePlayer;
|
||||
};
|
||||
|
||||
#endif
|
||||
22
public/sv_dll.h
Normal file
22
public/sv_dll.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef SV_DLL_H
|
||||
#define SV_DLL_H
|
||||
|
||||
#include "iappsystem.h"
|
||||
|
||||
#define SERVER_DLL_INTERFACE_NAME "ServerGameDLL001"
|
||||
|
||||
class CServerGameDLL: public IAppSystem
|
||||
{
|
||||
public:
|
||||
virtual void Init() override;
|
||||
virtual void Shutdown() override;
|
||||
|
||||
void GameFrame();
|
||||
|
||||
private:
|
||||
void *m_pLibrary;
|
||||
};
|
||||
|
||||
CServerGameDLL *ServerGameDLL();
|
||||
|
||||
#endif
|
||||
@@ -1,21 +1,18 @@
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
// Purpose: A header which implements or redefines libc implementation.
|
||||
// It is defined with V_ prefix to differentiate own implementation from
|
||||
// given libc by the OS.
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef TIER0_STDLIB_H
|
||||
#define TIER0_STDLIB_H
|
||||
|
||||
#include "tier0/minmax.h"
|
||||
#include "tier0/minmax_on.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "stdint.h"
|
||||
#include "string.h"
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#else
|
||||
#include "stdint.h"
|
||||
#include "string.h"
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#endif
|
||||
|
||||
// TODO: bad stuff, reimplement it
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// string.h
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
// Purpose: A memory allocator for C and C++.
|
||||
// For now it uses libc but it is possible to use own allocators
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef TIER0_MEM_H
|
||||
#define TIER0_MEM_H
|
||||
|
||||
@@ -7,4 +12,9 @@
|
||||
PLATFORM_INTERFACE void *V_malloc( int nSize );
|
||||
PLATFORM_INTERFACE void V_free( void *pMem );
|
||||
PLATFORM_INTERFACE void *V_realloc( void *pMem, int nSize );
|
||||
#endif
|
||||
|
||||
void *operator new( size_t nCount );
|
||||
void *operator new ( size_t nCount, void *pPtr );
|
||||
void operator delete( void *pMem ) noexcept;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
#ifdef min
|
||||
#undef min
|
||||
#undef max
|
||||
#endif
|
||||
|
||||
#define max(x, y) (((x) > (y)) ? (x) : (y))
|
||||
#define min(x, y) (((x) < (y)) ? (x) : (y))
|
||||
@@ -1,3 +1,8 @@
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
// Purpose: Disables min and max. Used for C++ interoperability
|
||||
//===========================================================================//
|
||||
|
||||
|
||||
#ifdef min
|
||||
#undef min
|
||||
#undef max
|
||||
|
||||
8
public/tier0/minmax_on.h
Normal file
8
public/tier0/minmax_on.h
Normal file
@@ -0,0 +1,8 @@
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
// Purpose: Enables min and max. Used for C++ interoperability
|
||||
//===========================================================================//
|
||||
|
||||
#include "minmax_off.h"
|
||||
|
||||
#define max(x, y) (((x) > (y)) ? (x) : (y))
|
||||
#define min(x, y) (((x) < (y)) ? (x) : (y))
|
||||
@@ -1,8 +1,11 @@
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
// Purpose:
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef TIER0_NETWORK_H
|
||||
#define TIER0_NETWORK_H
|
||||
|
||||
#include "platform.h"
|
||||
#include "steam/isteamnetworkingsockets.h"
|
||||
#ifdef __linux__
|
||||
#include "arpa/inet.h"
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
// Purpose: Multi-platform implementation of some of the functions which
|
||||
// are provided by each OS differently.
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef TIER0_PLATFORM_H
|
||||
#define TIER0_PLATFORM_H
|
||||
|
||||
@@ -45,7 +50,6 @@
|
||||
|
||||
#endif
|
||||
|
||||
#define interface class
|
||||
#define abstract_class class
|
||||
|
||||
PLATFORM_INTERFACE void Plat_FatalErrorFunc( const char *szFormat, ... );
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
// Purpose: BAN STL. I hate it.
|
||||
//===========================================================================//
|
||||
|
||||
#define std no_you_do_not_use_std
|
||||
|
||||
@@ -1,23 +1,30 @@
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
// Purpose: Command line handler for argc and argv. It also allows to find
|
||||
// parameters and push your own.
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef TIER1_COMMANDLINE_H
|
||||
#define TIER1_COMMANDLINE_H
|
||||
|
||||
|
||||
#include "tier0/platform.h"
|
||||
|
||||
interface ICommandLine
|
||||
abstract_class ICommandLine
|
||||
{
|
||||
public:
|
||||
static void CreateCommandLine( int argc, char **argv );
|
||||
virtual void CreateCommandLine( int argc, char **argv ) = 0;
|
||||
|
||||
static bool CheckParam( const char *psz );
|
||||
static char *ParamValue( const char* psz, const char *szDefaultValue = 0 );
|
||||
virtual bool CheckParam( const char *psz ) = 0;
|
||||
virtual char *ParamValue( const char* psz, const char *szDefaultValue = 0 ) = 0;
|
||||
|
||||
static void AddParam( char *psz );
|
||||
static void RemoveParam( char *psz );
|
||||
virtual void AddParam( char *psz ) = 0;
|
||||
virtual void RemoveParam( char *psz ) = 0;
|
||||
|
||||
static int ParamCount();
|
||||
static int FindParam( const char *psz );
|
||||
static const char *GetParam(int nIndex);
|
||||
virtual int ParamCount() = 0;
|
||||
virtual int FindParam( const char *psz ) = 0;
|
||||
virtual const char *GetParam(int nIndex) = 0;
|
||||
};
|
||||
|
||||
ICommandLine *CommandLine();
|
||||
|
||||
#endif
|
||||
|
||||
28
public/tier1/interface.h
Normal file
28
public/tier1/interface.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef INTERFACE_H
|
||||
#define INTERFACE_H
|
||||
|
||||
#include "tier0/platform.h"
|
||||
|
||||
typedef void *( *CreateInterfaceFn )( const char *szName, int *pReturnCode );
|
||||
typedef void *( *InstantiateInterfaceFn )( void );
|
||||
|
||||
class CInterfaceRegistry
|
||||
{
|
||||
public:
|
||||
CInterfaceRegistry( InstantiateInterfaceFn fn, const char *szName );
|
||||
|
||||
InstantiateInterfaceFn m_CreateFn;
|
||||
const char *m_szName;
|
||||
|
||||
CInterfaceRegistry *m_pNext;
|
||||
};
|
||||
|
||||
|
||||
#define EXPOSE_INTERFACE( className, interfaceName, versionName ) \
|
||||
static void *__Create##className##_interface() { return ( interfaceName* )( new className ); }; \
|
||||
static CInterfaceRegistry __Create##className##_registry( __Create##className##_interface, versionName );
|
||||
|
||||
|
||||
void *CreateInterface( const char *szName, int *pReturnCode );
|
||||
|
||||
#endif
|
||||
@@ -1 +1,5 @@
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
// Purpose: Unban STL because C++ doesn't like using something different.
|
||||
//===========================================================================//
|
||||
|
||||
#undef std
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
// Purpose: Memory buffers for C++. They store data on heap as you have C
|
||||
// arrays for stack.
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef TIER1_UTL_BUFFER_H
|
||||
#define TIER1_UTL_BUFFER_H
|
||||
|
||||
@@ -5,9 +10,6 @@
|
||||
#include "tier0/mem.h"
|
||||
#include "tier0/platform.h"
|
||||
#include "tier0/lib.h"
|
||||
#include "tier0/minmax_off.h"
|
||||
#include "new"
|
||||
#include "tier0/minmax.h"
|
||||
|
||||
template <typename T>
|
||||
class CUtlBuffer;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#ifndef TIER1_UTL_INITIALIZER_LIST_H
|
||||
#define TIER1_UTL_INITIALIZER_LIST_H
|
||||
//-----------------------------------------------------------------------------
|
||||
// C++ only supports std::initializer_list. Because of that we are dependent
|
||||
// on libc++. That's why I banned usage of the std.
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
// C++ only supports std::initializer_list, so we need to get around compiler.
|
||||
//
|
||||
// fuck C++ once
|
||||
// fuck C++ twice
|
||||
// fuck C++ thrice
|
||||
//-----------------------------------------------------------------------------
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef TIER1_UTL_INITIALIZER_LIST_H
|
||||
#define TIER1_UTL_INITIALIZER_LIST_H
|
||||
|
||||
#include "initializer_list"
|
||||
template<typename T>
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
// Purpose: Mutexes for C++
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef TIER1_UTL_MUTEX_H
|
||||
#define TIER1_UTL_MUTEX_H
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
// Purpose: Own implementation of string.
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef TIER1_UTL_STRING_H
|
||||
#define TIER1_UTL_STRING_H
|
||||
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
//================= Copyright kotofyt, All rights reserved ==================//
|
||||
// Purpose: Own implementation of vectors, it is better to use them in local
|
||||
// namespaces for own .
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef TIER1_UTL_VECTOR_H
|
||||
#define TIER1_UTL_VECTOR_H
|
||||
|
||||
#include "tier1/utlbuffer.h"
|
||||
#include "tier0/lib.h"
|
||||
#include "tier1/utlbuffer.h"
|
||||
#include "tier1/utlinitlist.h"
|
||||
#include <initializer_list>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Basic vector implementation. There isn't much in them.
|
||||
// Basic vector implementation. There isn't much in them but they work.
|
||||
//-----------------------------------------------------------------------------
|
||||
template<typename T>
|
||||
class CUtlVector
|
||||
@@ -43,6 +47,7 @@ public:
|
||||
CUtlVector<T> &operator=(const CUtlVector<T> &vec);
|
||||
|
||||
// Iterator stuff
|
||||
// Do we really need it?
|
||||
struct Iterator {
|
||||
T *m_pCurrent;
|
||||
Iterator( T *pCurrent ) : m_pCurrent(pCurrent) {}
|
||||
|
||||
Reference in New Issue
Block a user