mirror of
https://github.com/nillerusr/source-engine.git
synced 2025-04-02 13:32:37 +00:00
109 lines
3.4 KiB
C++
109 lines
3.4 KiB
C++
#ifndef MESHGL_H
|
|
#define MESHGL_H
|
|
|
|
#include "utlvector.h"
|
|
#include "materialsystem/imaterialsystem.h"
|
|
#include "shaderapi/ishaderutil.h"
|
|
#include "shaderapi/ishaderapi.h"
|
|
#include "materialsystem/imesh.h"
|
|
#include "materialsystem/idebugtextureinfo.h"
|
|
#include "materialsystem/deformations.h"
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// The empty mesh
|
|
//-----------------------------------------------------------------------------
|
|
class CGLMesh : public IMesh
|
|
{
|
|
public:
|
|
CGLMesh( bool bIsDynamic );
|
|
virtual ~CGLMesh();
|
|
|
|
// FIXME: Make this work! Unsupported methods of IIndexBuffer + IVertexBuffer
|
|
virtual bool Lock( int nMaxIndexCount, bool bAppend, IndexDesc_t& desc );
|
|
virtual void Unlock( int nWrittenIndexCount, IndexDesc_t& desc );
|
|
virtual void ModifyBegin( bool bReadOnly, int nFirstIndex, int nIndexCount, IndexDesc_t& desc );
|
|
virtual void ModifyEnd( IndexDesc_t& desc );
|
|
virtual void Spew( int nIndexCount, const IndexDesc_t & desc );
|
|
virtual void ValidateData( int nIndexCount, const IndexDesc_t &desc );
|
|
virtual bool Lock( int nVertexCount, bool bAppend, VertexDesc_t &desc );
|
|
virtual void Unlock( int nVertexCount, VertexDesc_t &desc );
|
|
virtual void Spew( int nVertexCount, const VertexDesc_t &desc );
|
|
virtual void ValidateData( int nVertexCount, const VertexDesc_t & desc );
|
|
virtual bool IsDynamic() const { return m_bIsDynamic; }
|
|
virtual void BeginCastBuffer( VertexFormat_t format ) {}
|
|
virtual void BeginCastBuffer( MaterialIndexFormat_t format ) {}
|
|
virtual void EndCastBuffer( ) {}
|
|
virtual int GetRoomRemaining() const { return 0; }
|
|
virtual MaterialIndexFormat_t IndexFormat() const { return MATERIAL_INDEX_FORMAT_UNKNOWN; }
|
|
|
|
void LockMesh( int numVerts, int numIndices, MeshDesc_t& desc );
|
|
void UnlockMesh( int numVerts, int numIndices, MeshDesc_t& desc );
|
|
|
|
void ModifyBeginEx( bool bReadOnly, int firstVertex, int numVerts, int firstIndex, int numIndices, MeshDesc_t& desc );
|
|
void ModifyBegin( int firstVertex, int numVerts, int firstIndex, int numIndices, MeshDesc_t& desc );
|
|
void ModifyEnd( MeshDesc_t& desc );
|
|
|
|
// returns the # of vertices (static meshes only)
|
|
int VertexCount() const;
|
|
|
|
// Sets the primitive type
|
|
void SetPrimitiveType( MaterialPrimitiveType_t type );
|
|
|
|
// Draws the entire mesh
|
|
void Draw(int firstIndex, int numIndices);
|
|
|
|
void Draw(CPrimList *pPrims, int nPrims);
|
|
|
|
// Copy verts and/or indices to a mesh builder. This only works for temp meshes!
|
|
virtual void CopyToMeshBuilder(
|
|
int iStartVert, // Which vertices to copy.
|
|
int nVerts,
|
|
int iStartIndex, // Which indices to copy.
|
|
int nIndices,
|
|
int indexOffset, // This is added to each index.
|
|
CMeshBuilder &builder );
|
|
|
|
// Spews the mesh data
|
|
void Spew( int numVerts, int numIndices, const MeshDesc_t & desc );
|
|
|
|
void ValidateData( int numVerts, int numIndices, const MeshDesc_t & desc );
|
|
|
|
// gets the associated material
|
|
IMaterial* GetMaterial();
|
|
|
|
void SetColorMesh( IMesh *pColorMesh, int nVertexOffset )
|
|
{
|
|
}
|
|
|
|
|
|
virtual int IndexCount() const
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
virtual void SetFlexMesh( IMesh *pMesh, int nVertexOffset ) {}
|
|
|
|
virtual void DisableFlexMesh() {}
|
|
|
|
virtual void MarkAsDrawn() {}
|
|
|
|
virtual unsigned ComputeMemoryUsed() { return 0; }
|
|
|
|
virtual VertexFormat_t GetVertexFormat() const { return VERTEX_POSITION; }
|
|
|
|
virtual IMesh *GetMesh()
|
|
{
|
|
return this;
|
|
}
|
|
|
|
private:
|
|
enum
|
|
{
|
|
VERTEX_BUFFER_SIZE = 1024 * 1024
|
|
};
|
|
|
|
unsigned char* m_pVertexMemory;
|
|
bool m_bIsDynamic;
|
|
};
|
|
|
|
#endif |