diff options
author | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
commit | cd17687f01420952712a500107e0f93e7ab8d5f8 (patch) | |
tree | ce48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/llviewerjointattachment.cpp | |
parent | Second Life viewer sources 1.19.0.5 (diff) | |
download | meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2 meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz |
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/newview/llviewerjointattachment.cpp')
-rw-r--r-- | linden/indra/newview/llviewerjointattachment.cpp | 67 |
1 files changed, 35 insertions, 32 deletions
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 @@ | |||
38 | #include "llviewercontrol.h" | 38 | #include "llviewercontrol.h" |
39 | #include "lldrawable.h" | 39 | #include "lldrawable.h" |
40 | #include "llgl.h" | 40 | #include "llgl.h" |
41 | #include "llglimmediate.h" | ||
41 | #include "llvoavatar.h" | 42 | #include "llvoavatar.h" |
42 | #include "llvolume.h" | 43 | #include "llvolume.h" |
43 | #include "pipeline.h" | 44 | #include "pipeline.h" |
45 | #include "llspatialpartition.h" | ||
44 | #include "llinventorymodel.h" | 46 | #include "llinventorymodel.h" |
45 | #include "llviewerobjectlist.h" | 47 | #include "llviewerobjectlist.h" |
46 | #include "llface.h" | 48 | #include "llface.h" |
@@ -56,7 +58,6 @@ extern LLPipeline gPipeline; | |||
56 | LLViewerJointAttachment::LLViewerJointAttachment() : | 58 | LLViewerJointAttachment::LLViewerJointAttachment() : |
57 | mJoint(NULL), | 59 | mJoint(NULL), |
58 | mAttachedObject(NULL), | 60 | mAttachedObject(NULL), |
59 | mAttachmentDirty(FALSE), | ||
60 | mVisibleInFirst(FALSE), | 61 | mVisibleInFirst(FALSE), |
61 | mGroup(0), | 62 | mGroup(0), |
62 | mIsHUDAttachment(FALSE), | 63 | mIsHUDAttachment(FALSE), |
@@ -90,36 +91,18 @@ U32 LLViewerJointAttachment::drawShape( F32 pixelArea, BOOL first_pass ) | |||
90 | { | 91 | { |
91 | LLGLDisable cull_face(GL_CULL_FACE); | 92 | LLGLDisable cull_face(GL_CULL_FACE); |
92 | 93 | ||
93 | glColor4f(1.f, 1.f, 1.f, 1.f); | 94 | gGL.color4f(1.f, 1.f, 1.f, 1.f); |
94 | glBegin(GL_QUADS); | 95 | gGL.begin(GL_QUADS); |
95 | { | 96 | { |
96 | glVertex3f(-0.1f, 0.1f, 0.f); | 97 | gGL.vertex3f(-0.1f, 0.1f, 0.f); |
97 | glVertex3f(-0.1f, -0.1f, 0.f); | 98 | gGL.vertex3f(-0.1f, -0.1f, 0.f); |
98 | glVertex3f(0.1f, -0.1f, 0.f); | 99 | gGL.vertex3f(0.1f, -0.1f, 0.f); |
99 | glVertex3f(0.1f, 0.1f, 0.f); | 100 | gGL.vertex3f(0.1f, 0.1f, 0.f); |
100 | }glEnd(); | 101 | }gGL.end(); |
101 | } | 102 | } |
102 | return 0; | 103 | return 0; |
103 | } | 104 | } |
104 | 105 | ||
105 | //----------------------------------------------------------------------------- | ||
106 | // lazyAttach() | ||
107 | //----------------------------------------------------------------------------- | ||
108 | void LLViewerJointAttachment::lazyAttach() | ||
109 | { | ||
110 | if (!mAttachedObject) | ||
111 | { | ||
112 | return; | ||
113 | } | ||
114 | LLDrawable *drawablep = mAttachedObject->mDrawable; | ||
115 | |||
116 | if (mAttachmentDirty && drawablep) | ||
117 | { | ||
118 | setupDrawable(drawablep); | ||
119 | mAttachmentDirty = FALSE; | ||
120 | } | ||
121 | } | ||
122 | |||
123 | void LLViewerJointAttachment::setupDrawable(LLDrawable* drawablep) | 106 | void LLViewerJointAttachment::setupDrawable(LLDrawable* drawablep) |
124 | { | 107 | { |
125 | drawablep->mXform.setParent(&mXform); // LLViewerJointAttachment::lazyAttach | 108 | drawablep->mXform.setParent(&mXform); // LLViewerJointAttachment::lazyAttach |
@@ -174,7 +157,20 @@ BOOL LLViewerJointAttachment::addObject(LLViewerObject* object) | |||
174 | if (mAttachedObject) | 157 | if (mAttachedObject) |
175 | { | 158 | { |
176 | llwarns << "Attempted to attach object where an attachment already exists!" << llendl; | 159 | llwarns << "Attempted to attach object where an attachment already exists!" << llendl; |
177 | return FALSE; | 160 | |
161 | if (mAttachedObject == object) { | ||
162 | llinfos << "(same object re-attached)" << llendl; | ||
163 | removeObject(mAttachedObject); | ||
164 | // Pass through anyway to let setupDrawable() | ||
165 | // re-connect object to the joint correctly | ||
166 | } | ||
167 | else { | ||
168 | llinfos << "(objects differ, removing existing object)" << llendl; | ||
169 | // Rather hacky, but no-one can think of something | ||
170 | // better to do for this case. | ||
171 | gObjectList.killObject(mAttachedObject); | ||
172 | // Proceed with new object attachment | ||
173 | } | ||
178 | } | 174 | } |
179 | mAttachedObject = object; | 175 | mAttachedObject = object; |
180 | 176 | ||
@@ -198,13 +194,14 @@ BOOL LLViewerJointAttachment::addObject(LLViewerObject* object) | |||
198 | 194 | ||
199 | if (drawablep) | 195 | if (drawablep) |
200 | { | 196 | { |
197 | //if object is active, make it static | ||
198 | if(drawablep->isActive()) | ||
199 | { | ||
200 | drawablep->makeStatic() ; | ||
201 | } | ||
202 | |||
201 | setupDrawable(drawablep); | 203 | setupDrawable(drawablep); |
202 | } | 204 | } |
203 | else | ||
204 | { | ||
205 | // do lazy update once we have a drawable for this object | ||
206 | mAttachmentDirty = TRUE; | ||
207 | } | ||
208 | 205 | ||
209 | if (mIsHUDAttachment) | 206 | if (mIsHUDAttachment) |
210 | { | 207 | { |
@@ -238,6 +235,12 @@ void LLViewerJointAttachment::removeObject(LLViewerObject *object) | |||
238 | 235 | ||
239 | if (object->mDrawable.notNull()) | 236 | if (object->mDrawable.notNull()) |
240 | { | 237 | { |
238 | //if object is active, make it static | ||
239 | if(object->mDrawable->isActive()) | ||
240 | { | ||
241 | object->mDrawable->makeStatic() ; | ||
242 | } | ||
243 | |||
241 | LLVector3 cur_position = object->getRenderPosition(); | 244 | LLVector3 cur_position = object->getRenderPosition(); |
242 | LLQuaternion cur_rotation = object->getRenderRotation(); | 245 | LLQuaternion cur_rotation = object->getRenderRotation(); |
243 | 246 | ||