diff options
author | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
commit | ce28e056c20bf2723f565bbf464b87781ec248a2 (patch) | |
tree | ef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llviewerobject.cpp | |
parent | Second Life viewer sources 1.19.1.4b (diff) | |
download | meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2 meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz |
Second Life viewer sources 1.20.2
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llviewerobject.cpp | 99 |
1 files changed, 42 insertions, 57 deletions
diff --git a/linden/indra/newview/llviewerobject.cpp b/linden/indra/newview/llviewerobject.cpp index 55210ad..057e2d9 100644 --- a/linden/indra/newview/llviewerobject.cpp +++ b/linden/indra/newview/llviewerobject.cpp | |||
@@ -67,7 +67,7 @@ | |||
67 | #include "llfollowcam.h" | 67 | #include "llfollowcam.h" |
68 | #include "llnetmap.h" | 68 | #include "llnetmap.h" |
69 | #include "llselectmgr.h" | 69 | #include "llselectmgr.h" |
70 | #include "llsphere.h" | 70 | #include "llrendersphere.h" |
71 | #include "lltooldraganddrop.h" | 71 | #include "lltooldraganddrop.h" |
72 | #include "llviewercamera.h" | 72 | #include "llviewercamera.h" |
73 | #include "llviewerimagelist.h" | 73 | #include "llviewerimagelist.h" |
@@ -202,7 +202,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe | |||
202 | { | 202 | { |
203 | llassert(mRegionp); | 203 | llassert(mRegionp); |
204 | 204 | ||
205 | LLPrimitive::init(pcode); | 205 | LLPrimitive::init_primitive(pcode); |
206 | 206 | ||
207 | // CP: added 12/2/2005 - this was being initialised to 0, not the current frame time | 207 | // CP: added 12/2/2005 - this was being initialised to 0, not the current frame time |
208 | mLastInterpUpdateSecs = LLFrameTimer::getElapsedSeconds(); | 208 | mLastInterpUpdateSecs = LLFrameTimer::getElapsedSeconds(); |
@@ -549,9 +549,9 @@ void LLViewerObject::removeChild(LLViewerObject *childp) | |||
549 | 549 | ||
550 | if (childp->isSelected()) | 550 | if (childp->isSelected()) |
551 | { | 551 | { |
552 | gSelectMgr->deselectObjectAndFamily(childp); | 552 | LLSelectMgr::getInstance()->deselectObjectAndFamily(childp); |
553 | BOOL add_to_end = TRUE; | 553 | BOOL add_to_end = TRUE; |
554 | gSelectMgr->selectObjectAndFamily(childp, add_to_end); | 554 | LLSelectMgr::getInstance()->selectObjectAndFamily(childp, add_to_end); |
555 | } | 555 | } |
556 | } | 556 | } |
557 | 557 | ||
@@ -686,7 +686,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, | |||
686 | // Coordinates of objects on simulators are region-local. | 686 | // Coordinates of objects on simulators are region-local. |
687 | U64 region_handle; | 687 | U64 region_handle; |
688 | mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle); | 688 | mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle); |
689 | mRegionp = gWorldPointer->getRegionFromHandle(region_handle); | 689 | mRegionp = LLWorld::getInstance()->getRegionFromHandle(region_handle); |
690 | if (!mRegionp) | 690 | if (!mRegionp) |
691 | { | 691 | { |
692 | U32 x, y; | 692 | U32 x, y; |
@@ -711,9 +711,9 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, | |||
711 | U16 valswizzle[4]; | 711 | U16 valswizzle[4]; |
712 | #endif | 712 | #endif |
713 | U16 *val; | 713 | U16 *val; |
714 | const F32 size = gWorldPointer->getRegionWidthInMeters(); | 714 | const F32 size = LLWorld::getInstance()->getRegionWidthInMeters(); |
715 | const F32 MAX_HEIGHT = gWorldPointer->getRegionMaxHeight(); | 715 | const F32 MAX_HEIGHT = LLWorld::getInstance()->getRegionMaxHeight(); |
716 | const F32 MIN_HEIGHT = gWorldPointer->getRegionMinHeight(); | 716 | const F32 MIN_HEIGHT = LLWorld::getInstance()->getRegionMinHeight(); |
717 | S32 length; | 717 | S32 length; |
718 | S32 count; | 718 | S32 count; |
719 | S32 this_update_precision = 32; // in bits | 719 | S32 this_update_precision = 32; // in bits |
@@ -723,6 +723,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, | |||
723 | LLVector3 new_vel; | 723 | LLVector3 new_vel; |
724 | LLVector3 new_acc; | 724 | LLVector3 new_acc; |
725 | LLVector3 new_angv; | 725 | LLVector3 new_angv; |
726 | LLVector3 old_angv = getAngularVelocity(); | ||
726 | LLQuaternion new_rot; | 727 | LLQuaternion new_rot; |
727 | LLVector3 new_scale = getScale(); | 728 | LLVector3 new_scale = getScale(); |
728 | 729 | ||
@@ -1857,7 +1858,8 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, | |||
1857 | } | 1858 | } |
1858 | } | 1859 | } |
1859 | 1860 | ||
1860 | if (new_rot != mLastRot) | 1861 | if (new_rot != mLastRot |
1862 | || new_angv != old_angv) | ||
1861 | { | 1863 | { |
1862 | mLastRot = new_rot; | 1864 | mLastRot = new_rot; |
1863 | setChanged(ROTATED | SILHOUETTE); | 1865 | setChanged(ROTATED | SILHOUETTE); |
@@ -1920,7 +1922,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, | |||
1920 | 1922 | ||
1921 | if (needs_refresh) | 1923 | if (needs_refresh) |
1922 | { | 1924 | { |
1923 | gSelectMgr->updateSelectionCenter(); | 1925 | LLSelectMgr::getInstance()->updateSelectionCenter(); |
1924 | dialog_refresh_all(); | 1926 | dialog_refresh_all(); |
1925 | } | 1927 | } |
1926 | 1928 | ||
@@ -1974,7 +1976,7 @@ BOOL LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) | |||
1974 | F32 dt_raw = (F32)(time - mLastInterpUpdateSecs); | 1976 | F32 dt_raw = (F32)(time - mLastInterpUpdateSecs); |
1975 | F32 dt = mTimeDilation * dt_raw; | 1977 | F32 dt = mTimeDilation * dt_raw; |
1976 | 1978 | ||
1977 | if (!mUserSelected && !mJointInfo) | 1979 | if (!mJointInfo) |
1978 | { | 1980 | { |
1979 | applyAngularVelocity(dt); | 1981 | applyAngularVelocity(dt); |
1980 | } | 1982 | } |
@@ -2060,9 +2062,9 @@ BOOL LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) | |||
2060 | else | 2062 | else |
2061 | { | 2063 | { |
2062 | // linear motion | 2064 | // linear motion |
2063 | // HAVOK_TIMESTEP is used below to correct for the fact that the velocity in object | 2065 | // PHYSICS_TIMESTEP is used below to correct for the fact that the velocity in object |
2064 | // updates represents the average velocity of the last timestep, rather than the final velocity. | 2066 | // updates represents the average velocity of the last timestep, rather than the final velocity. |
2065 | // the time dilation above should guarrantee that dt is never less than HAVOK_TIMESTEP, theoretically | 2067 | // the time dilation above should guarantee that dt is never less than PHYSICS_TIMESTEP, theoretically |
2066 | // | 2068 | // |
2067 | // There is a problem here if dt is negative. . . | 2069 | // There is a problem here if dt is negative. . . |
2068 | 2070 | ||
@@ -2074,7 +2076,7 @@ BOOL LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) | |||
2074 | 2076 | ||
2075 | if (!(accel.isExactlyZero() && vel.isExactlyZero())) | 2077 | if (!(accel.isExactlyZero() && vel.isExactlyZero())) |
2076 | { | 2078 | { |
2077 | LLVector3 pos = (vel + (0.5f * (dt-HAVOK_TIMESTEP)) * accel) * dt; | 2079 | LLVector3 pos = (vel + (0.5f * (dt-PHYSICS_TIMESTEP)) * accel) * dt; |
2078 | 2080 | ||
2079 | // region local | 2081 | // region local |
2080 | setPositionRegion(pos + getPositionRegion()); | 2082 | setPositionRegion(pos + getPositionRegion()); |
@@ -2180,7 +2182,7 @@ void LLViewerObject::doUpdateInventory( | |||
2180 | // make sure that the serial number does not match. | 2182 | // make sure that the serial number does not match. |
2181 | deleteInventoryItem(item_id); | 2183 | deleteInventoryItem(item_id); |
2182 | LLPermissions perm(item->getPermissions()); | 2184 | LLPermissions perm(item->getPermissions()); |
2183 | LLPermissions* obj_perm = gSelectMgr->findObjectPermissions(this); | 2185 | LLPermissions* obj_perm = LLSelectMgr::getInstance()->findObjectPermissions(this); |
2184 | bool is_atomic = ((S32)LLAssetType::AT_OBJECT == item->getType()) ? false : true; | 2186 | bool is_atomic = ((S32)LLAssetType::AT_OBJECT == item->getType()) ? false : true; |
2185 | if(obj_perm) | 2187 | if(obj_perm) |
2186 | { | 2188 | { |
@@ -2717,19 +2719,19 @@ void LLViewerObject::setPixelAreaAndAngle(LLAgent &agent) | |||
2717 | if (range < 0.001f || isHUDAttachment()) // range == zero | 2719 | if (range < 0.001f || isHUDAttachment()) // range == zero |
2718 | { | 2720 | { |
2719 | mAppAngle = 180.f; | 2721 | mAppAngle = 180.f; |
2720 | mPixelArea = (F32)gCamera->getScreenPixelArea(); | 2722 | mPixelArea = (F32)LLViewerCamera::getInstance()->getScreenPixelArea(); |
2721 | } | 2723 | } |
2722 | else | 2724 | else |
2723 | { | 2725 | { |
2724 | mAppAngle = (F32) atan2( max_scale, range) * RAD_TO_DEG; | 2726 | mAppAngle = (F32) atan2( max_scale, range) * RAD_TO_DEG; |
2725 | 2727 | ||
2726 | F32 pixels_per_meter = gCamera->getPixelMeterRatio() / range; | 2728 | F32 pixels_per_meter = LLViewerCamera::getInstance()->getPixelMeterRatio() / range; |
2727 | 2729 | ||
2728 | mPixelArea = (pixels_per_meter * max_scale) * (pixels_per_meter * mid_scale); | 2730 | mPixelArea = (pixels_per_meter * max_scale) * (pixels_per_meter * mid_scale); |
2729 | if (mPixelArea > gCamera->getScreenPixelArea()) | 2731 | if (mPixelArea > LLViewerCamera::getInstance()->getScreenPixelArea()) |
2730 | { | 2732 | { |
2731 | mAppAngle = 180.f; | 2733 | mAppAngle = 180.f; |
2732 | mPixelArea = (F32)gCamera->getScreenPixelArea(); | 2734 | mPixelArea = (F32)LLViewerCamera::getInstance()->getScreenPixelArea(); |
2733 | } | 2735 | } |
2734 | } | 2736 | } |
2735 | } | 2737 | } |
@@ -3526,36 +3528,21 @@ void LLViewerObject::sendRotationUpdate() const | |||
3526 | gMessageSystem->sendReliable( regionp->getHost() ); | 3528 | gMessageSystem->sendReliable( regionp->getHost() ); |
3527 | } | 3529 | } |
3528 | 3530 | ||
3529 | // formerly send_object_position_global | 3531 | /* Obsolete, we use MultipleObjectUpdate instead |
3530 | void LLViewerObject::sendPositionUpdate() const | 3532 | //// formerly send_object_position_global |
3531 | { | 3533 | //void LLViewerObject::sendPositionUpdate() const |
3532 | gMessageSystem->newMessageFast(_PREHASH_ObjectPosition); | 3534 | //{ |
3533 | gMessageSystem->nextBlockFast(_PREHASH_AgentData); | 3535 | // gMessageSystem->newMessageFast(_PREHASH_ObjectPosition); |
3534 | gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); | 3536 | // gMessageSystem->nextBlockFast(_PREHASH_AgentData); |
3535 | gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | 3537 | // gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); |
3536 | gMessageSystem->nextBlockFast(_PREHASH_ObjectData); | 3538 | // gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); |
3537 | gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, mLocalID ); | 3539 | // gMessageSystem->nextBlockFast(_PREHASH_ObjectData); |
3538 | gMessageSystem->addVector3Fast(_PREHASH_Position, getPositionRegion()); | 3540 | // gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, mLocalID ); |
3539 | LLViewerRegion* regionp = getRegion(); | 3541 | // gMessageSystem->addVector3Fast(_PREHASH_Position, getPositionRegion()); |
3540 | gMessageSystem->sendReliable(regionp->getHost()); | 3542 | // LLViewerRegion* regionp = getRegion(); |
3541 | } | 3543 | // gMessageSystem->sendReliable(regionp->getHost()); |
3542 | 3544 | //} | |
3543 | 3545 | */ | |
3544 | //formerly send_object_scale | ||
3545 | void LLViewerObject::sendScaleUpdate() | ||
3546 | { | ||
3547 | gMessageSystem->newMessageFast(_PREHASH_ObjectScale); | ||
3548 | gMessageSystem->nextBlockFast(_PREHASH_AgentData); | ||
3549 | gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); | ||
3550 | gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | ||
3551 | gMessageSystem->nextBlockFast(_PREHASH_ObjectData); | ||
3552 | gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, mLocalID ); | ||
3553 | gMessageSystem->addVector3Fast(_PREHASH_Scale, (getScale())); | ||
3554 | |||
3555 | LLViewerRegion *regionp = getRegion(); | ||
3556 | gMessageSystem->sendReliable(regionp->getHost() ); | ||
3557 | } | ||
3558 | |||
3559 | 3546 | ||
3560 | //formerly send_object_shape(LLViewerObject *object) | 3547 | //formerly send_object_shape(LLViewerObject *object) |
3561 | void LLViewerObject::sendShapeUpdate() | 3548 | void LLViewerObject::sendShapeUpdate() |
@@ -4100,7 +4087,7 @@ void LLViewerObject::unpackParticleSource(const S32 block_num, const LLUUID& own | |||
4100 | { | 4087 | { |
4101 | LLPointer<LLViewerPartSourceScript> pss = LLViewerPartSourceScript::unpackPSS(this, NULL, block_num); | 4088 | LLPointer<LLViewerPartSourceScript> pss = LLViewerPartSourceScript::unpackPSS(this, NULL, block_num); |
4102 | //If the owner is muted, don't create the system | 4089 | //If the owner is muted, don't create the system |
4103 | if(gMuteListp->isMuted(owner_id, LLMute::flagParticles)) return; | 4090 | if(LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagParticles)) return; |
4104 | 4091 | ||
4105 | // We need to be able to deal with a particle source that hasn't changed, but still got an update! | 4092 | // We need to be able to deal with a particle source that hasn't changed, but still got an update! |
4106 | if (pss) | 4093 | if (pss) |
@@ -4108,7 +4095,7 @@ void LLViewerObject::unpackParticleSource(const S32 block_num, const LLUUID& own | |||
4108 | // llinfos << "Making particle system with owner " << owner_id << llendl; | 4095 | // llinfos << "Making particle system with owner " << owner_id << llendl; |
4109 | pss->setOwnerUUID(owner_id); | 4096 | pss->setOwnerUUID(owner_id); |
4110 | mPartSourcep = pss; | 4097 | mPartSourcep = pss; |
4111 | gWorldPointer->mPartSim.addPartSource(pss); | 4098 | LLViewerPartSim::getInstance()->addPartSource(pss); |
4112 | } | 4099 | } |
4113 | } | 4100 | } |
4114 | if (mPartSourcep) | 4101 | if (mPartSourcep) |
@@ -4118,8 +4105,7 @@ void LLViewerObject::unpackParticleSource(const S32 block_num, const LLUUID& own | |||
4118 | LLViewerImage* image; | 4105 | LLViewerImage* image; |
4119 | if (mPartSourcep->mPartSysData.mPartImageID == LLUUID::null) | 4106 | if (mPartSourcep->mPartSysData.mPartImageID == LLUUID::null) |
4120 | { | 4107 | { |
4121 | LLUUID id(gViewerArt.getString("pixiesmall.tga")); | 4108 | image = gImageList.getImageFromFile("pixiesmall.j2c"); |
4122 | image = gImageList.getImage(id); | ||
4123 | } | 4109 | } |
4124 | else | 4110 | else |
4125 | { | 4111 | { |
@@ -4149,14 +4135,14 @@ void LLViewerObject::unpackParticleSource(LLDataPacker &dp, const LLUUID& owner_ | |||
4149 | { | 4135 | { |
4150 | LLPointer<LLViewerPartSourceScript> pss = LLViewerPartSourceScript::unpackPSS(this, NULL, dp); | 4136 | LLPointer<LLViewerPartSourceScript> pss = LLViewerPartSourceScript::unpackPSS(this, NULL, dp); |
4151 | //If the owner is muted, don't create the system | 4137 | //If the owner is muted, don't create the system |
4152 | if(gMuteListp->isMuted(owner_id, LLMute::flagParticles)) return; | 4138 | if(LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagParticles)) return; |
4153 | // We need to be able to deal with a particle source that hasn't changed, but still got an update! | 4139 | // We need to be able to deal with a particle source that hasn't changed, but still got an update! |
4154 | if (pss) | 4140 | if (pss) |
4155 | { | 4141 | { |
4156 | // llinfos << "Making particle system with owner " << owner_id << llendl; | 4142 | // llinfos << "Making particle system with owner " << owner_id << llendl; |
4157 | pss->setOwnerUUID(owner_id); | 4143 | pss->setOwnerUUID(owner_id); |
4158 | mPartSourcep = pss; | 4144 | mPartSourcep = pss; |
4159 | gWorldPointer->mPartSim.addPartSource(pss); | 4145 | LLViewerPartSim::getInstance()->addPartSource(pss); |
4160 | } | 4146 | } |
4161 | } | 4147 | } |
4162 | if (mPartSourcep) | 4148 | if (mPartSourcep) |
@@ -4166,8 +4152,7 @@ void LLViewerObject::unpackParticleSource(LLDataPacker &dp, const LLUUID& owner_ | |||
4166 | LLViewerImage* image; | 4152 | LLViewerImage* image; |
4167 | if (mPartSourcep->mPartSysData.mPartImageID == LLUUID::null) | 4153 | if (mPartSourcep->mPartSysData.mPartImageID == LLUUID::null) |
4168 | { | 4154 | { |
4169 | LLUUID id(gViewerArt.getString("pixiesmall.tga")); | 4155 | image = gImageList.getImageFromFile("pixiesmall.j2c"); |
4170 | image = gImageList.getImage(id); | ||
4171 | } | 4156 | } |
4172 | else | 4157 | else |
4173 | { | 4158 | { |