diff options
Diffstat (limited to 'linden/indra/newview/llviewerobject.cpp')
-rw-r--r-- | linden/indra/newview/llviewerobject.cpp | 82 |
1 files changed, 54 insertions, 28 deletions
diff --git a/linden/indra/newview/llviewerobject.cpp b/linden/indra/newview/llviewerobject.cpp index c560ced..6dc9af1 100644 --- a/linden/indra/newview/llviewerobject.cpp +++ b/linden/indra/newview/llviewerobject.cpp | |||
@@ -150,6 +150,8 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco | |||
150 | res = new LLVOGround(id, pcode, regionp); break; | 150 | res = new LLVOGround(id, pcode, regionp); break; |
151 | case LL_VO_PART_GROUP: | 151 | case LL_VO_PART_GROUP: |
152 | res = new LLVOPartGroup(id, pcode, regionp); break; | 152 | res = new LLVOPartGroup(id, pcode, regionp); break; |
153 | case LL_VO_HUD_PART_GROUP: | ||
154 | res = new LLVOHUDPartGroup(id, pcode, regionp); break; | ||
153 | case LL_VO_WL_SKY: | 155 | case LL_VO_WL_SKY: |
154 | res = new LLVOWLSky(id, pcode, regionp); break; | 156 | res = new LLVOWLSky(id, pcode, regionp); break; |
155 | default: | 157 | default: |
@@ -159,7 +161,7 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco | |||
159 | return res; | 161 | return res; |
160 | } | 162 | } |
161 | 163 | ||
162 | LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) | 164 | LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp, BOOL is_global) |
163 | : LLPrimitive(), | 165 | : LLPrimitive(), |
164 | mChildList(), | 166 | mChildList(), |
165 | mID(id), | 167 | mID(id), |
@@ -201,7 +203,10 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe | |||
201 | mMedia(NULL), | 203 | mMedia(NULL), |
202 | mClickAction(0) | 204 | mClickAction(0) |
203 | { | 205 | { |
204 | llassert(mRegionp); | 206 | if(!is_global) |
207 | { | ||
208 | llassert(mRegionp); | ||
209 | } | ||
205 | 210 | ||
206 | LLPrimitive::init_primitive(pcode); | 211 | LLPrimitive::init_primitive(pcode); |
207 | 212 | ||
@@ -209,7 +214,11 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe | |||
209 | mLastInterpUpdateSecs = LLFrameTimer::getElapsedSeconds(); | 214 | mLastInterpUpdateSecs = LLFrameTimer::getElapsedSeconds(); |
210 | 215 | ||
211 | mPositionRegion = LLVector3(0.f, 0.f, 0.f); | 216 | mPositionRegion = LLVector3(0.f, 0.f, 0.f); |
212 | mPositionAgent = mRegionp->getOriginAgent(); | 217 | |
218 | if(!is_global) | ||
219 | { | ||
220 | mPositionAgent = mRegionp->getOriginAgent(); | ||
221 | } | ||
213 | 222 | ||
214 | LLViewerObject::sNumObjects++; | 223 | LLViewerObject::sNumObjects++; |
215 | } | 224 | } |
@@ -2763,12 +2772,6 @@ void LLViewerObject::setPixelAreaAndAngle(LLAgent &agent) | |||
2763 | 2772 | ||
2764 | BOOL LLViewerObject::updateLOD() | 2773 | BOOL LLViewerObject::updateLOD() |
2765 | { | 2774 | { |
2766 | // Update volume of looping sounds | ||
2767 | if (mAudioSourcep && mAudioSourcep->isLoop()) | ||
2768 | { | ||
2769 | F32 volume = gSavedSettings.getBOOL("MuteSounds") ? 0.f : (mAudioGain * gSavedSettings.getF32("AudioLevelSFX")); | ||
2770 | mAudioSourcep->setGain(volume); | ||
2771 | } | ||
2772 | return FALSE; | 2775 | return FALSE; |
2773 | } | 2776 | } |
2774 | 2777 | ||
@@ -3055,28 +3058,38 @@ LLNameValue *LLViewerObject::getNVPair(const std::string& name) const | |||
3055 | 3058 | ||
3056 | void LLViewerObject::updatePositionCaches() const | 3059 | void LLViewerObject::updatePositionCaches() const |
3057 | { | 3060 | { |
3058 | if (!isRoot()) | 3061 | if(mRegionp) |
3059 | { | ||
3060 | mPositionRegion = ((LLViewerObject *)getParent())->getPositionRegion() + getPosition() * getParent()->getRotation(); | ||
3061 | mPositionAgent = mRegionp->getPosAgentFromRegion(mPositionRegion); | ||
3062 | } | ||
3063 | else | ||
3064 | { | 3062 | { |
3065 | mPositionRegion = getPosition(); | 3063 | if (!isRoot()) |
3066 | mPositionAgent = mRegionp->getPosAgentFromRegion(mPositionRegion); | 3064 | { |
3065 | mPositionRegion = ((LLViewerObject *)getParent())->getPositionRegion() + getPosition() * getParent()->getRotation(); | ||
3066 | mPositionAgent = mRegionp->getPosAgentFromRegion(mPositionRegion); | ||
3067 | } | ||
3068 | else | ||
3069 | { | ||
3070 | mPositionRegion = getPosition(); | ||
3071 | mPositionAgent = mRegionp->getPosAgentFromRegion(mPositionRegion); | ||
3072 | } | ||
3067 | } | 3073 | } |
3068 | } | 3074 | } |
3069 | 3075 | ||
3070 | const LLVector3d LLViewerObject::getPositionGlobal() const | 3076 | const LLVector3d LLViewerObject::getPositionGlobal() const |
3071 | { | 3077 | { |
3072 | LLVector3d position_global = mRegionp->getPosGlobalFromRegion(getPositionRegion()); | 3078 | if(mRegionp) |
3073 | |||
3074 | if (isAttachment()) | ||
3075 | { | 3079 | { |
3076 | position_global = gAgent.getPosGlobalFromAgent(getRenderPosition()); | 3080 | LLVector3d position_global = mRegionp->getPosGlobalFromRegion(getPositionRegion()); |
3077 | } | ||
3078 | 3081 | ||
3079 | return position_global; | 3082 | if (isAttachment()) |
3083 | { | ||
3084 | position_global = gAgent.getPosGlobalFromAgent(getRenderPosition()); | ||
3085 | } | ||
3086 | return position_global; | ||
3087 | } | ||
3088 | else | ||
3089 | { | ||
3090 | LLVector3d position_global(getPosition()); | ||
3091 | return position_global; | ||
3092 | } | ||
3080 | } | 3093 | } |
3081 | 3094 | ||
3082 | const LLVector3 &LLViewerObject::getPositionAgent() const | 3095 | const LLVector3 &LLViewerObject::getPositionAgent() const |
@@ -3398,6 +3411,7 @@ LLViewerObject* LLViewerObject::getRootEdit() const | |||
3398 | 3411 | ||
3399 | BOOL LLViewerObject::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, | 3412 | BOOL LLViewerObject::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, |
3400 | S32 face, | 3413 | S32 face, |
3414 | BOOL pick_transparent, | ||
3401 | S32* face_hit, | 3415 | S32* face_hit, |
3402 | LLVector3* intersection, | 3416 | LLVector3* intersection, |
3403 | LLVector2* tex_coord, | 3417 | LLVector2* tex_coord, |
@@ -3407,6 +3421,20 @@ BOOL LLViewerObject::lineSegmentIntersect(const LLVector3& start, const LLVector | |||
3407 | return false; | 3421 | return false; |
3408 | } | 3422 | } |
3409 | 3423 | ||
3424 | BOOL LLViewerObject::lineSegmentBoundingBox(const LLVector3& start, const LLVector3& end) | ||
3425 | { | ||
3426 | if (mDrawable.isNull() || mDrawable->isDead()) | ||
3427 | { | ||
3428 | return FALSE; | ||
3429 | } | ||
3430 | |||
3431 | const LLVector3* ext = mDrawable->getSpatialExtents(); | ||
3432 | |||
3433 | LLVector3 center = (ext[1]+ext[0])*0.5f; | ||
3434 | LLVector3 size = (ext[1]-ext[0])*0.5f; | ||
3435 | |||
3436 | return LLLineSegmentBoxIntersect(start, end, center, size); | ||
3437 | } | ||
3410 | 3438 | ||
3411 | U8 LLViewerObject::getMediaType() const | 3439 | U8 LLViewerObject::getMediaType() const |
3412 | { | 3440 | { |
@@ -4331,8 +4359,7 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow | |||
4331 | { | 4359 | { |
4332 | BOOL queue = flags & LL_SOUND_FLAG_QUEUE; | 4360 | BOOL queue = flags & LL_SOUND_FLAG_QUEUE; |
4333 | mAudioGain = gain; | 4361 | mAudioGain = gain; |
4334 | F32 volume = gSavedSettings.getBOOL("MuteSounds") ? 0.f : gain * gSavedSettings.getF32("AudioLevelSFX"); | 4362 | mAudioSourcep->setGain(gain); |
4335 | mAudioSourcep->setGain(volume); | ||
4336 | mAudioSourcep->setLoop(flags & LL_SOUND_FLAG_LOOP); | 4363 | mAudioSourcep->setLoop(flags & LL_SOUND_FLAG_LOOP); |
4337 | mAudioSourcep->setSyncMaster(flags & LL_SOUND_FLAG_SYNC_MASTER); | 4364 | mAudioSourcep->setSyncMaster(flags & LL_SOUND_FLAG_SYNC_MASTER); |
4338 | mAudioSourcep->setSyncSlave(flags & LL_SOUND_FLAG_SYNC_SLAVE); | 4365 | mAudioSourcep->setSyncSlave(flags & LL_SOUND_FLAG_SYNC_SLAVE); |
@@ -4370,8 +4397,7 @@ void LLViewerObject::adjustAudioGain(const F32 gain) | |||
4370 | if (mAudioSourcep) | 4397 | if (mAudioSourcep) |
4371 | { | 4398 | { |
4372 | mAudioGain = gain; | 4399 | mAudioGain = gain; |
4373 | F32 volume = gSavedSettings.getBOOL("MuteSounds") ? 0.f : mAudioGain * gSavedSettings.getF32("AudioLevelSFX"); | 4400 | mAudioSourcep->setGain(mAudioGain); |
4374 | mAudioSourcep->setGain(volume); | ||
4375 | } | 4401 | } |
4376 | } | 4402 | } |
4377 | 4403 | ||