summaryrefslogtreecommitdiff
path: root/engine/ipooledvballocator.h
diff options
context:
space:
mode:
Diffstat (limited to 'engine/ipooledvballocator.h')
-rw-r--r--engine/ipooledvballocator.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/engine/ipooledvballocator.h b/engine/ipooledvballocator.h
new file mode 100644
index 0000000..93e8912
--- /dev/null
+++ b/engine/ipooledvballocator.h
@@ -0,0 +1,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