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. namespace BansheeEngine
  7. {
  8. /** @addtogroup GL
  9. * @{
  10. */
  11. /** OpenGL implementation of an index buffer. */
  12. class BS_RSGL_EXPORT GLIndexBufferCore : public IndexBufferCore
  13. {
  14. public:
  15. GLIndexBufferCore(IndexType idxType, UINT32 numIndexes, GpuBufferUsage usage);
  16. ~GLIndexBufferCore();
  17. /** @copydoc IndexBufferCore::readData */
  18. void readData(UINT32 offset, UINT32 length, void* dest) override;
  19. /** @copydoc IndexBufferCore::writeData */
  20. void writeData(UINT32 offset, UINT32 length, const void* source,
  21. BufferWriteType writeFlags = BufferWriteType::Normal) override;
  22. /** Returns internal OpenGL index buffer handle. */
  23. GLuint getGLBufferId() const { return mBufferId; }
  24. protected:
  25. /** @copydoc IndexBufferCore::initialize */
  26. void initialize() override;
  27. /** @copydoc IndexBufferCore::lockImpl */
  28. void* lockImpl(UINT32 offset, UINT32 length, GpuLockOptions options) override;
  29. /** @copydoc IndexBufferCore::unlockImpl */
  30. void unlockImpl() override;
  31. private:
  32. GLuint mBufferId;
  33. bool mZeroLocked;
  34. };
  35. /** @} */
  36. }