From 89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:44:50 -0500 Subject: Second Life viewer sources 1.14.0.0 --- linden/indra/newview/llsprite.cpp | 42 ++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'linden/indra/newview/llsprite.cpp') diff --git a/linden/indra/newview/llsprite.cpp b/linden/indra/newview/llsprite.cpp index 601810c..fb56f4d 100644 --- a/linden/indra/newview/llsprite.cpp +++ b/linden/indra/newview/llsprite.cpp @@ -94,14 +94,7 @@ void LLSprite::updateFace(LLFace &face) // First, figure out how many vertices/indices we need. U32 num_vertices, num_indices; U32 vertex_count = 0; - - - LLStrider verticesp; - LLStrider normalsp; - LLStrider tex_coordsp; - U32 *indicesp; - S32 index_offset; - + // Get the total number of vertices and indices if (mFollow) { @@ -114,14 +107,7 @@ void LLSprite::updateFace(LLFace &face) num_indices = 12; } - // Setup face - face.setPrimType(LLTriangles); face.setSize(num_vertices, num_indices); - index_offset = face.getGeometry(verticesp,normalsp,tex_coordsp, indicesp); - if (-1 == index_offset) - { - return; - } if (mFollow) { @@ -206,7 +192,30 @@ void LLSprite::updateFace(LLFace &face) } face.setFaceColor(mColor); - + + LLStrider verticesp; + LLStrider normalsp; + LLStrider tex_coordsp; + LLStrider indicesp; + S32 index_offset; + + // Setup face + if (face.mVertexBuffer.isNull()) + { + face.mVertexBuffer = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | + LLVertexBuffer::MAP_TEXCOORD, + GL_STREAM_DRAW_ARB); + face.mVertexBuffer->allocateBuffer(4, 12, TRUE); + face.setGeomIndex(0); + face.setIndicesIndex(0); + } + + index_offset = face.getGeometry(verticesp,normalsp,tex_coordsp, indicesp); + if (-1 == index_offset) + { + return; + } + *tex_coordsp = LLVector2(0.f, 0.f); *verticesp = mC; tex_coordsp++; @@ -251,6 +260,7 @@ void LLSprite::updateFace(LLFace &face) *indicesp++ = 3 + index_offset; } + //face.mVertexBuffer->setBuffer(0); face.mCenterAgent = mPosition; } -- cgit v1.1