summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawpoolavatar.cpp
diff options
context:
space:
mode:
authorRichard Nelson <richard@lindenlab.com>2011-10-03 13:23:50 -0700
committerRichard Nelson <richard@lindenlab.com>2011-10-03 13:23:50 -0700
commit0ecc5c0878adf93e96b99e3db4c65cdb757b99fb (patch)
tree25741079cb8edf161b07741decffb43ffa04b144 /indra/newview/lldrawpoolavatar.cpp
parent6eb09ab2ae9c90b23c8af1929e7d0a2088a6e76e (diff)
parentfa3b55e68a00359f8b37b1225337e615b3f6da4d (diff)
Automated merge with ssh://hg.lindenlab.com/richard/viewer-experience
Diffstat (limited to 'indra/newview/lldrawpoolavatar.cpp')
-rw-r--r--indra/newview/lldrawpoolavatar.cpp41
1 files changed, 27 insertions, 14 deletions
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index 28e464b60d..37ee81aeb5 100644
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -1299,30 +1299,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;
@@ -1423,6 +1431,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)
@@ -1453,7 +1466,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;
}