From adf601ef1f46e5728988a08068cb2a8b16c7a056 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Sat, 6 Feb 2010 17:33:12 -0600 Subject: Draw prims using triangle strips instead of triangle lists. --- indra/newview/llface.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 80acc71a41..ebebd485d2 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -870,7 +870,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, llpushcallstacks ; const LLVolumeFace &vf = volume.getVolumeFace(f); S32 num_vertices = (S32)vf.mVertices.size(); - S32 num_indices = (S32)vf.mIndices.size(); + S32 num_indices = LLPipeline::sUseTriStrips ? (S32)vf.mTriStrip.size() : (S32) vf.mIndices.size(); if (mVertexBuffer.notNull()) { @@ -1063,9 +1063,19 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (full_rebuild) { mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex); - for (U16 i = 0; i < num_indices; i++) + if (LLPipeline::sUseTriStrips) { - *indicesp++ = vf.mIndices[i] + index_offset; + for (U16 i = 0; i < num_indices; i++) + { + *indicesp++ = vf.mTriStrip[i] + index_offset; + } + } + else + { + for (U16 i = 0; i < num_indices; i++) + { + *indicesp++ = vf.mIndices[i] + index_offset; + } } } @@ -1617,8 +1627,13 @@ S32 LLFace::pushVertices(const U16* index_array) const { if (mIndicesCount) { - mVertexBuffer->drawRange(LLRender::TRIANGLES, mGeomIndex, mGeomIndex+mGeomCount-1, mIndicesCount, mIndicesIndex); - gPipeline.addTrianglesDrawn(mIndicesCount/3); + U32 render_type = LLRender::TRIANGLES; + if (mDrawInfo) + { + render_type = mDrawInfo->mDrawMode; + } + mVertexBuffer->drawRange(render_type, mGeomIndex, mGeomIndex+mGeomCount-1, mIndicesCount, mIndicesIndex); + gPipeline.addTrianglesDrawn(mIndicesCount, render_type); } return mIndicesCount; -- cgit v1.2.3 From fb248e7ad01ad0ffe74e4f9c3297ebf9f12bd797 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 10 Feb 2010 14:47:53 -0600 Subject: Fix for U16 dumbness (can have > 64K indices) --- indra/newview/llface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index ebebd485d2..c473be852d 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1065,14 +1065,14 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex); if (LLPipeline::sUseTriStrips) { - for (U16 i = 0; i < num_indices; i++) + for (U32 i = 0; i < num_indices; i++) { *indicesp++ = vf.mTriStrip[i] + index_offset; } } else { - for (U16 i = 0; i < num_indices; i++) + for (U32 i = 0; i < num_indices; i++) { *indicesp++ = vf.mIndices[i] + index_offset; } -- cgit v1.2.3 From 245fe3edc6fa7333c16efcc90a4a52db8450a828 Mon Sep 17 00:00:00 2001 From: Palmer Truelson Date: Tue, 23 Feb 2010 23:02:20 -0800 Subject: Fix compiler complaints about signed/unsigned mismatch --- indra/newview/llface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llface.cpp') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index c473be852d..9de69a8173 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1065,14 +1065,14 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex); if (LLPipeline::sUseTriStrips) { - for (U32 i = 0; i < num_indices; i++) + for (U32 i = 0; i < (U32) num_indices; i++) { *indicesp++ = vf.mTriStrip[i] + index_offset; } } else { - for (U32 i = 0; i < num_indices; i++) + for (U32 i = 0; i < (U32) num_indices; i++) { *indicesp++ = vf.mIndices[i] + index_offset; } -- cgit v1.2.3