Files
funnygame/public/brush.h
2025-07-13 15:47:42 +03:00

59 lines
1.8 KiB
C++

#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 Sync( 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