BsIndexBuffer.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #pragma once
  2. #include "BsCorePrerequisites.h"
  3. #include "BsHardwareBuffer.h"
  4. #include "BsCoreObject.h"
  5. namespace BansheeEngine
  6. {
  7. /**
  8. * @brief Hardware buffer that hold indices that reference vertices in a vertex buffer.
  9. */
  10. class BS_CORE_EXPORT IndexBuffer : public HardwareBuffer, public CoreObject
  11. {
  12. public:
  13. /**
  14. * @brief Type of the indices used, used for determining size.
  15. */
  16. enum IndexType
  17. {
  18. IT_16BIT,
  19. IT_32BIT
  20. };
  21. ~IndexBuffer();
  22. /**
  23. * @brief Returns the type of indices stored.
  24. */
  25. IndexType getType() const { return mIndexType; }
  26. /**
  27. * @brief Returns the number of indices this buffer can hold.
  28. */
  29. UINT32 getNumIndices() const { return mNumIndexes; }
  30. /**
  31. * @brief Returns the size of a single index in bytes.
  32. */
  33. UINT32 getIndexSize() const { return mIndexSize; }
  34. protected:
  35. IndexBuffer(IndexType idxType, UINT32 numIndexes, GpuBufferUsage usage, bool useSystemMemory);
  36. protected:
  37. IndexType mIndexType;
  38. UINT32 mNumIndexes;
  39. UINT32 mIndexSize;
  40. };
  41. }