diff options
author | Dave Parks <davep@lindenlab.com> | 2011-08-17 12:55:32 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-08-17 12:55:32 -0500 |
commit | f7d17cad5cc3784abb0dea4fb5bec967cbc1f81b (patch) | |
tree | 8275389cc7f13ac4b3e2084c0288d2b2b06ecbeb /indra/newview/lldrawpoolavatar.cpp | |
parent | 5c0df02df5abdadbf17235ae5d7208963c25f1ce (diff) |
SH-2188 Fix for generally bad vertex buffer updates for rigged attachments and fix for viewer always thinking meshes initially have 8 texture entries.
Diffstat (limited to 'indra/newview/lldrawpoolavatar.cpp')
-rw-r--r-- | indra/newview/lldrawpoolavatar.cpp | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 9f790d03fe..984014f309 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1283,30 +1283,38 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace* return; } - LLVertexBuffer* buffer = face->getVertexBuffer(); + LLPointer<LLVertexBuffer> buffer = face->getVertexBuffer(); + LLDrawable* drawable = face->getDrawable(); U32 data_mask = face->getRiggedVertexBufferDataMask(); - if (!buffer || + if (buffer.isNull() || buffer->getTypeMask() != data_mask || - buffer->getRequestedVerts() != vol_face.mNumVertices) + buffer->getRequestedVerts() != vol_face.mNumVertices || + buffer->getRequestedIndices() != vol_face.mNumIndices || + (drawable && drawable->isState(LLDrawable::REBUILD_ALL))) { face->setGeomIndex(0); face->setIndicesIndex(0); - face->setSize(vol_face.mNumVertices, vol_face.mNumIndices, true); - - - if (sShaderLevel > 0) - { - buffer = new LLVertexBuffer(data_mask, GL_DYNAMIC_DRAW_ARB); + + if (buffer.isNull() || buffer->getTypeMask() != data_mask) + { //make a new buffer + if (sShaderLevel > 0) + { + buffer = new LLVertexBuffer(data_mask, GL_DYNAMIC_DRAW_ARB); + } + else + { + buffer = new LLVertexBuffer(data_mask, GL_STREAM_DRAW_ARB); + } + buffer->allocateBuffer(vol_face.mNumVertices, vol_face.mNumIndices, true); } else - { - buffer = new LLVertexBuffer(data_mask, GL_STREAM_DRAW_ARB); + { //resize existing buffer + buffer->resizeBuffer(vol_face.mNumVertices, vol_face.mNumIndices); } - buffer->allocateBuffer(face->getGeomCount(), face->getIndicesCount(), true); - + face->setSize(vol_face.mNumVertices, vol_face.mNumIndices); face->setVertexBuffer(buffer); U16 offset = 0; @@ -1407,6 +1415,11 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace* } } } + + if (drawable && (face->getTEOffset() == drawable->getNumFaces()-1)) + { + drawable->clearState(LLDrawable::REBUILD_ALL); + } } void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) @@ -1437,7 +1450,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) LLVolume* volume = vobj->getVolume(); S32 te = face->getTEOffset(); - if (!volume || volume->getNumVolumeFaces() <= te) + if (!volume || volume->getNumVolumeFaces() <= te || !volume->isMeshAssetLoaded()) { continue; } |