blob: 93e89123d767424fd023f5eb065ffe010711fb40 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $Revision: $
// $NoKeywords: $
//
// This file contains a little interface to deal with pooled vertex buffer allocations
// (which is used to allow multiple meshes to own sub-ranges within a single vertex buffer)
//
//=============================================================================//
#ifndef IPOOLEDVBALLOCATOR_H
#define IPOOLEDVBALLOCATOR_H
//-----------------------------------------------------------------------------
// Pooled VB allocator abstract base class
//-----------------------------------------------------------------------------
abstract_class IPooledVBAllocator
{
public:
virtual ~IPooledVBAllocator() {};
// Allocate the shared vertex buffer
virtual bool Init( VertexFormat_t format, int numVerts ) = 0;
// Free the shared vertex buffer (after Deallocate is called for all sub-allocs)
virtual void Clear() = 0;
// Get the shared mesh (vertex buffer) from which sub-allocations are made
virtual IMesh *GetSharedMesh() = 0;
// Get a pointer to the start of the vertex buffer data
virtual void *GetVertexBufferBase() = 0;
virtual int GetNumVertsAllocated() = 0;
// Allocate a sub-range of 'numVerts' from free space in the shared vertex buffer
// (returns the byte offset from the start of the VB to the new allocation)
virtual int Allocate( int numVerts ) = 0;
virtual void Deallocate( int offset, int numVerts ) = 0;
};
#endif // IPOOLEDVBALLOCATOR_H
|