From ce28e056c20bf2723f565bbf464b87781ec248a2 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:45:42 -0500 Subject: Second Life viewer sources 1.20.2 --- linden/indra/newview/llviewerobject.cpp | 99 ++++++++++++++------------------- 1 file changed, 42 insertions(+), 57 deletions(-) (limited to 'linden/indra/newview/llviewerobject.cpp') 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 @@ #include "llfollowcam.h" #include "llnetmap.h" #include "llselectmgr.h" -#include "llsphere.h" +#include "llrendersphere.h" #include "lltooldraganddrop.h" #include "llviewercamera.h" #include "llviewerimagelist.h" @@ -202,7 +202,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe { llassert(mRegionp); - LLPrimitive::init(pcode); + LLPrimitive::init_primitive(pcode); // CP: added 12/2/2005 - this was being initialised to 0, not the current frame time mLastInterpUpdateSecs = LLFrameTimer::getElapsedSeconds(); @@ -549,9 +549,9 @@ void LLViewerObject::removeChild(LLViewerObject *childp) if (childp->isSelected()) { - gSelectMgr->deselectObjectAndFamily(childp); + LLSelectMgr::getInstance()->deselectObjectAndFamily(childp); BOOL add_to_end = TRUE; - gSelectMgr->selectObjectAndFamily(childp, add_to_end); + LLSelectMgr::getInstance()->selectObjectAndFamily(childp, add_to_end); } } @@ -686,7 +686,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // Coordinates of objects on simulators are region-local. U64 region_handle; mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle); - mRegionp = gWorldPointer->getRegionFromHandle(region_handle); + mRegionp = LLWorld::getInstance()->getRegionFromHandle(region_handle); if (!mRegionp) { U32 x, y; @@ -711,9 +711,9 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, U16 valswizzle[4]; #endif U16 *val; - const F32 size = gWorldPointer->getRegionWidthInMeters(); - const F32 MAX_HEIGHT = gWorldPointer->getRegionMaxHeight(); - const F32 MIN_HEIGHT = gWorldPointer->getRegionMinHeight(); + const F32 size = LLWorld::getInstance()->getRegionWidthInMeters(); + const F32 MAX_HEIGHT = LLWorld::getInstance()->getRegionMaxHeight(); + const F32 MIN_HEIGHT = LLWorld::getInstance()->getRegionMinHeight(); S32 length; S32 count; S32 this_update_precision = 32; // in bits @@ -723,6 +723,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, LLVector3 new_vel; LLVector3 new_acc; LLVector3 new_angv; + LLVector3 old_angv = getAngularVelocity(); LLQuaternion new_rot; LLVector3 new_scale = getScale(); @@ -1857,7 +1858,8 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, } } - if (new_rot != mLastRot) + if (new_rot != mLastRot + || new_angv != old_angv) { mLastRot = new_rot; setChanged(ROTATED | SILHOUETTE); @@ -1920,7 +1922,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (needs_refresh) { - gSelectMgr->updateSelectionCenter(); + LLSelectMgr::getInstance()->updateSelectionCenter(); dialog_refresh_all(); } @@ -1974,7 +1976,7 @@ BOOL LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) F32 dt_raw = (F32)(time - mLastInterpUpdateSecs); F32 dt = mTimeDilation * dt_raw; - if (!mUserSelected && !mJointInfo) + if (!mJointInfo) { applyAngularVelocity(dt); } @@ -2060,9 +2062,9 @@ BOOL LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) else { // linear motion - // HAVOK_TIMESTEP is used below to correct for the fact that the velocity in object + // PHYSICS_TIMESTEP is used below to correct for the fact that the velocity in object // updates represents the average velocity of the last timestep, rather than the final velocity. - // the time dilation above should guarrantee that dt is never less than HAVOK_TIMESTEP, theoretically + // the time dilation above should guarantee that dt is never less than PHYSICS_TIMESTEP, theoretically // // There is a problem here if dt is negative. . . @@ -2074,7 +2076,7 @@ BOOL LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) if (!(accel.isExactlyZero() && vel.isExactlyZero())) { - LLVector3 pos = (vel + (0.5f * (dt-HAVOK_TIMESTEP)) * accel) * dt; + LLVector3 pos = (vel + (0.5f * (dt-PHYSICS_TIMESTEP)) * accel) * dt; // region local setPositionRegion(pos + getPositionRegion()); @@ -2180,7 +2182,7 @@ void LLViewerObject::doUpdateInventory( // make sure that the serial number does not match. deleteInventoryItem(item_id); LLPermissions perm(item->getPermissions()); - LLPermissions* obj_perm = gSelectMgr->findObjectPermissions(this); + LLPermissions* obj_perm = LLSelectMgr::getInstance()->findObjectPermissions(this); bool is_atomic = ((S32)LLAssetType::AT_OBJECT == item->getType()) ? false : true; if(obj_perm) { @@ -2717,19 +2719,19 @@ void LLViewerObject::setPixelAreaAndAngle(LLAgent &agent) if (range < 0.001f || isHUDAttachment()) // range == zero { mAppAngle = 180.f; - mPixelArea = (F32)gCamera->getScreenPixelArea(); + mPixelArea = (F32)LLViewerCamera::getInstance()->getScreenPixelArea(); } else { mAppAngle = (F32) atan2( max_scale, range) * RAD_TO_DEG; - F32 pixels_per_meter = gCamera->getPixelMeterRatio() / range; + F32 pixels_per_meter = LLViewerCamera::getInstance()->getPixelMeterRatio() / range; mPixelArea = (pixels_per_meter * max_scale) * (pixels_per_meter * mid_scale); - if (mPixelArea > gCamera->getScreenPixelArea()) + if (mPixelArea > LLViewerCamera::getInstance()->getScreenPixelArea()) { mAppAngle = 180.f; - mPixelArea = (F32)gCamera->getScreenPixelArea(); + mPixelArea = (F32)LLViewerCamera::getInstance()->getScreenPixelArea(); } } } @@ -3526,36 +3528,21 @@ void LLViewerObject::sendRotationUpdate() const gMessageSystem->sendReliable( regionp->getHost() ); } -// formerly send_object_position_global -void LLViewerObject::sendPositionUpdate() const -{ - gMessageSystem->newMessageFast(_PREHASH_ObjectPosition); - gMessageSystem->nextBlockFast(_PREHASH_AgentData); - gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); - gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - gMessageSystem->nextBlockFast(_PREHASH_ObjectData); - gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, mLocalID ); - gMessageSystem->addVector3Fast(_PREHASH_Position, getPositionRegion()); - LLViewerRegion* regionp = getRegion(); - gMessageSystem->sendReliable(regionp->getHost()); -} - - -//formerly send_object_scale -void LLViewerObject::sendScaleUpdate() -{ - gMessageSystem->newMessageFast(_PREHASH_ObjectScale); - gMessageSystem->nextBlockFast(_PREHASH_AgentData); - gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); - gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - gMessageSystem->nextBlockFast(_PREHASH_ObjectData); - gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, mLocalID ); - gMessageSystem->addVector3Fast(_PREHASH_Scale, (getScale())); - - LLViewerRegion *regionp = getRegion(); - gMessageSystem->sendReliable(regionp->getHost() ); -} - +/* Obsolete, we use MultipleObjectUpdate instead +//// formerly send_object_position_global +//void LLViewerObject::sendPositionUpdate() const +//{ +// gMessageSystem->newMessageFast(_PREHASH_ObjectPosition); +// gMessageSystem->nextBlockFast(_PREHASH_AgentData); +// gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); +// gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); +// gMessageSystem->nextBlockFast(_PREHASH_ObjectData); +// gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, mLocalID ); +// gMessageSystem->addVector3Fast(_PREHASH_Position, getPositionRegion()); +// LLViewerRegion* regionp = getRegion(); +// gMessageSystem->sendReliable(regionp->getHost()); +//} +*/ //formerly send_object_shape(LLViewerObject *object) void LLViewerObject::sendShapeUpdate() @@ -4100,7 +4087,7 @@ void LLViewerObject::unpackParticleSource(const S32 block_num, const LLUUID& own { LLPointer pss = LLViewerPartSourceScript::unpackPSS(this, NULL, block_num); //If the owner is muted, don't create the system - if(gMuteListp->isMuted(owner_id, LLMute::flagParticles)) return; + if(LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagParticles)) return; // We need to be able to deal with a particle source that hasn't changed, but still got an update! if (pss) @@ -4108,7 +4095,7 @@ void LLViewerObject::unpackParticleSource(const S32 block_num, const LLUUID& own // llinfos << "Making particle system with owner " << owner_id << llendl; pss->setOwnerUUID(owner_id); mPartSourcep = pss; - gWorldPointer->mPartSim.addPartSource(pss); + LLViewerPartSim::getInstance()->addPartSource(pss); } } if (mPartSourcep) @@ -4118,8 +4105,7 @@ void LLViewerObject::unpackParticleSource(const S32 block_num, const LLUUID& own LLViewerImage* image; if (mPartSourcep->mPartSysData.mPartImageID == LLUUID::null) { - LLUUID id(gViewerArt.getString("pixiesmall.tga")); - image = gImageList.getImage(id); + image = gImageList.getImageFromFile("pixiesmall.j2c"); } else { @@ -4149,14 +4135,14 @@ void LLViewerObject::unpackParticleSource(LLDataPacker &dp, const LLUUID& owner_ { LLPointer pss = LLViewerPartSourceScript::unpackPSS(this, NULL, dp); //If the owner is muted, don't create the system - if(gMuteListp->isMuted(owner_id, LLMute::flagParticles)) return; + if(LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagParticles)) return; // We need to be able to deal with a particle source that hasn't changed, but still got an update! if (pss) { // llinfos << "Making particle system with owner " << owner_id << llendl; pss->setOwnerUUID(owner_id); mPartSourcep = pss; - gWorldPointer->mPartSim.addPartSource(pss); + LLViewerPartSim::getInstance()->addPartSource(pss); } } if (mPartSourcep) @@ -4166,8 +4152,7 @@ void LLViewerObject::unpackParticleSource(LLDataPacker &dp, const LLUUID& owner_ LLViewerImage* image; if (mPartSourcep->mPartSysData.mPartImageID == LLUUID::null) { - LLUUID id(gViewerArt.getString("pixiesmall.tga")); - image = gImageList.getImage(id); + image = gImageList.getImageFromFile("pixiesmall.j2c"); } else { -- cgit v1.1