From 162d467b4a8ca1dae6b16ece1728873d43a287ac Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 3 Mar 2011 16:14:52 -0600 Subject: SH-1085 Fix for crash when unchecking "mirror." Basically got LLFace to be paranoid about who gets to touch its LLVertexBuffer members. Reviewed by Nyx. --- indra/newview/llvoavatar.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e982df1c92..aa7349f129 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2016,26 +2016,29 @@ void LLVOAvatar::updateMeshData() bool terse_update = false; - if(facep->mVertexBuffer.isNull()) + facep->setGeomIndex(0); + facep->setIndicesIndex(0); + + LLVertexBuffer* buff = facep->getVertexBuffer(); + if(!facep->getVertexBuffer()) { - facep->mVertexBuffer = new LLVertexBufferAvatar(); - facep->mVertexBuffer->allocateBuffer(num_vertices, num_indices, TRUE); + buff = new LLVertexBufferAvatar(); + buff->allocateBuffer(num_vertices, num_indices, TRUE); + facep->setVertexBuffer(buff); } else { - if (facep->mVertexBuffer->getRequestedIndices() == num_indices && - facep->mVertexBuffer->getRequestedVerts() == num_vertices) + if (buff->getRequestedIndices() == num_indices && + buff->getRequestedVerts() == num_vertices) { terse_update = true; } else { - facep->mVertexBuffer->resizeBuffer(num_vertices, num_indices) ; - } + buff->resizeBuffer(num_vertices, num_indices); + } } - - facep->setGeomIndex(0); - facep->setIndicesIndex(0); + // This is a hack! Avatars have their own pool, so we are detecting // the case of more than one avatar in the pool (thus > 0 instead of >= 0) @@ -2050,7 +2053,7 @@ void LLVOAvatar::updateMeshData() } stop_glerror(); - facep->mVertexBuffer->setBuffer(0); + buff->setBuffer(0); if(!f_num) { @@ -4006,7 +4009,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) LLFace* face = mDrawable->getFace(0); - bool needs_rebuild = !face || face->mVertexBuffer.isNull() || mDrawable->isState(LLDrawable::REBUILD_GEOMETRY); + bool needs_rebuild = !face || !face->getVertexBuffer() || mDrawable->isState(LLDrawable::REBUILD_GEOMETRY); if (needs_rebuild || mDirtyMesh) { //LOD changed or new mesh created, allocate new vertex buffer if needed @@ -4041,7 +4044,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) mNeedsSkin = FALSE; mLastSkinTime = gFrameTimeSeconds; - LLVertexBuffer* vb = mDrawable->getFace(0)->mVertexBuffer; + LLVertexBuffer* vb = mDrawable->getFace(0)->getVertexBuffer(); if (vb) { vb->setBuffer(0); @@ -8150,7 +8153,7 @@ BOOL LLVOAvatar::updateLOD() BOOL res = updateJointLODs(); LLFace* facep = mDrawable->getFace(0); - if (facep->mVertexBuffer.isNull()) + if (!facep->getVertexBuffer()) { dirtyMesh(2); } -- cgit v1.2.3 From 85f099a868224bead0718e964214b29dfd769ffa Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 9 Mar 2011 17:08:52 -0600 Subject: SH-1063 Fix for some rigged attachments preventing avatars from impostoring (don't let rigged attachments stretch avatar bounding box beyond avatar skeleton). --- indra/newview/llvoavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index aa7349f129..a73bac39cf 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1428,7 +1428,7 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) if (attached_object && !attached_object->isHUDAttachment()) { LLDrawable* drawable = attached_object->mDrawable; - if (drawable) + if (drawable && !drawable->isState(LLDrawable::RIGGED)) { LLSpatialBridge* bridge = drawable->getSpatialBridge(); if (bridge) -- cgit v1.2.3 From 5a940793e19225c065f1e37c1be32edd936a5246 Mon Sep 17 00:00:00 2001 From: prep linden Date: Wed, 16 Mar 2011 10:15:06 -0400 Subject: WIP:Manual pelvis offset --- indra/newview/llvoavatar.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'indra/newview/llvoavatar.cpp') diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index a73bac39cf..5f0e4bcded 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -761,6 +761,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mDebugExistenceTimer.reset(); mPelvisOffset = LLVector3(0.0f,0.0f,0.0f); mLastPelvisToFoot = 0.0f; + mPelvisFixup = 0.0f; } //------------------------------------------------------------------------ @@ -3332,7 +3333,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) mTimeVisible.reset(); } - + //-------------------------------------------------------------------- // the rest should only be done occasionally for far away avatars //-------------------------------------------------------------------- @@ -3786,13 +3787,15 @@ void LLVOAvatar::updateHeadOffset() //------------------------------------------------------------------------ // setPelvisOffset //------------------------------------------------------------------------ -void LLVOAvatar::setPelvisOffset( bool hasOffset, const LLVector3& offsetAmount ) +void LLVOAvatar::setPelvisOffset( bool hasOffset, const LLVector3& offsetAmount, F32 pelvisFixup ) { mHasPelvisOffset = hasOffset; if ( mHasPelvisOffset ) { + //Store off last pelvis to foot value mLastPelvisToFoot = mPelvisToFoot; - mPelvisOffset = offsetAmount; + mPelvisOffset = offsetAmount; + mPelvisFixup = pelvisFixup; } } //------------------------------------------------------------------------ @@ -5882,7 +5885,8 @@ LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* vi // correctly, but putting this check in here to be safe. if (attachmentID & ATTACHMENT_ADD) { - llwarns << "Got an attachment with ATTACHMENT_ADD mask, removing ( attach pt:" << attachmentID << " )" << llendl; attachmentID &= ~ATTACHMENT_ADD; + llwarns << "Got an attachment with ATTACHMENT_ADD mask, removing ( attach pt:" << attachmentID << " )" << llendl; + attachmentID &= ~ATTACHMENT_ADD; } LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL); -- cgit v1.2.3