diff options
Diffstat (limited to 'drape/vertex_array_buffer.hpp')
-rw-r--r-- | drape/vertex_array_buffer.hpp | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/drape/vertex_array_buffer.hpp b/drape/vertex_array_buffer.hpp index baab293954..49fc1c67e2 100644 --- a/drape/vertex_array_buffer.hpp +++ b/drape/vertex_array_buffer.hpp @@ -1,14 +1,14 @@ #pragma once -#include "drape/index_buffer_mutator.hpp" #include "drape/attribute_buffer_mutator.hpp" -#include "drape/pointers.hpp" -#include "drape/index_buffer.hpp" -#include "drape/data_buffer.hpp" #include "drape/binding_info.hpp" +#include "drape/data_buffer.hpp" #include "drape/gpu_program.hpp" +#include "drape/index_buffer.hpp" +#include "drape/index_buffer_mutator.hpp" +#include "drape/pointers.hpp" -#include "std/map.hpp" +#include <map> namespace df { @@ -17,42 +17,34 @@ class BatchMergeHelper; namespace dp { - struct IndicesRange { uint32_t m_idxStart; uint32_t m_idxCount; - IndicesRange() - : m_idxStart(0), m_idxCount(0) - {} - - IndicesRange(uint32_t idxStart, uint32_t idxCount) - : m_idxStart(idxStart), m_idxCount(idxCount) - {} - + IndicesRange() : m_idxStart(0), m_idxCount(0) {} + IndicesRange(uint32_t idxStart, uint32_t idxCount) : m_idxStart(idxStart), m_idxCount(idxCount) {} bool IsValid() const { return m_idxCount != 0; } }; class VertexArrayBuffer { - typedef map<BindingInfo, drape_ptr<DataBuffer> > TBuffersMap; + using BuffersMap = std::map<BindingInfo, drape_ptr<DataBuffer>>; friend class df::BatchMergeHelper; + public: VertexArrayBuffer(uint32_t indexBufferSize, uint32_t dataBufferSize); ~VertexArrayBuffer(); - /// This method must be call on reading thread, before VAO will be transfer on render thread + // This method must be call on reading thread, before VAO will be transfered on render thread. void Preflush(); - ///{@ - /// On devices where implemented OES_vertex_array_object extensions we use it for build VertexArrayBuffer - /// OES_vertex_array_object create OpenGL resource that belong only one GL context (which was created by) - /// by this reason Build/Bind and Render must be called only on Frontendrendere thread + // OES_vertex_array_object create OpenGL resource that belong only one GL context (which was + // created by). By this reason Build/Bind and Render must be called only on FrontendRenderer + // thread. void Render(bool drawAsLine); void RenderRange(bool drawAsLine, IndicesRange const & range); void Build(ref_ptr<GpuProgram> program); - ///@} uint32_t GetAvailableVertexCount() const; uint32_t GetAvailableIndexCount() const; @@ -68,7 +60,6 @@ public: void ResetChangingTracking() { m_isChanged = false; } bool IsChanged() const { return m_isChanged; } - private: ref_ptr<DataBuffer> GetOrCreateStaticBuffer(BindingInfo const & bindingInfo); ref_ptr<DataBuffer> GetOrCreateDynamicBuffer(BindingInfo const & bindingInfo); @@ -80,17 +71,17 @@ private: void Unbind() const; void BindStaticBuffers() const; void BindDynamicBuffers() const; - void BindBuffers(TBuffersMap const & buffers) const; + void BindBuffers(BuffersMap const & buffers) const; ref_ptr<DataBufferBase> GetIndexBuffer() const; void PreflushImpl(); private: - /// m_VAO - VertexArrayObject name/identificator + // m_VAO - VertexArrayObject name/identifier. int m_VAO; - TBuffersMap m_staticBuffers; - TBuffersMap m_dynamicBuffers; + BuffersMap m_staticBuffers; + BuffersMap m_dynamicBuffers; drape_ptr<IndexBuffer> m_indexBuffer; uint32_t m_dataBufferSize; @@ -101,5 +92,4 @@ private: bool m_moveToGpuOnBuild; bool m_isChanged; }; - -} // namespace dp +} // namespace dp |