mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 06:08:30 +09:00
[Feat] (MG_State/GLState): Implement BufferObject.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
namespace MobileGL {
|
||||
namespace MG_State {
|
||||
namespace GLState {
|
||||
class BufferState {
|
||||
public:
|
||||
SharedPtr<BufferObject> GetBufferObjectByIndex(Uint index) {
|
||||
auto it = m_bufferObjects.find(index);
|
||||
if (it != m_bufferObjects.end()) {
|
||||
return it->second;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Vector<Uint> GenerateByNum(Uint number) {
|
||||
Vector<Uint> buffers;
|
||||
m_indexGenerator.Generate(number, reinterpret_cast<Uint*>(&buffers));
|
||||
return buffers;
|
||||
}
|
||||
|
||||
SharedPtr<BufferObject> CreateBufferObject(Uint index) {
|
||||
auto bufferObject = MakeShared<BufferObject>();
|
||||
m_bufferObjects[index] = bufferObject;
|
||||
return bufferObject;
|
||||
}
|
||||
|
||||
private:
|
||||
UnorderedMap<Uint, SharedPtr<BufferObject>> m_bufferObjects;
|
||||
IndexGenerator<Uint> m_indexGenerator;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user