refactored drawGeometry method.

This commit is contained in:
rachytski 2012-04-23 19:26:39 +04:00 committed by Alex Zolotarev
parent fac9865a58
commit 928588344f
6 changed files with 13 additions and 21 deletions

View file

@ -145,8 +145,7 @@ namespace yg
for (unsigned i = 0; i < s; ++i)
base_t::drawGeometry(blitInfo[i].m_srcSurface,
storage.m_vertices,
storage.m_indices,
storage,
4,
sizeof(unsigned short) * i * 4,
GL_TRIANGLE_FAN);

View file

@ -384,8 +384,7 @@ namespace yg
unlockPipeline(pipelineID);
drawGeometry(skinPage->texture(),
pipeline.m_storage.m_vertices,
pipeline.m_storage.m_indices,
pipeline.m_storage,
pipeline.m_currentIndex,
0,
GL_TRIANGLES);

View file

@ -99,10 +99,10 @@ namespace yg
if (isDebugging())
LOG(LINFO, ("performing DrawGeometry command"));
m_vertices->makeCurrent();
m_storage.m_vertices->makeCurrent();
/// it's crucial to setupLayout after vertices->makeCurrent
Vertex::setupLayout(m_vertices->glPtr());
m_indices->makeCurrent();
Vertex::setupLayout(m_storage.m_vertices->glPtr());
m_storage.m_indices->makeCurrent();
if (isDebugging())
LOG(LINFO, ("using", m_texture->id(), "texture"));
@ -121,14 +121,13 @@ namespace yg
m_primitiveType,
m_indicesCount,
GL_UNSIGNED_SHORT,
((unsigned char*)m_indices->glPtr()) + m_indicesOffs));
((unsigned char*)m_storage.m_indices->glPtr()) + m_indicesOffs));
// OGLCHECK(glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ));
}
void GeometryRenderer::drawGeometry(shared_ptr<BaseTexture> const & texture,
shared_ptr<VertexBuffer> const & vertices,
shared_ptr<IndexBuffer> const & indices,
Storage const & storage,
size_t indicesCount,
size_t indicesOffs,
unsigned primType)
@ -136,8 +135,7 @@ namespace yg
shared_ptr<DrawGeometry> command(new DrawGeometry());
command->m_texture = texture;
command->m_indices = indices;
command->m_vertices = vertices;
command->m_storage = storage;
command->m_indicesCount = indicesCount;
command->m_indicesOffs = indicesOffs;
command->m_primitiveType = primType;

View file

@ -46,8 +46,7 @@ namespace yg
struct DrawGeometry : Command
{
shared_ptr<BaseTexture> m_texture;
shared_ptr<VertexBuffer> m_vertices;
shared_ptr<IndexBuffer> m_indices;
Storage m_storage;
size_t m_indicesCount;
size_t m_indicesOffs;
unsigned m_primitiveType;
@ -107,8 +106,7 @@ namespace yg
void applyStates();
void drawGeometry(shared_ptr<BaseTexture> const & texture,
shared_ptr<VertexBuffer> const & vertices,
shared_ptr<IndexBuffer> const & indices,
Storage const & storage,
size_t indicesCount,
size_t indicesOffs,
unsigned primType);

View file

@ -40,13 +40,12 @@ namespace yg
}
void RenderStateUpdater::drawGeometry(shared_ptr<BaseTexture> const & texture,
shared_ptr<VertexBuffer> const & vertices,
shared_ptr<IndexBuffer> const & indices,
Storage const & storage,
size_t indicesCount,
size_t indicesOffs,
unsigned primType)
{
base_t::drawGeometry(texture, vertices, indices, indicesCount, indicesOffs, primType);
base_t::drawGeometry(texture, storage, indicesCount, indicesOffs, primType);
m_indicesCount += indicesCount;
if (m_doPeriodicalUpdate
&& m_renderState

View file

@ -61,8 +61,7 @@ namespace yg
shared_ptr<RenderState> const & renderState() const;
void drawGeometry(shared_ptr<BaseTexture> const & texture,
shared_ptr<VertexBuffer> const & vertices,
shared_ptr<IndexBuffer> const & indices,
Storage const & storage,
size_t indicesCount,
size_t indicesOffs,
unsigned primType);