networking i guess

This commit is contained in:
2026-02-28 21:07:44 +02:00
parent e83f7cd448
commit 03c560c2b7
68 changed files with 1348 additions and 121 deletions

View File

@@ -14,6 +14,7 @@ public:
IGameWindow *m_pGameWindow;
IRenderContext *m_pRenderContext;
EngineConsts_t *m_pEngineConsts;
IEngineBridge *m_pBridge;

View File

@@ -2,7 +2,17 @@
#define ENGINE_BRIDGE_H
#include "gamesystem.h"
#include "networkbase.h"
struct EngineConsts_t
{
bool m_bIsDedicated;
bool m_bIsSteam;
INetworkBase *(*LaunchLocalBridge)(uint16_t uPort);
INetworkBase *(*LaunchServer)(uint16_t uPort);
INetworkBase *(*ConnectLocalBridge)(uint16_t uPort);
INetworkBase *(*ConnectSteamServer)(uint64_t uServer, uint16_t uPort);
};
abstract_class IEngineBridge: public IGameSystem
{
public:

View File

@@ -0,0 +1,10 @@
#ifndef NETWORK_CLIENT_H
#define NETWORK_CLIENT_H
#include "networkbase.h"
INetworkBase *ConnectByLocalBridge( uint16_t uPort );
INetworkBase *ConnectByIP( const char *szIP, uint16_t uPort );
INetworkBase *ConnectBySteamID( uint64_t uID, uint16_t uPort );
#endif

View File

@@ -0,0 +1,24 @@
#ifndef NETWORK_SERVER_H
#define NETWORK_SERVER_H
#include "networkbase.h"
//-----------------------------------------------------------------------------
// Launches local server
// Good to pass data between server and client
//-----------------------------------------------------------------------------
INetworkBase *LaunchLocalBridge( uint16_t uPort );
//-----------------------------------------------------------------------------
// Launches public server at port
// Public if you open ports :0
//-----------------------------------------------------------------------------
INetworkBase *LaunchServerAtPort( uint16_t uPort );
//-----------------------------------------------------------------------------
// Launches public server at steam datagram relay
// We just trust this method
//-----------------------------------------------------------------------------
INetworkBase *LaunchServerAtSteamRelay( uint16_t uPort );
#endif

View File

@@ -109,6 +109,13 @@ enum EStoreMode
STORE_MODE_DONT_CARE,
};
enum ECullingMode
{
CULL_MODE_NONE,
CULL_MODE_FRONT,
CULL_MODE_BACK,
};
enum ETopologyMode
{
TOPOLOGY_MODE_POINT_LIST,
@@ -168,15 +175,41 @@ public:
virtual void UnloadTexture( uint32_t uTextureID ) = 0;
};
abstract_class ITriangleAccelerationStructure: public IRenderingObject
{
public:
virtual void SetVertices( IVertexBuffer *pBuffer, EVertexFormat eFormat, int iStride ) = 0;
virtual void SetIndicies( IVertexBuffer *pBuffer, EIndexFormat eFormat ) = 0;
virtual void SetTopology( ETopologyMode eTopology ) = 0;
virtual void Build() = 0;
virtual void Update( IVertexBuffer *pBuffer ) = 0;
};
abstract_class IAABBAccelerationStructure: public IRenderingObject
{
public:
virtual void Build() = 0;
};
abstract_class IWorldAccelerationStructure: public IRenderingObject
{
public:
virtual void Build() = 0;
};
abstract_class IBaseShader
{
public:
virtual void Build() = 0;
};
//-----------------------------------------------------------------------------
// Shader object
//-----------------------------------------------------------------------------
abstract_class IShader
abstract_class IShader: public IBaseShader
{
public:
virtual ~IShader() = default;
virtual uint32_t PSGetResourceByName( const char *szName ) = 0;
virtual uint32_t VSGetResourceByName( const char *szName ) = 0;
virtual uint32_t GetResourceByName( const char *szName ) = 0;
virtual void AddLayout( int iIndex, int iStride ) = 0;
virtual void AddAttribute( int iBufferIndex, int iLocation, EVertexFormat eFormat, int iOffset ) = 0;
virtual void SetTopology( ETopologyMode eTopology ) = 0;
@@ -184,7 +217,19 @@ public:
virtual void SetDepthImage( EImageFormat eFormat ) = 0;
virtual void SetMultisampling( EMultisampleType eFormat ) = 0;
virtual void DisablePixelShader( bool bDisable) = 0;
virtual void Build() = 0;
};
abstract_class IComputeShader
{
public:
};
abstract_class IRayTracingShader
{
public:
virtual uint32_t GetMissShaderBinding( const char *szName );
virtual uint32_t GetClosestHitShaderBinding( const char *szName );
virtual uint32_t GetCallableShaderBinding( const char *szName );
};
//-----------------------------------------------------------------------------

View File

@@ -37,6 +37,12 @@ enum EShaderStage: uint32_t
SHADER_STAGE_MISS,
SHADER_STAGE_CALLABLE,
SHADER_STAGE_RAYGEN_SOFTWARE,
SHADER_STAGE_ANY_HIT_SOFTWARE,
SHADER_STAGE_CLOSEST_HIT_SOFTWARE,
SHADER_STAGE_MISS_SOFTWARE,
SHADER_STAGE_CALLABLE_SOFTWARE,
SHADER_STAGE_TASK,
SHADER_STAGE_MESH,

30
public/networkbase.h Normal file
View File

@@ -0,0 +1,30 @@
#ifndef NETWORK_BASE_H
#define NETWORK_BASE_H
#include "tier1/interface.h"
struct NetPacket_t
{
void *pData;
uint32_t uSize;
};
abstract_class INetworkBase
{
public:
virtual ~INetworkBase() = default;
virtual void NetThink() = 0;
virtual uint32_t BHasUpdates() = 0;
virtual NetPacket_t RecievePacket() = 0;
virtual NetPacket_t PeekPacket() = 0;
virtual void SendPacket( NetPacket_t stPacket ) = 0;
virtual uint64_t GetSteamID() = 0;
virtual const char *GetIP() = 0;
virtual uint16_t GetPort() = 0;
};
#endif

View File

@@ -14,6 +14,7 @@ public:
IGameWindow *m_pGameWindow;
IRenderContext *m_pRenderContext;
EngineConsts_t *m_pEngineConsts;
IEngineBridge *m_pBridge;

View File

@@ -6,6 +6,17 @@ struct Vector {
float y;
float z;
};
struct Color {
float r;
float g;
float b;
};
struct ColorAlpha {
float r;
float g;
float b;
float a;
};
struct QAngle {
float pitch;
float yaw;