From 1367d33cd8ea4732438d21ea27332c858fa592a3 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Wed, 26 Jun 2013 10:43:58 +0200 Subject: [PATCH] Small speed up for the color change function (OpenGL_GAL). --- common/gal/opengl/vbo_item.cpp | 5 +---- include/gal/opengl/vbo_container.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/common/gal/opengl/vbo_item.cpp b/common/gal/opengl/vbo_item.cpp index 4d6132403b..ba68c1abb0 100644 --- a/common/gal/opengl/vbo_item.cpp +++ b/common/gal/opengl/vbo_item.cpp @@ -73,15 +73,12 @@ VBO_VERTEX* VBO_ITEM::GetVertices() if( m_isDirty ) Finish(); - return m_container->GetVertices( this ); + return m_container->GetVertices( m_offset ); } void VBO_ITEM::ChangeColor( const COLOR4D& aColor ) { - if( m_isDirty ) - Finish(); - VBO_VERTEX* vertexPtr = GetVertices(); for( unsigned int i = 0; i < m_size; ++i ) diff --git a/include/gal/opengl/vbo_container.h b/include/gal/opengl/vbo_container.h index b32a255b3f..ba8e292310 100644 --- a/include/gal/opengl/vbo_container.h +++ b/include/gal/opengl/vbo_container.h @@ -112,6 +112,16 @@ public: */ VBO_VERTEX* GetVertices( const VBO_ITEM* aVboItem ) const; + /** + * Function GetVertices() + * Returns vertices stored at the specific offset. + * @aOffest is the specific offset. + */ + inline VBO_VERTEX* GetVertices( unsigned int aOffset ) const + { + return &m_vertices[aOffset]; + } + /** * Function GetSize() * Returns amount of vertices currently stored in the container.