BsGLIndexBuffer.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsGLPrerequisites.h"
  5. #include "BsIndexBuffer.h"
  6. #include "BsGLBuffer.h"
  7. namespace BansheeEngine
  8. {
  9. /** @addtogroup GL
  10. * @{
  11. */
  12. /** OpenGL implementation of an index buffer. */
  13. class BS_RSGL_EXPORT GLIndexBufferCore : public IndexBufferCore
  14. {
  15. public:
  16. GLIndexBufferCore(IndexType idxType, UINT32 numIndices, GpuBufferUsage usage);
  17. ~GLIndexBufferCore();
  18. /** @copydoc IndexBufferCore::readData */
  19. void readData(UINT32 offset, UINT32 length, void* dest) override;
  20. /** @copydoc IndexBufferCore::writeData */
  21. void writeData(UINT32 offset, UINT32 length, const void* source,
  22. BufferWriteType writeFlags = BufferWriteType::Normal) override;
  23. /** Returns internal OpenGL index buffer handle. */
  24. GLuint getGLBufferId() const { return mBuffer.getGLBufferId(); }
  25. protected:
  26. /** @copydoc IndexBufferCore::initialize */
  27. void initialize() override;
  28. /** @copydoc IndexBufferCore::map */
  29. void* map(UINT32 offset, UINT32 length, GpuLockOptions options) override;
  30. /** @copydoc IndexBufferCore::unmap */
  31. void unmap() override;
  32. private:
  33. GLBuffer mBuffer;
  34. };
  35. /** @} */
  36. }