aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerobject.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/llviewerobject.cpp
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-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/llviewerobject.cpp')
-rw-r--r--linden/indra/newview/llviewerobject.cpp115
1 files changed, 75 insertions, 40 deletions
diff --git a/linden/indra/newview/llviewerobject.cpp b/linden/indra/newview/llviewerobject.cpp
index 50ab57c..056475b 100644
--- a/linden/indra/newview/llviewerobject.cpp
+++ b/linden/indra/newview/llviewerobject.cpp
@@ -86,7 +86,6 @@
86#include "llvolumemessage.h" 86#include "llvolumemessage.h"
87#include "llvopartgroup.h" 87#include "llvopartgroup.h"
88#include "llvosky.h" 88#include "llvosky.h"
89#include "llvostars.h"
90#include "llvosurfacepatch.h" 89#include "llvosurfacepatch.h"
91#include "llvotextbubble.h" 90#include "llvotextbubble.h"
92#include "llvotree.h" 91#include "llvotree.h"
@@ -96,6 +95,7 @@
96#include "llui.h" 95#include "llui.h"
97#include "pipeline.h" 96#include "pipeline.h"
98#include "llappviewer.h" 97#include "llappviewer.h"
98#include "llvowlsky.h"
99 99
100//#define DEBUG_UPDATE_TYPE 100//#define DEBUG_UPDATE_TYPE
101 101
@@ -143,14 +143,14 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco
143 res = new LLVOSurfacePatch(id, pcode, regionp); break; 143 res = new LLVOSurfacePatch(id, pcode, regionp); break;
144 case LL_VO_SKY: 144 case LL_VO_SKY:
145 res = new LLVOSky(id, pcode, regionp); break; 145 res = new LLVOSky(id, pcode, regionp); break;
146 case LL_VO_STARS:
147 res = new LLVOStars(id, pcode, regionp); break;
148 case LL_VO_WATER: 146 case LL_VO_WATER:
149 res = new LLVOWater(id, pcode, regionp); break; 147 res = new LLVOWater(id, pcode, regionp); break;
150 case LL_VO_GROUND: 148 case LL_VO_GROUND:
151 res = new LLVOGround(id, pcode, regionp); break; 149 res = new LLVOGround(id, pcode, regionp); break;
152 case LL_VO_PART_GROUP: 150 case LL_VO_PART_GROUP:
153 res = new LLVOPartGroup(id, pcode, regionp); break; 151 res = new LLVOPartGroup(id, pcode, regionp); break;
152 case LL_VO_WL_SKY:
153 res = new LLVOWLSky(id, pcode, regionp); break;
154 default: 154 default:
155 llwarns << "Unknown object pcode " << (S32)pcode << llendl; 155 llwarns << "Unknown object pcode " << (S32)pcode << llendl;
156 res = NULL; break; 156 res = NULL; break;
@@ -193,7 +193,6 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe
193 mOnMap(FALSE), 193 mOnMap(FALSE),
194 mStatic(FALSE), 194 mStatic(FALSE),
195 mNumFaces(0), 195 mNumFaces(0),
196 mLastUpdateFrame(0),
197 mTimeDilation(1.f), 196 mTimeDilation(1.f),
198 mRotTime(0.f), 197 mRotTime(0.f),
199 mJointInfo(NULL), 198 mJointInfo(NULL),
@@ -631,17 +630,19 @@ BOOL LLViewerObject::setDrawableParent(LLDrawable* parentp)
631 630
632 BOOL ret = mDrawable->mXform.setParent(parentp ? &parentp->mXform : NULL); 631 BOOL ret = mDrawable->mXform.setParent(parentp ? &parentp->mXform : NULL);
633 gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE); 632 gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE);
634 if (old_parent || (parentp && parentp->isActive())) 633 if( old_parent != parentp &&
634 old_parent || (parentp && parentp->isActive()))
635 { 635 {
636 // *TODO we should not be relying on setDrawable parent to call markMoved
636 gPipeline.markMoved(mDrawable, FALSE); 637 gPipeline.markMoved(mDrawable, FALSE);
637 } 638 }
638 else 639 else if (!mDrawable->isAvatar())
639 { 640 {
640 mDrawable->updateXform(TRUE); 641 mDrawable->updateXform(TRUE);
641 if (!mDrawable->getSpatialGroup()) 642 /*if (!mDrawable->getSpatialGroup())
642 { 643 {
643 mDrawable->movePartition(); 644 mDrawable->movePartition();
644 } 645 }*/
645 } 646 }
646 647
647 return ret; 648 return ret;
@@ -677,7 +678,6 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
677 LLDataPacker *dp) 678 LLDataPacker *dp)
678{ 679{
679 LLMemType mt(LLMemType::MTYPE_OBJECT); 680 LLMemType mt(LLMemType::MTYPE_OBJECT);
680
681 U32 retval = 0x0; 681 U32 retval = 0x0;
682 682
683 // Coordinates of objects on simulators are region-local. 683 // Coordinates of objects on simulators are region-local.
@@ -2292,7 +2292,7 @@ void LLViewerObject::dirtyInventory()
2292 // If there aren't any LLVOInventoryListeners, we won't be 2292 // If there aren't any LLVOInventoryListeners, we won't be
2293 // able to update our mInventory when it comes back from the 2293 // able to update our mInventory when it comes back from the
2294 // simulator, so we should not clear the inventory either. 2294 // simulator, so we should not clear the inventory either.
2295 if(mInventory && !mInventoryCallbacks.isEmpty()) 2295 if(mInventory && !mInventoryCallbacks.empty())
2296 { 2296 {
2297 mInventory->clear(); // will deref and delete entries 2297 mInventory->clear(); // will deref and delete entries
2298 delete mInventory; 2298 delete mInventory;
@@ -2308,20 +2308,22 @@ void LLViewerObject::registerInventoryListener(LLVOInventoryListener* listener,
2308 LLInventoryCallbackInfo* info = new LLInventoryCallbackInfo; 2308 LLInventoryCallbackInfo* info = new LLInventoryCallbackInfo;
2309 info->mListener = listener; 2309 info->mListener = listener;
2310 info->mInventoryData = user_data; 2310 info->mInventoryData = user_data;
2311 mInventoryCallbacks.addData(info); 2311 mInventoryCallbacks.push_front(info);
2312} 2312}
2313 2313
2314void LLViewerObject::removeInventoryListener(LLVOInventoryListener* listener) 2314void LLViewerObject::removeInventoryListener(LLVOInventoryListener* listener)
2315{ 2315{
2316 if (listener == NULL) return; 2316 if (listener == NULL)
2317 LLInventoryCallbackInfo* info; 2317 return;
2318 for (info = mInventoryCallbacks.getFirstData(); 2318 for (callback_list_t::iterator iter = mInventoryCallbacks.begin();
2319 info; 2319 iter != mInventoryCallbacks.end(); )
2320 info = mInventoryCallbacks.getNextData() )
2321 { 2320 {
2321 callback_list_t::iterator curiter = iter++;
2322 LLInventoryCallbackInfo* info = *curiter;
2322 if (info->mListener == listener) 2323 if (info->mListener == listener)
2323 { 2324 {
2324 mInventoryCallbacks.deleteCurrentData(); 2325 delete info;
2326 mInventoryCallbacks.erase(curiter);
2325 break; 2327 break;
2326 } 2328 }
2327 } 2329 }
@@ -2329,7 +2331,8 @@ void LLViewerObject::removeInventoryListener(LLVOInventoryListener* listener)
2329 2331
2330void LLViewerObject::clearInventoryListeners() 2332void LLViewerObject::clearInventoryListeners()
2331{ 2333{
2332 mInventoryCallbacks.deleteAllData(); 2334 for_each(mInventoryCallbacks.begin(), mInventoryCallbacks.end(), DeletePointer());
2335 mInventoryCallbacks.clear();
2333} 2336}
2334 2337
2335void LLViewerObject::requestInventory() 2338void LLViewerObject::requestInventory()
@@ -2518,10 +2521,11 @@ void LLViewerObject::loadTaskInvFile(const char* filename)
2518 2521
2519void LLViewerObject::doInventoryCallback() 2522void LLViewerObject::doInventoryCallback()
2520{ 2523{
2521 for(LLInventoryCallbackInfo* info = mInventoryCallbacks.getFirstData(); 2524 for (callback_list_t::iterator iter = mInventoryCallbacks.begin();
2522 info != NULL; 2525 iter != mInventoryCallbacks.end(); )
2523 info = mInventoryCallbacks.getNextData())
2524 { 2526 {
2527 callback_list_t::iterator curiter = iter++;
2528 LLInventoryCallbackInfo* info = *curiter;
2525 if (info->mListener != NULL) 2529 if (info->mListener != NULL)
2526 { 2530 {
2527 info->mListener->inventoryChanged(this, 2531 info->mListener->inventoryChanged(this,
@@ -2532,7 +2536,8 @@ void LLViewerObject::doInventoryCallback()
2532 else 2536 else
2533 { 2537 {
2534 llinfos << "LLViewerObject::doInventoryCallback() deleting bad listener entry." << llendl; 2538 llinfos << "LLViewerObject::doInventoryCallback() deleting bad listener entry." << llendl;
2535 mInventoryCallbacks.deleteCurrentData(); 2539 delete info;
2540 mInventoryCallbacks.erase(curiter);
2536 } 2541 }
2537 } 2542 }
2538 mInventoryPending = FALSE; 2543 mInventoryPending = FALSE;
@@ -3063,6 +3068,11 @@ const LLVector3 &LLViewerObject::getPositionRegion() const
3063 LLViewerObject *parent = (LLViewerObject *)getParent(); 3068 LLViewerObject *parent = (LLViewerObject *)getParent();
3064 mPositionRegion = parent->getPositionRegion() + (getPosition() * parent->getRotation()); 3069 mPositionRegion = parent->getPositionRegion() + (getPosition() * parent->getRotation());
3065 } 3070 }
3071 else
3072 {
3073 mPositionRegion = getPosition();
3074 }
3075
3066 return mPositionRegion; 3076 return mPositionRegion;
3067} 3077}
3068 3078
@@ -3088,18 +3098,6 @@ const LLVector3 LLViewerObject::getRenderPosition() const
3088 } 3098 }
3089 else 3099 else
3090 { 3100 {
3091 if (isAvatar())
3092 {
3093 if (isRoot())
3094 {
3095 return mDrawable->getPositionAgent();
3096 }
3097 else
3098 {
3099 return getPosition() * mDrawable->getParent()->getRenderMatrix();
3100 }
3101 }
3102
3103 return mDrawable->getPositionAgent(); 3101 return mDrawable->getPositionAgent();
3104 } 3102 }
3105} 3103}
@@ -3771,6 +3769,26 @@ S32 LLViewerObject::setTEMediaFlags(const U8 te, const U8 media_flags)
3771 return retval; 3769 return retval;
3772} 3770}
3773 3771
3772S32 LLViewerObject::setTEGlow(const U8 te, const F32 glow)
3773{
3774 S32 retval = 0;
3775 const LLTextureEntry *tep = getTE(te);
3776 if (!tep)
3777 {
3778 llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl;
3779 }
3780 else if (glow != tep->getGlow())
3781 {
3782 retval = LLPrimitive::setTEGlow(te, glow);
3783 setChanged(TEXTURE);
3784 if (mDrawable.notNull() && retval)
3785 {
3786 gPipeline.markTextured(mDrawable);
3787 }
3788 }
3789 return retval;
3790}
3791
3774 3792
3775S32 LLViewerObject::setTEScale(const U8 te, const F32 s, const F32 t) 3793S32 LLViewerObject::setTEScale(const U8 te, const F32 s, const F32 t)
3776{ 3794{
@@ -4166,10 +4184,8 @@ void LLViewerObject::updateDrawable(BOOL force_damped)
4166{ 4184{
4167 if (mDrawable.notNull() && 4185 if (mDrawable.notNull() &&
4168 !mDrawable->isState(LLDrawable::ON_MOVE_LIST) && 4186 !mDrawable->isState(LLDrawable::ON_MOVE_LIST) &&
4169 isChanged(MOVED) && 4187 isChanged(MOVED))
4170 !isAvatar())
4171 { 4188 {
4172 mLastUpdateFrame = LLFrameTimer::getFrameCount();
4173 BOOL damped_motion = 4189 BOOL damped_motion =
4174 !isChanged(SHIFTED) && // not shifted between regions this frame and... 4190 !isChanged(SHIFTED) && // not shifted between regions this frame and...
4175 (force_damped || // ...forced into damped motion by application logic or... 4191 (force_damped || // ...forced into damped motion by application logic or...
@@ -4826,12 +4842,31 @@ void LLViewerObject::resetRot()
4826 4842
4827U32 LLViewerObject::getPartitionType() const 4843U32 LLViewerObject::getPartitionType() const
4828{ 4844{
4829 return LLPipeline::PARTITION_NONE; 4845 return LLViewerRegion::PARTITION_NONE;
4830} 4846}
4831 4847
4832BOOL LLAlphaObject::isParticle() 4848void LLViewerObject::dirtySpatialGroup() const
4833{ 4849{
4834 return FALSE; 4850 if (mDrawable)
4851 {
4852 LLSpatialGroup* group = mDrawable->getSpatialGroup();
4853 if (group)
4854 {
4855 group->dirtyGeom();
4856 }
4857 }
4858}
4859
4860void LLViewerObject::dirtyMesh() const
4861{
4862 if (mDrawable)
4863 {
4864 LLSpatialGroup* group = mDrawable->getSpatialGroup();
4865 if (group)
4866 {
4867 group->dirtyMesh();
4868 }
4869 }
4835} 4870}
4836 4871
4837F32 LLAlphaObject::getPartSize(S32 idx) 4872F32 LLAlphaObject::getPartSize(S32 idx)