Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.5 KiB

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