From cd17687f01420952712a500107e0f93e7ab8d5f8 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:45:34 -0500 Subject: Second Life viewer sources 1.19.1.0 --- linden/indra/newview/llviewerjointattachment.cpp | 67 +++++++++++++----------- 1 file changed, 35 insertions(+), 32 deletions(-) (limited to 'linden/indra/newview/llviewerjointattachment.cpp') diff --git a/linden/indra/newview/llviewerjointattachment.cpp b/linden/indra/newview/llviewerjointattachment.cpp index 1348ad0..0747f68 100644 --- a/linden/indra/newview/llviewerjointattachment.cpp +++ b/linden/indra/newview/llviewerjointattachment.cpp @@ -38,9 +38,11 @@ #include "llviewercontrol.h" #include "lldrawable.h" #include "llgl.h" +#include "llglimmediate.h" #include "llvoavatar.h" #include "llvolume.h" #include "pipeline.h" +#include "llspatialpartition.h" #include "llinventorymodel.h" #include "llviewerobjectlist.h" #include "llface.h" @@ -56,7 +58,6 @@ extern LLPipeline gPipeline; LLViewerJointAttachment::LLViewerJointAttachment() : mJoint(NULL), mAttachedObject(NULL), -mAttachmentDirty(FALSE), mVisibleInFirst(FALSE), mGroup(0), mIsHUDAttachment(FALSE), @@ -90,36 +91,18 @@ U32 LLViewerJointAttachment::drawShape( F32 pixelArea, BOOL first_pass ) { LLGLDisable cull_face(GL_CULL_FACE); - glColor4f(1.f, 1.f, 1.f, 1.f); - glBegin(GL_QUADS); + gGL.color4f(1.f, 1.f, 1.f, 1.f); + gGL.begin(GL_QUADS); { - glVertex3f(-0.1f, 0.1f, 0.f); - glVertex3f(-0.1f, -0.1f, 0.f); - glVertex3f(0.1f, -0.1f, 0.f); - glVertex3f(0.1f, 0.1f, 0.f); - }glEnd(); + gGL.vertex3f(-0.1f, 0.1f, 0.f); + gGL.vertex3f(-0.1f, -0.1f, 0.f); + gGL.vertex3f(0.1f, -0.1f, 0.f); + gGL.vertex3f(0.1f, 0.1f, 0.f); + }gGL.end(); } return 0; } -//----------------------------------------------------------------------------- -// lazyAttach() -//----------------------------------------------------------------------------- -void LLViewerJointAttachment::lazyAttach() -{ - if (!mAttachedObject) - { - return; - } - LLDrawable *drawablep = mAttachedObject->mDrawable; - - if (mAttachmentDirty && drawablep) - { - setupDrawable(drawablep); - mAttachmentDirty = FALSE; - } -} - void LLViewerJointAttachment::setupDrawable(LLDrawable* drawablep) { drawablep->mXform.setParent(&mXform); // LLViewerJointAttachment::lazyAttach @@ -174,7 +157,20 @@ BOOL LLViewerJointAttachment::addObject(LLViewerObject* object) if (mAttachedObject) { llwarns << "Attempted to attach object where an attachment already exists!" << llendl; - return FALSE; + + if (mAttachedObject == object) { + llinfos << "(same object re-attached)" << llendl; + removeObject(mAttachedObject); + // Pass through anyway to let setupDrawable() + // re-connect object to the joint correctly + } + else { + llinfos << "(objects differ, removing existing object)" << llendl; + // Rather hacky, but no-one can think of something + // better to do for this case. + gObjectList.killObject(mAttachedObject); + // Proceed with new object attachment + } } mAttachedObject = object; @@ -198,13 +194,14 @@ BOOL LLViewerJointAttachment::addObject(LLViewerObject* object) if (drawablep) { + //if object is active, make it static + if(drawablep->isActive()) + { + drawablep->makeStatic() ; + } + setupDrawable(drawablep); } - else - { - // do lazy update once we have a drawable for this object - mAttachmentDirty = TRUE; - } if (mIsHUDAttachment) { @@ -238,6 +235,12 @@ void LLViewerJointAttachment::removeObject(LLViewerObject *object) if (object->mDrawable.notNull()) { + //if object is active, make it static + if(object->mDrawable->isActive()) + { + object->mDrawable->makeStatic() ; + } + LLVector3 cur_position = object->getRenderPosition(); LLQuaternion cur_rotation = object->getRenderRotation(); -- cgit v1.1