134 lines
2.4 KiB
C++
134 lines
2.4 KiB
C++
#ifndef RENDERING_H
|
|
#define RENDERING_H
|
|
|
|
#include "math3d.h"
|
|
#include "tier0/platform.h"
|
|
#include "tier1/utlbuffer.h"
|
|
#include "baseentity.h"
|
|
#include "tier1/utlvector.h"
|
|
|
|
extern mat4 g_cameraView;
|
|
|
|
interface IVideo
|
|
{
|
|
public:
|
|
static void Init();
|
|
static void Frame( float fDelta );
|
|
};
|
|
|
|
abstract_class IVertexBuffer
|
|
{
|
|
public:
|
|
virtual void *Map() = 0;
|
|
virtual void Unmap() = 0;
|
|
};
|
|
|
|
abstract_class IIndexBuffer
|
|
{
|
|
public:
|
|
virtual void *Map() = 0;
|
|
virtual void Unmap() = 0;
|
|
};
|
|
|
|
enum EMaterialType
|
|
{
|
|
IMATERIAL_ERROR = 0,
|
|
IMATERIAL_PBR = 1,
|
|
IMATERIAL_FULLBRIGHT = 2,
|
|
};
|
|
|
|
struct MaterialProperties_t
|
|
{
|
|
|
|
EMaterialType type;
|
|
|
|
vec3 albedoColor;
|
|
|
|
const char *szAlbedoTexture;
|
|
const char *szNormalsTexture;
|
|
const char *szRoughnessTexture;
|
|
const char *szMetalnessTexture;
|
|
|
|
vec2 uvScaling;
|
|
};
|
|
|
|
|
|
struct Material_t
|
|
{
|
|
uint32_t shader;
|
|
uint32_t albedo;
|
|
uint32_t normal;
|
|
uint32_t roughness;
|
|
uint32_t metalness;
|
|
vec3 albedoColor;
|
|
};
|
|
|
|
abstract_class IMaterial
|
|
{
|
|
public:
|
|
Material_t m;
|
|
};
|
|
|
|
interface IRenderer
|
|
{
|
|
public:
|
|
|
|
static IVertexBuffer *CreateVertexBuffer( uint32_t uSize );
|
|
static IIndexBuffer *CreateIndexBuffer( uint32_t uSize );
|
|
|
|
static IMaterial *LoadMaterial( const char *szName );
|
|
static void SetMaterial( IMaterial *pMaterial );
|
|
};
|
|
|
|
//----------------------------------------------------------------------------
|
|
// Mesh handler for the rendering
|
|
//----------------------------------------------------------------------------
|
|
abstract_class IMesh
|
|
{
|
|
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 SetVertexBuffer( IVertexBuffer *pBuffer ) = 0;
|
|
virtual void SetIndexBuffer( IIndexBuffer *pBuffer ) = 0;
|
|
virtual void SetMaterial( IMaterial *pMaterial ) = 0;
|
|
virtual void Draw() = 0;
|
|
};
|
|
|
|
interface IMeshRenderer
|
|
{
|
|
public:
|
|
static void Init();
|
|
static void Frame( float fDelta );
|
|
|
|
static IMesh *CreateMesh();
|
|
static void Destroy( IMesh *pModel );
|
|
};
|
|
|
|
abstract_class ITexture
|
|
{
|
|
public:
|
|
const char *szName;
|
|
uint32_t id;
|
|
};
|
|
|
|
interface ITextureManager
|
|
{
|
|
public:
|
|
static uint32_t GetTexture(ITexture *pTexture);
|
|
static ITexture *LoadTexture( void *pData, uint32_t X, uint32_t Y, uint32_t numChannels );
|
|
static ITexture *LoadTexture( const char *szName );
|
|
};
|
|
|
|
interface IPostProcessRenderer
|
|
{
|
|
public:
|
|
static void Init();
|
|
static void Frame( float fDelta );
|
|
};
|
|
|
|
#endif
|