diff options
author | Andrew Meadows <andrew@lindenlab.com> | 2008-09-05 22:03:35 +0000 |
---|---|---|
committer | Andrew Meadows <andrew@lindenlab.com> | 2008-09-05 22:03:35 +0000 |
commit | 222bca24c12e162669c1a810c3102811f21cfbe4 (patch) | |
tree | 8eee52c0ffd4e9b03d624fc78d6547b8312a5c85 /indra/newview | |
parent | 1493a212629b02a4323bf0c1f5a6960bc7b5e271 (diff) |
svn merge -r95288:95907 svn+ssh://svn.lindenlab.com/svn/linden/qa/maint-server/qar-841
this is a combined mergeback of the following branches as per QAR-841:
maint-server/maint-server-1 (absorbed by maint-server-2)
maint-server/maint-server-2
maint-server/maint-server-3
havok4/havok4-8
havok4/havok4-9
yes dataserver-is-deprecated
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/newview/llagent.cpp | 231 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llhomelocationresponder.cpp | 108 | ||||
-rw-r--r-- | indra/newview/llhomelocationresponder.h | 47 | ||||
-rw-r--r-- | indra/newview/llinventorymodel.cpp | 173 | ||||
-rw-r--r-- | indra/newview/llinventorymodel.h | 26 | ||||
-rw-r--r-- | indra/newview/llpanelgrouplandmoney.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llsprite.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llsprite.h | 2 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 115 | ||||
-rw-r--r-- | indra/newview/llviewermenufile.cpp | 18 | ||||
-rw-r--r-- | indra/newview/llviewerregion.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llvoavatar.cpp | 38 | ||||
-rw-r--r-- | indra/newview/llvograss.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llvopartgroup.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llvosky.cpp | 76 | ||||
-rw-r--r-- | indra/newview/llvotextbubble.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llvotree.cpp | 28 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 16 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 8 |
21 files changed, 561 insertions, 371 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 1e8f37e75f..826538d8e2 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -198,6 +198,7 @@ set(viewer_SOURCE_FILES llglsandbox.cpp llgroupmgr.cpp llgroupnotify.cpp + llhomelocationresponder.cpp llhoverview.cpp llhudeffectbeam.cpp llhudeffect.cpp @@ -590,6 +591,7 @@ set(viewer_HEADER_FILES llgivemoney.h llgroupmgr.h llgroupnotify.h + llhomelocationresponder.h llhoverview.h llhudeffect.h llhudeffectbeam.h diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index cb32dfb904..19a0676374 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -80,6 +80,7 @@ #include "llfloatertools.h" #include "llfloaterworldmap.h" #include "llgroupmgr.h" +#include "llhomelocationresponder.h" #include "llhudeffectlookat.h" #include "llhudmanager.h" #include "llinventorymodel.h" @@ -90,6 +91,7 @@ #include "llmoveview.h" #include "llnotify.h" #include "llquantize.h" +#include "llsdutil.h" #include "llselectmgr.h" #include "llsky.h" #include "llrendersphere.h" @@ -445,7 +447,7 @@ void LLAgent::init() mCameraFocusOffsetTarget = LLVector4(gSavedSettings.getVector3("CameraOffsetBuild")); mCameraOffsetDefault = gSavedSettings.getVector3("CameraOffsetDefault"); // mCameraOffsetNorm = mCameraOffsetDefault; -// mCameraOffsetNorm.normVec(); +// mCameraOffsetNorm.normalize(); mCameraCollidePlane.clearVec(); mCurrentCameraDistance = mCameraOffsetDefault.magVec(); mTargetCameraDistance = mCurrentCameraDistance; @@ -522,7 +524,7 @@ void LLAgent::resetView(BOOL reset_camera) // leaving mouse-steer mode LLVector3 agent_at_axis = getAtAxis(); agent_at_axis -= projected_vec(agent_at_axis, getReferenceUpVector()); - agent_at_axis.normVec(); + agent_at_axis.normalize(); gAgent.resetAxes(lerp(getAtAxis(), agent_at_axis, LLCriticalDamp::getInterpolant(0.3f))); } @@ -1033,7 +1035,7 @@ void LLAgent::slamLookAt(const LLVector3 &look_at) { LLVector3 look_at_norm = look_at; look_at_norm.mV[VZ] = 0.f; - look_at_norm.normVec(); + look_at_norm.normalize(); resetAxes(look_at_norm); } @@ -1305,7 +1307,7 @@ LLVector3 LLAgent::calcFocusOffset(LLViewerObject *object, S32 x, S32 y) LLVector3 obj_dir_abs = obj_pos - LLViewerCamera::getInstance()->getOrigin(); obj_dir_abs.rotVec(inv_obj_rot); - obj_dir_abs.normVec(); + obj_dir_abs.normalize(); obj_dir_abs.abs(); LLVector3 object_extents = object->getScale(); @@ -1330,7 +1332,7 @@ LLVector3 LLAgent::calcFocusOffset(LLViewerObject *object, S32 x, S32 y) { normal.setVec(obj_matrix.getUpRow4()); } - normal.normVec(); + normal.normalize(); LLVector3d focus_pt_global; // RN: should we check return value for valid pick? @@ -1534,7 +1536,7 @@ BOOL LLAgent::calcCameraMinDistance(F32 &obj_min_distance) camera_offset_target_abs_norm.abs(); // make sure offset is non-zero camera_offset_target_abs_norm.clamp(0.001f, F32_MAX); - camera_offset_target_abs_norm.normVec(); + camera_offset_target_abs_norm.normalize(); // find camera position relative to normalized object extents LLVector3 camera_offset_target_scaled = camera_offset_target_abs_norm; @@ -1580,7 +1582,7 @@ BOOL LLAgent::calcCameraMinDistance(F32 &obj_min_distance) LLVector3 object_split_axis; LLVector3 target_offset_scaled = target_offset_origin; target_offset_scaled.abs(); - target_offset_scaled.normVec(); + target_offset_scaled.normalize(); target_offset_scaled.mV[VX] /= object_extents.mV[VX]; target_offset_scaled.mV[VY] /= object_extents.mV[VY]; target_offset_scaled.mV[VZ] /= object_extents.mV[VZ]; @@ -1703,7 +1705,7 @@ void LLAgent::setCameraZoomFraction(F32 fraction) else if (cameraCustomizeAvatar()) { LLVector3d camera_offset_dir = mCameraFocusOffsetTarget; - camera_offset_dir.normVec(); + camera_offset_dir.normalize(); mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, APPEARANCE_MAX_ZOOM, APPEARANCE_MIN_ZOOM); } else @@ -1730,7 +1732,7 @@ void LLAgent::setCameraZoomFraction(F32 fraction) } LLVector3d camera_offset_dir = mCameraFocusOffsetTarget; - camera_offset_dir.normVec(); + camera_offset_dir.normalize(); mCameraFocusOffsetTarget = camera_offset_dir * rescale(fraction, 0.f, 1.f, max_zoom, min_zoom); } startCameraAnimation(); @@ -1777,7 +1779,7 @@ void LLAgent::cameraOrbitOver(const F32 angle) else { LLVector3 camera_offset_unit(mCameraFocusOffsetTarget); - camera_offset_unit.normVec(); + camera_offset_unit.normalize(); F32 angle_from_up = acos( camera_offset_unit * getReferenceUpVector() ); @@ -1812,7 +1814,7 @@ void LLAgent::cameraZoomIn(const F32 fraction) LLVector3d camera_offset(mCameraFocusOffsetTarget); LLVector3d camera_offset_unit(mCameraFocusOffsetTarget); F32 min_zoom = LAND_MIN_ZOOM; - F32 current_distance = (F32)camera_offset_unit.normVec(); + F32 current_distance = (F32)camera_offset_unit.normalize(); F32 new_distance = current_distance * fraction; // Don't move through focus point @@ -1881,7 +1883,7 @@ void LLAgent::cameraOrbitIn(const F32 meters) { LLVector3d camera_offset(mCameraFocusOffsetTarget); LLVector3d camera_offset_unit(mCameraFocusOffsetTarget); - F32 current_distance = (F32)camera_offset_unit.normVec(); + F32 current_distance = (F32)camera_offset_unit.normalize(); F32 new_distance = current_distance - meters; F32 min_zoom = LAND_MIN_ZOOM; @@ -2246,7 +2248,7 @@ void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::s mAutoPilotUseRotation = TRUE; mAutoPilotTargetFacing = LLVector3::x_axis * *target_rotation; mAutoPilotTargetFacing.mV[VZ] = 0.f; - mAutoPilotTargetFacing.normVec(); + mAutoPilotTargetFacing.normalize(); } else { @@ -2369,8 +2371,8 @@ void LLAgent::autoPilot(F32 *delta_yaw) at.mV[VZ] = 0.f; direction.mV[VZ] = 0.f; - at.normVec(); - F32 xy_distance = direction.normVec(); + at.normalize(); + F32 xy_distance = direction.normalize(); F32 yaw = 0.f; if (mAutoPilotTargetDist > mAutoPilotStopDistance) @@ -3529,7 +3531,7 @@ void LLAgent::setupSitCamera() // slam agent coordinate frame to proper parent local version LLVector3 at_axis = mFrameAgent.getAtAxis(); at_axis.mV[VZ] = 0.f; - at_axis.normVec(); + at_axis.normalize(); resetAxes(at_axis * ~parent_rot); } } @@ -3665,7 +3667,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) // slam agent coordinate frame to proper parent local version LLVector3 at_axis = mFrameAgent.getAtAxis() * parent_rot; at_axis.mV[VZ] = 0.f; - at_axis.normVec(); + at_axis.normalize(); resetAxes(at_axis * ~parent_rot); local_camera_offset = local_camera_offset * mFrameAgent.getQuaternion() * parent_rot; @@ -3686,7 +3688,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) offset_dot_norm = 0.001f; } - camera_distance = local_camera_offset.normVec(); + camera_distance = local_camera_offset.normalize(); F32 pos_dot_norm = getPosAgentFromGlobal(frame_center_global + head_offset) * plane_normal; @@ -3710,7 +3712,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) } else { - camera_distance = local_camera_offset.normVec(); + camera_distance = local_camera_offset.normalize(); } mTargetCameraDistance = llmax(camera_distance, MIN_CAMERA_DISTANCE); @@ -3745,7 +3747,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) { LLVector3 frame_at_axis = mFrameAgent.getAtAxis(); frame_at_axis -= projected_vec(frame_at_axis, getReferenceUpVector()); - frame_at_axis.normVec(); + frame_at_axis.normalize(); //transition smoothly in air mode, to avoid camera pop F32 u = (time_in_air - GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME) / GROUND_TO_AIR_CAMERA_TRANSITION_TIME; @@ -3932,7 +3934,7 @@ void LLAgent::resetCamera() // Remove any pitch from the avatar LLVector3 at = mFrameAgent.getAtAxis(); at.mV[VZ] = 0.f; - at.normVec(); + at.normalize(); gAgent.resetAxes(at); // have to explicitly clear field of view zoom now mCameraFOVZoomFactor = 0.f; @@ -4147,14 +4149,14 @@ void LLAgent::changeCameraToThirdPerson(BOOL animate) LLQuaternion obj_rot = ((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation(); at_axis = LLViewerCamera::getInstance()->getAtAxis(); at_axis.mV[VZ] = 0.f; - at_axis.normVec(); + at_axis.normalize(); resetAxes(at_axis * ~obj_rot); } else { at_axis = mFrameAgent.getAtAxis(); at_axis.mV[VZ] = 0.f; - at_axis.normVec(); + at_axis.normalize(); resetAxes(at_axis); } @@ -4201,7 +4203,7 @@ void LLAgent::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_ani // Remove any pitch from the avatar //LLVector3 at = mFrameAgent.getAtAxis(); //at.mV[VZ] = 0.f; - //at.normVec(); + //at.normalize(); //gAgent.resetAxes(at); if( mCameraMode != CAMERA_MODE_CUSTOMIZE_AVATAR ) @@ -4228,7 +4230,7 @@ void LLAgent::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_ani // Remove any pitch from the avatar LLVector3 at = mFrameAgent.getAtAxis(); at.mV[VZ] = 0.f; - at.normVec(); + at.normalize(); gAgent.resetAxes(at); sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START); @@ -4508,14 +4510,14 @@ void LLAgent::setFocusOnAvatar(BOOL focus_on_avatar, BOOL animate) LLQuaternion obj_rot = ((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation(); at_axis = LLViewerCamera::getInstance()->getAtAxis(); at_axis.mV[VZ] = 0.f; - at_axis.normVec(); + at_axis.normalize(); resetAxes(at_axis * ~obj_rot); } else { at_axis = LLViewerCamera::getInstance()->getAtAxis(); at_axis.mV[VZ] = 0.f; - at_axis.normVec(); + at_axis.normalize(); resetAxes(at_axis); } } @@ -4578,7 +4580,7 @@ void LLAgent::lookAtLastChat() { delta_pos = chatter->getPositionAgent() - getPositionAgent(); } - delta_pos.normVec(); + delta_pos.normalize(); setControlFlags(AGENT_CONTROL_STOP); @@ -4586,9 +4588,9 @@ void LLAgent::lookAtLastChat() LLVector3 new_camera_pos = mAvatarObject->mHeadp->getWorldPosition(); LLVector3 left = delta_pos % LLVector3::z_axis; - left.normVec(); + left.normalize(); LLVector3 up = left % delta_pos; - up.normVec(); + up.normalize(); new_camera_pos -= delta_pos * 0.4f; new_camera_pos += left * 0.3f; new_camera_pos += up * 0.2f; @@ -4607,7 +4609,7 @@ void LLAgent::lookAtLastChat() else { delta_pos = chatter->getRenderPosition() - getPositionAgent(); - delta_pos.normVec(); + delta_pos.normalize(); setControlFlags(AGENT_CONTROL_STOP); @@ -4615,9 +4617,9 @@ void LLAgent::lookAtLastChat() LLVector3 new_camera_pos = mAvatarObject->mHeadp->getWorldPosition(); LLVector3 left = delta_pos % LLVector3::z_axis; - left.normVec(); + left.normalize(); LLVector3 up = left % delta_pos; - up.normVec(); + up.normalize(); new_camera_pos -= delta_pos * 0.4f; new_camera_pos += left * 0.3f; new_camera_pos += up * 0.2f; @@ -4631,68 +4633,107 @@ void LLAgent::lookAtLastChat() const F32 SIT_POINT_EXTENTS = 0.2f; -// Grabs current position -void LLAgent::setStartPosition(U32 location_id) -{ - LLViewerObject *object; - - if ( !(gAgentID == LLUUID::null) ) - { - // we've got an ID for an agent viewerobject - object = gObjectList.findObject(gAgentID); - if (object) - { - // we've got the viewer object - // Sometimes the agent can be velocity interpolated off of - // this simulator. Clamp it to the region the agent is - // in, a little bit in on each side. - const F32 INSET = 0.5f; //meters - const F32 REGION_WIDTH = LLWorld::getInstance()->getRegionWidthInMeters(); - - LLVector3 agent_pos = getPositionAgent(); - - if (mAvatarObject) - { - // the z height is at the agent's feet - agent_pos.mV[VZ] -= 0.5f * mAvatarObject->mBodySize.mV[VZ]; - } - - agent_pos.mV[VX] = llclamp( agent_pos.mV[VX], INSET, REGION_WIDTH - INSET ); - agent_pos.mV[VY] = llclamp( agent_pos.mV[VY], INSET, REGION_WIDTH - INSET ); - - // Don't let them go below ground, or too high. - agent_pos.mV[VZ] = llclamp( agent_pos.mV[VZ], - mRegionp->getLandHeightRegion( agent_pos ), - LLWorld::getInstance()->getRegionMaxHeight() ); - - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_SetStartLocationRequest); - msg->nextBlockFast( _PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, getID()); - msg->addUUIDFast(_PREHASH_SessionID, getSessionID()); - msg->nextBlockFast( _PREHASH_StartLocationData); - // corrected by sim - msg->addStringFast(_PREHASH_SimName, ""); - msg->addU32Fast(_PREHASH_LocationID, location_id); - msg->addVector3Fast(_PREHASH_LocationPos, agent_pos); - msg->addVector3Fast(_PREHASH_LocationLookAt,mFrameAgent.getAtAxis()); - - // Reliable only helps when setting home location. Last - // location is sent on quit, and we don't have time to ack - // the packets. - msg->sendReliable(mRegionp->getHost()); - - const U32 HOME_INDEX = 1; - if( HOME_INDEX == location_id ) - { - setHomePosRegion( mRegionp->getHandle(), getPositionAgent() ); - } - } - else - { - llinfos << "setStartPosition - Can't find agent viewerobject id " << gAgentID << llendl; - } - } +void LLAgent::setStartPosition( U32 location_id ) +{ + LLViewerObject *object; + + if ( !(gAgentID == LLUUID::null) ) + { + // we've got an ID for an agent viewerobject + object = gObjectList.findObject(gAgentID); + if (object) + { + // we've got the viewer object + // Sometimes the agent can be velocity interpolated off of + // this simulator. Clamp it to the region the agent is + // in, a little bit in on each side. + const F32 INSET = 0.5f; //meters + const F32 REGION_WIDTH = LLWorld::getInstance()->getRegionWidthInMeters(); + + LLVector3 agent_pos = getPositionAgent(); + LLVector3 agent_look_at = mFrameAgent.getAtAxis(); + + if (mAvatarObject) + { + // the z height is at the agent's feet + agent_pos.mV[VZ] -= 0.5f * mAvatarObject->mBodySize.mV[VZ]; + } + + agent_pos.mV[VX] = llclamp( agent_pos.mV[VX], INSET, REGION_WIDTH - INSET ); + agent_pos.mV[VY] = llclamp( agent_pos.mV[VY], INSET, REGION_WIDTH - INSET ); + + // Don't let them go below ground, or too high. + agent_pos.mV[VZ] = llclamp( agent_pos.mV[VZ], + mRegionp->getLandHeightRegion( agent_pos ), + LLWorld::getInstance()->getRegionMaxHeight() ); + // Send the CapReq + + LLSD body; + + std::string url = gAgent.getRegion()->getCapability("HomeLocation"); + std::ostringstream strBuffer; + if( url.empty() ) + { + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_SetStartLocationRequest); + msg->nextBlockFast( _PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, getID()); + msg->addUUIDFast(_PREHASH_SessionID, getSessionID()); + msg->nextBlockFast( _PREHASH_StartLocationData); + // corrected by sim + msg->addStringFast(_PREHASH_SimName, ""); + msg->addU32Fast(_PREHASH_LocationID, location_id); + msg->addVector3Fast(_PREHASH_LocationPos, agent_pos); + msg->addVector3Fast(_PREHASH_LocationLookAt,mFrameAgent.getAtAxis()); + + // Reliable only helps when setting home location. Last + // location is sent on quit, and we don't have time to ack + // the packets. + msg->sendReliable(mRegionp->getHost()); + + const U32 HOME_INDEX = 1; + if( HOME_INDEX == location_id ) + { + setHomePosRegion( mRegionp->getHandle(), getPositionAgent() ); + } + } + else + { + strBuffer << location_id; + body["HomeLocation"]["LocationId"] = strBuffer.str(); + + strBuffer.str(""); + strBuffer << agent_pos.mV[VX]; + body["HomeLocation"]["LocationPos"]["X"] = strBuffer.str(); + + strBuffer.str(""); + strBuffer << agent_pos.mV[VY]; + body["HomeLocation"]["LocationPos"]["Y"] = strBuffer.str(); + + strBuffer.str(""); + strBuffer << agent_pos.mV[VZ]; + body["HomeLocation"]["LocationPos"]["Z"] = strBuffer.str(); + + strBuffer.str(""); + strBuffer << agent_look_at.mV[VX]; + body["HomeLocation"]["LocationLookAt"]["X"] = strBuffer.str(); + + strBuffer.str(""); + strBuffer << agent_look_at.mV[VY]; + body["HomeLocation"]["LocationLookAt"]["Y"] = strBuffer.str(); + + strBuffer.str(""); + strBuffer << agent_look_at.mV[VZ]; + body["HomeLocation"]["LocationLookAt"]["Z"] = strBuffer.str(); + + LLHTTPClient::post( url, body, new LLHomeLocationResponder() ); + } + } + else + { + llinfos << "setStartPosition - Can't find agent viewerobject id " << gAgentID << llendl; + } + } } void LLAgent::requestStopMotion( LLMotion* motion ) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 045e7ccf16..4c8ea54d8d 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1366,8 +1366,7 @@ bool LLAppViewer::cleanup() gImageList.shutdown(); // shutdown again in case a callback added something // This should eventually be done in LLAppViewer - LLImageJ2C::closeDSO(); - LLImageFormatted::cleanupClass(); + LLImage::cleanupClass(); LLVFSThread::cleanupClass(); LLLFSThread::cleanupClass(); @@ -1435,8 +1434,7 @@ bool LLAppViewer::initThreads() LLAppViewer::sImageDecodeThread = new LLWorkerThread("ImageDecode", enable_threads && true); LLAppViewer::sTextureCache = new LLTextureCache(enable_threads && true); LLAppViewer::sTextureFetch = new LLTextureFetch(LLAppViewer::getTextureCache(), enable_threads && false); - LLImageWorker::initClass(LLAppViewer::getImageDecodeThread()); - LLImageJ2C::openDSO(); + LLImage::initClass(LLAppViewer::getImageDecodeThread()); // *FIX: no error handling here! return true; diff --git a/indra/newview/llhomelocationresponder.cpp b/indra/newview/llhomelocationresponder.cpp new file mode 100644 index 0000000000..9eccc18ccd --- /dev/null +++ b/indra/newview/llhomelocationresponder.cpp @@ -0,0 +1,108 @@ +/** + * @file llhomelocationresponder.cpp + * @author Meadhbh Hamrick + * @brief Processes responses to the HomeLocation CapReq + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +/* File Inclusions */ +#include "llviewerprecompiledheaders.h" + +#include "llhomelocationresponder.h" +#include "llsdutil.h" +#include "llagent.h" +#include "llviewerregion.h" + +void LLHomeLocationResponder::result( const LLSD& content ) +{ + LLVector3 agent_pos; + bool error = true; + + do { + + // was the call to /agent/<agent-id>/home-location successful? + // If not, we keep error set to true + if( ! content.has("success") ) + { + break; + } + + if( 0 != strncmp("true", content["success"].asString().c_str(), 4 ) ) + { + break; + } + + // did the simulator return a "justified" home location? + // If no, we keep error set to true + if( ! content.has( "HomeLocation" ) ) + { + break; + } + + if( ! content["HomeLocation"].has("LocationPos") ) + { + break; + } + + if( ! content["HomeLocation"]["LocationPos"].has("X") ) + { + break; + } + + agent_pos.mV[VX] = content["HomeLocation"]["LocationPos"]["X"].asInteger(); + + if( ! content["HomeLocation"]["LocationPos"].has("Y") ) + { + break; + } + + agent_pos.mV[VY] = content["HomeLocation"]["LocationPos"]["Y"].asInteger(); + + if( ! content["HomeLocation"]["LocationPos"].has("Z") ) + { + break; + } + + agent_pos.mV[VZ] = content["HomeLocation"]["LocationPos"]["Z"].asInteger(); + + error = false; + } while( 0 ); + + if( ! error ) + { + llinfos << "setting home position" << llendl; + + LLViewerRegion *viewer_region = gAgent.getRegion(); + gAgent.setHomePosRegion( viewer_region->getHandle(), agent_pos ); + } +} + +void LLHomeLocationResponder::error( const LLSD& content ) +{ + llinfos << "received error(" << ll_pretty_print_sd( content ) << ")" << llendl; +} diff --git a/indra/newview/llhomelocationresponder.h b/indra/newview/llhomelocationresponder.h new file mode 100644 index 0000000000..0851cb8fc1 --- /dev/null +++ b/indra/newview/llhomelocationresponder.h @@ -0,0 +1,47 @@ +/** + * @file llhomelocationresponder.h + * @author Meadhbh Hamrick + * @brief Processes responses to the HomeLocation CapReq + * + * $LicenseInfo:firstyear=2008&license=viewergpl$ + * + * Copyright (c) 2008, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + + /* Macro Definitions */ +#ifndef LL_LLHOMELOCATIONRESPONDER_H +#define LL_LLHOMELOCATIONRESPONDER_H + +/* File Inclusions */ +#include "llhttpclient.h" + +/* Typedef, Enum, Class, Struct, etc. */ +class LLHomeLocationResponder : public LLHTTPClient::Responder +{ + virtual void result( const LLSD& content ); + virtual void error( const LLSD& content ); +}; + +#endif diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 9aa7f54fa9..b890781ab2 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -73,7 +73,6 @@ F32 LLInventoryModel::sMinTimeBetweenFetches = 0.3f; F32 LLInventoryModel::sMaxTimeBetweenFetches = 10.f; BOOL LLInventoryModel::sTimelyFetchPending = FALSE; LLFrameTimer LLInventoryModel::sFetchTimer; -LLInventoryModel::cat_map_t LLInventoryModel::sBulkFetchMap; S16 LLInventoryModel::sBulkFetchCount = 0; // RN: for some reason, using std::queue in the header file confuses the compiler which things it's an xmlrpc_queue @@ -1021,18 +1020,27 @@ void LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id) } //Initialize statics. -LLAlertDialog* LLInventoryModel::fetchDescendentsResponder::sRetryDialog=NULL; -LLSD LLInventoryModel::fetchDescendentsResponder::sRetrySD; - bool LLInventoryModel::isBulkFetchProcessingComplete() { return ( (sFetchQueue.empty() - && sBulkFetchMap.empty() - && sBulkFetchCount==0) ? TRUE : FALSE ) ; + && sBulkFetchCount<=0) ? TRUE : FALSE ) ; } +class fetchDescendentsResponder: public LLHTTPClient::Responder +{ + public: + fetchDescendentsResponder(const LLSD& request_sd) : mRequestSD(request_sd) {}; + //fetchDescendentsResponder() {}; + void result(const LLSD& content); + void error(U32 status, const std::string& reason); + public: + typedef std::vector<LLViewerInventoryCategory*> folder_ref_t; + protected: + LLSD mRequestSD; +}; + //If we get back a normal response, handle it here -void LLInventoryModel::fetchDescendentsResponder::result(const LLSD& content) +void fetchDescendentsResponder::result(const LLSD& content) { if (content.has("folders")) { @@ -1049,13 +1057,20 @@ void LLInventoryModel::fetchDescendentsResponder::result(const LLSD& content) { llwarns << "Got a UpdateInventoryItem for the wrong agent." << llendl; - break; + continue; } LLUUID parent_id = folder_sd["folder-id"]; LLUUID owner_id = folder_sd["owner-id"]; S32 version = (S32)folder_sd["version"].asInteger(); S32 descendents = (S32)folder_sd["descendents"].asInteger(); LLPointer<LLViewerInventoryCategory> tcategory = new LLViewerInventoryCategory(owner_id); + + LLViewerInventoryCategory* pcat = gInventory.getCategory(parent_id); + if (!pcat) + { + continue; + } + for(LLSD::array_const_iterator category_it = folder_sd["categories"].beginArray(); category_it != folder_sd["categories"].endArray(); ++category_it) @@ -1063,7 +1078,7 @@ void LLInventoryModel::fetchDescendentsResponder::result(const LLSD& content) LLSD category = *category_it; tcategory->fromLLSD(category); - if (sFullFetchStarted) + if (LLInventoryModel::sFullFetchStarted) { sFetchQueue.push_back(tcategory->getUUID()); } @@ -1111,21 +1126,21 @@ void LLInventoryModel::fetchDescendentsResponder::result(const LLSD& content) LLInventoryModel::incrBulkFetch(-1); - if (isBulkFetchProcessingComplete()) + if (LLInventoryModel::isBulkFetchProcessingComplete()) { llinfos << "Inventory fetch completed" << llendl; - if (sFullFetchStarted) + if (LLInventoryModel::sFullFetchStarted) { - sAllFoldersFetched = TRUE; + LLInventoryModel::sAllFoldersFetched = TRUE; } - stopBackgroundFetch(); + LLInventoryModel::stopBackgroundFetch(); } gInventory.notifyObservers(); } //If we get back an error (not found, etc...), handle it here -void LLInventoryModel::fetchDescendentsResponder::error(U32 status, const std::string& reason) +void fetchDescendentsResponder::error(U32 status, const std::string& reason) { llinfos << "fetchDescendentsResponder::error " << status << ": " << reason << llendl; @@ -1139,63 +1154,24 @@ void LLInventoryModel::fetchDescendentsResponder::error(U32 status, const std::s ++folder_it) { LLSD folder_sd = *folder_it; - sRetrySD["folders"].append(folder_sd); - } - sMinTimeBetweenFetches = 10.0f; //Add 10 seconds for every time out in this sequence. - - if (!sRetryDialog) //The dialog isn't up. Prompt the resident. - { - sRetryDialog = gViewerWindow->alertXml("RetryFetchInventoryDescendents", onClickRetry, this); + LLUUID folder_id = folder_sd["folder-id"]; + sFetchQueue.push_front(folder_id); } } else { - if (isBulkFetchProcessingComplete()) + if (LLInventoryModel::isBulkFetchProcessingComplete()) { - if (sFullFetchStarted) + if (LLInventoryModel::sFullFetchStarted) { - sAllFoldersFetched = TRUE; + LLInventoryModel::sAllFoldersFetched = TRUE; } - stopBackgroundFetch(); + LLInventoryModel::stopBackgroundFetch(); } } gInventory.notifyObservers(); } -void LLInventoryModel::fetchDescendentsResponder::onClickRetry(S32 option, void* userdata) -{ - if (option == 0) - { - std::string url; - - LLViewerRegion * agent_region = gAgent.getRegion(); - if (agent_region) - { - url = agent_region->getCapability("FetchInventoryDescendents"); - } - - if (!url.empty()) //Capability found. Build up LLSD and use it. - { - LLSD body = sRetrySD; - LLInventoryModel::incrBulkFetch(1); - LLHTTPClient::post(url, body, new LLInventoryModel::fetchDescendentsResponder(body),300); - } - } - else - { - if (isBulkFetchProcessingComplete()) - { - if (sFullFetchStarted) - { - sAllFoldersFetched = TRUE; - } - stopBackgroundFetch(); - } - } - sRetryDialog=NULL; - sRetrySD.clear(); -} - //static Bundle up a bunch of requests to send all at once. void LLInventoryModel::bulkFetch(std::string url) { @@ -1206,7 +1182,7 @@ void LLInventoryModel::bulkFetch(std::string url) S16 max_concurrent_fetches=8; F32 new_min_time = 0.5f; //HACK! Clean this up when old code goes away entirely. - if (sMinTimeBetweenFetches <= new_min_time) sMinTimeBetweenFetches=new_min_time; //HACK! See above. + if (sMinTimeBetweenFetches < new_min_time) sMinTimeBetweenFetches=new_min_time; //HACK! See above. if(gDisconnected || sBulkFetchCount > max_concurrent_fetches @@ -1215,20 +1191,30 @@ void LLInventoryModel::bulkFetch(std::string url) return; // just bail if we are disconnected. } - //HACK. This is inelegant. We're shuffling a dequeue to a map to get rid of - //redundant requests. When we get rid of the old code entirely, we can change - //the dequeue to a map. In the new model, there is no benefit to queue order. U32 folder_count=0; - U32 max_batch_size=10; - while( !(sFetchQueue.empty() ) ) + U32 max_batch_size=5; + + U32 sort_order = gSavedSettings.getU32("InventorySortOrder") & 0x1; + + LLSD body; + + while( !(sFetchQueue.empty() ) && (folder_count < max_batch_size) ) { LLViewerInventoryCategory* cat = gInventory.getCategory(sFetchQueue.front()); if (cat) { - if ( !gInventory.isCategoryComplete(cat->getUUID()) ) //grab this folder. + if ( LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion()) { - sBulkFetchMap[(cat->getUUID())] = cat; + LLSD folder_sd; + folder_sd["folder-id"] = cat->getUUID(); + folder_sd["owner-id"] = cat->getOwnerID(); + folder_sd["sort-order"] = (LLSD::Integer)sort_order; + folder_sd["fetch-folders"] = (LLSD::Boolean)sFullFetchStarted; + folder_sd["fetch-items"] = (LLSD::Boolean)TRUE; + body["folders"].append(folder_sd); + + folder_count++; } else if (sFullFetchStarted) { //Already have this folder but append child folders to list. @@ -1249,54 +1235,14 @@ void LLInventoryModel::bulkFetch(std::string url) sFetchQueue.pop_front(); } - - if (!sBulkFetchMap.empty()) //There's stuff to fetch. - { - U32 sort_order = gSavedSettings.getU32("InventorySortOrder") & 0x1; - - LLSD body; - - cat_map_t::iterator iter=sBulkFetchMap.begin(); - while( iter!=sBulkFetchMap.end() && (folder_count < max_batch_size) ) - { - LLViewerInventoryCategory* cat = iter->second; - - if (cat && !gInventory.isCategoryComplete(cat->getUUID()) ) //Category exists - { - BOOL fetchItems=TRUE; - if ( sFullFetchStarted - && gInventory.isCategoryComplete(cat->getUUID()) ) - { - fetchItems=FALSE; - } - - LLSD folder_sd; - folder_sd["folder-id"] = cat->getUUID(); - folder_sd["owner-id"] = cat->getOwnerID(); - folder_sd["sort-order"] = (LLSD::Integer)sort_order; - folder_sd["fetch-folders"] = (LLSD::Boolean)sFullFetchStarted; - folder_sd["fetch-items"] = (LLSD::Boolean)fetchItems; - body["folders"].append(folder_sd); - - folder_count++; - } - sBulkFetchMap.erase(iter); - iter=sBulkFetchMap.begin(); - } - - if (iter == sBulkFetchMap.end()) sBulkFetchMap.clear(); - if (folder_count > 0) { sBulkFetchCount++; - LLHTTPClient::post(url, body, new LLInventoryModel::fetchDescendentsResponder(body)); + LLHTTPClient::post(url, body, new fetchDescendentsResponder(body)); sFetchTimer.reset(); } - - } - - if (isBulkFetchProcessingComplete()) + else if (isBulkFetchProcessingComplete()) { if (sFullFetchStarted) { @@ -1365,14 +1311,7 @@ void LLInventoryModel::backgroundFetch(void*) if (sBackgroundFetchActive) { //If we'll be using the capability, we'll be sending batches and the background thing isn't as important. - std::string url; - - LLViewerRegion * agent_region = gAgent.getRegion(); - if (agent_region) - { - url = agent_region->getCapability("FetchInventoryDescendents"); - } - + std::string url = gAgent.getRegion()->getCapability("FetchInventoryDescendents"); if (!url.empty()) { bulkFetch(url); diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index 85eb46404b..4889d622dc 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -110,21 +110,7 @@ public: LLInventoryModel(); ~LLInventoryModel(); - class fetchDescendentsResponder: public LLHTTPClient::Responder - { - public: - fetchDescendentsResponder(const LLSD& request_sd) : mRequestSD(request_sd) {}; - void result(const LLSD& content); - void error(U32 status, const std::string& reason); - static void onClickRetry(S32 option, void* userdata); - static void appendRetryList(LLSD retry_sd); - public: - typedef std::vector<LLViewerInventoryCategory*> folder_ref_t; - protected: - LLSD mRequestSD; - static LLSD sRetrySD; - static LLAlertDialog *sRetryDialog; - }; + // // Accessors @@ -364,7 +350,6 @@ public: // start and stop background breadth-first fetching of inventory contents // this gets triggered when performing a filter-search static void startBackgroundFetch(const LLUUID& cat_id = LLUUID::null); // start fetch process - static void stopBackgroundFetch(); // stop fetch process static BOOL backgroundFetchActive(); static bool isEverythingFetched(); static void backgroundFetch(void*); // background fetch idle function @@ -413,7 +398,6 @@ protected: static void processInventoryDescendents(LLMessageSystem* msg, void**); static void processMoveInventoryItem(LLMessageSystem* msg, void**); static void processFetchInventoryReply(LLMessageSystem* msg, void**); - static bool isBulkFetchProcessingComplete(); bool messageUpdateCore(LLMessageSystem* msg, bool do_accounting); @@ -447,11 +431,8 @@ protected: observer_list_t mObservers; // completing the fetch once per session should be sufficient - static cat_map_t sBulkFetchMap; static BOOL sBackgroundFetchActive; static BOOL sTimelyFetchPending; - static BOOL sAllFoldersFetched; - static BOOL sFullFetchStarted; static S32 sNumFetchRetries; static LLFrameTimer sFetchTimer; static F32 sMinTimeBetweenFetches; @@ -464,6 +445,11 @@ protected: public: // *NOTE: DEBUG functionality void dumpInventory(); + static bool isBulkFetchProcessingComplete(); + static void stopBackgroundFetch(); // stop fetch process + + static BOOL sFullFetchStarted; + static BOOL sAllFoldersFetched; }; // a special inventory model for the agent diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp index 8483e43394..84ba2dd807 100644 --- a/indra/newview/llpanelgrouplandmoney.cpp +++ b/indra/newview/llpanelgrouplandmoney.cpp @@ -705,12 +705,13 @@ BOOL LLPanelGroupLandMoney::postBuild() textp = getChild<LLTextEditor>("group_money_planning_text", true); panelp = getChild<LLPanel>("group_money_planning_tab", true); - if ( !can_view ) + if ( 1 ) //!can_view { textp->setText(mImplementationp->mCantViewAccountsText); } else { + //Temporally disabled for DEV-11287. mImplementationp->mMoneyPlanningTabEHp = new LLGroupMoneyPlanningTabEventHandler(textp, tabcp, diff --git a/indra/newview/llsprite.cpp b/indra/newview/llsprite.cpp index 1348f85201..c8a3904d96 100644 --- a/indra/newview/llsprite.cpp +++ b/indra/newview/llsprite.cpp @@ -126,8 +126,8 @@ void LLSprite::updateFace(LLFace &face) LLVector3 camera_vec = mPosition - sCameraPosition; mScaledRight = camera_vec % LLVector3(0.f, 0.f, 1.f); mScaledUp = -(camera_vec % mScaledRight); - mScaledUp.normVec(); - mScaledRight.normVec(); + mScaledUp.normalize(); + mScaledRight.normalize(); mScaledUp *= mHeightDiv2; mScaledRight *= mWidthDiv2; @@ -156,7 +156,7 @@ void LLSprite::updateFace(LLFace &face) else { x_axis = sNormal % LLVector3(0.f, -1.f, 0.f); - x_axis.normVec(); + x_axis.normalize(); y_axis = sNormal % x_axis; } diff --git a/indra/newview/llsprite.h b/indra/newview/llsprite.h index 322150e85b..03026fd071 100644 --- a/indra/newview/llsprite.h +++ b/indra/newview/llsprite.h @@ -73,7 +73,7 @@ public: void setColor(const LLColor4 &color); void setColor(const F32 r, const F32 g, const F32 b, const F32 a); void setAlpha(const F32 alpha) { mColor.mV[VALPHA] = alpha; } - void setNormal(const LLVector3 &normal) { sNormal = normal; sNormal.normVec();} + void setNormal(const LLVector3 &normal) { sNormal = normal; sNormal.normalize();} F32 getAlpha(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 2f8f5a29c5..26d526c988 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -2346,37 +2346,71 @@ class LLAvatarDebug : public view_listener_t } }; +struct MenuCallbackData +{ + bool ban_enabled; + LLUUID avatar_id; +}; + void callback_eject(S32 option, void* data) { - LLUUID* avatar_id = (LLUUID*) data; + MenuCallbackData *callback_data = (MenuCallbackData*)data; + if (!callback_data) + { + return; + } + if (2 == option) + { + // Cancle button. + return; + } + LLUUID avatar_id = callback_data->avatar_id; + bool ban_enabled = callback_data->ban_enabled; - if (0 == option || 1 == option) + if (0 == option) { + // Eject button LLMessageSystem* msg = gMessageSystem; - LLViewerObject* avatar = gObjectList.findObject(*avatar_id); + LLViewerObject* avatar = gObjectList.findObject(avatar_id); if (avatar) { U32 flags = 0x0; - if (1 == option) - { - // eject and add to ban list - flags |= 0x1; - } + msg->newMessage("EjectUser"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgent.getID() ); + msg->addUUID("SessionID", gAgent.getSessionID() ); + msg->nextBlock("Data"); + msg->addUUID("TargetID", avatar_id ); + msg->addU32("Flags", flags ); + msg->sendReliable( avatar->getRegion()->getHost() ); + } + } + else if (ban_enabled) + { + // This is tricky. It is similar to say if it is not an 'Eject' button, + // and it is also not an 'Cancle' button, and ban_enabled==ture, + // it should be the 'Eject and Ban' button. + LLMessageSystem* msg = gMessageSystem; + LLViewerObject* avatar = gObjectList.findObject(avatar_id); + if (avatar) + { + U32 flags = 0x1; msg->newMessage("EjectUser"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID() ); msg->addUUID("SessionID", gAgent.getSessionID() ); msg->nextBlock("Data"); - msg->addUUID("TargetID", *avatar_id ); + msg->addUUID("TargetID", avatar_id ); msg->addU32("Flags", flags ); msg->sendReliable( avatar->getRegion()->getHost() ); } } - delete avatar_id; - avatar_id = NULL; + + delete callback_data; + callback_data = NULL; } class LLAvatarEject : public view_listener_t @@ -2386,23 +2420,50 @@ class LLAvatarEject : public view_listener_t LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getFirstObject() ); if( avatar ) { - LLUUID* avatar_id = new LLUUID( avatar->getID() ); + MenuCallbackData *data = new MenuCallbackData; + (*data).avatar_id = avatar->getID(); std::string fullname = avatar->getFullname(); - if (!fullname.empty()) + const LLVector3d& pos = avatar->getPositionGlobal(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos)->getParcel(); + + if (LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_MANAGE_BANNED)) { - LLStringUtil::format_map_t args; - args["[AVATAR_NAME]"] = fullname; - gViewerWindow->alertXml("EjectAvatarFullname", - args, - callback_eject, - (void*)avatar_id); + (*data).ban_enabled = true; + if (!fullname.empty()) + { + LLStringUtil::format_map_t args; + args["[AVATAR_NAME]"] = fullname; + gViewerWindow->alertXml("EjectAvatarFullname", + args, + callback_eject, + (void*)data); + } + else + { + gViewerWindow->alertXml("EjectAvatar", + callback_eject, + (void*)data); + } } else { - gViewerWindow->alertXml("EjectAvatar", - callback_eject, - (void*)avatar_id); + (*data).ban_enabled = false; + if (!fullname.empty()) + { + LLStringUtil::format_map_t args; + args["[AVATAR_NAME]"] = fullname; + gViewerWindow->alertXml("EjectAvatarFullnameNoBan", + args, + callback_eject, + (void*)data); + } + else + { + gViewerWindow->alertXml("EjectAvatarNoBan", + callback_eject, + (void*)data); + } } } return true; @@ -2419,12 +2480,18 @@ class LLAvatarEnableFreezeEject : public view_listener_t if (new_value) { const LLVector3& pos = avatar->getPositionRegion(); + const LLVector3d& pos_global = avatar->getPositionGlobal(); + LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos_global)->getParcel(); LLViewerRegion* region = avatar->getRegion(); new_value = (region != NULL); - + if (new_value) { - new_value = (region->isOwnedSelf(pos) || region->isOwnedGroup(pos)); + new_value = region->isOwnedSelf(pos); + if (!new_value || region->isOwnedGroup(pos)) + { + new_value = LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_ADMIN); + } } } diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index b27d33b0e6..27badfb1dd 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -503,7 +503,7 @@ void handle_compress_image(void*) } else { - llinfos << "Compression failed: " << LLImageBase::getLastError() << llendl; + llinfos << "Compression failed: " << LLImage::getLastError() << llendl; } infile = picker.getNextFile(); @@ -554,9 +554,9 @@ void upload_new_resource(const std::string& src_filename, std::string name, IMG_CODEC_BMP )) { error_message = llformat( "Problem with file %s:\n\n%s\n", - src_filename.c_str(), LLImageBase::getLastError().c_str()); + src_filename.c_str(), LLImage::getLastError().c_str()); args["[FILE]"] = src_filename; - args["[ERROR]"] = LLImageBase::getLastError(); + args["[ERROR]"] = LLImage::getLastError(); upload_error(error_message, "ProblemWithFile", filename, args); return; } @@ -569,9 +569,9 @@ void upload_new_resource(const std::string& src_filename, std::string name, IMG_CODEC_TGA )) { error_message = llformat("Problem with file %s:\n\n%s\n", - src_filename.c_str(), LLImageBase::getLastError().c_str()); + src_filename.c_str(), LLImage::getLastError().c_str()); args["[FILE]"] = src_filename; - args["[ERROR]"] = LLImageBase::getLastError(); + args["[ERROR]"] = LLImage::getLastError(); upload_error(error_message, "ProblemWithFile", filename, args); return; } @@ -584,9 +584,9 @@ void upload_new_resource(const std::string& src_filename, std::string name, IMG_CODEC_JPEG )) { error_message = llformat("Problem with file %s:\n\n%s\n", - src_filename.c_str(), LLImageBase::getLastError().c_str()); + src_filename.c_str(), LLImage::getLastError().c_str()); args["[FILE]"] = src_filename; - args["[ERROR]"] = LLImageBase::getLastError(); + args["[ERROR]"] = LLImage::getLastError(); upload_error(error_message, "ProblemWithFile", filename, args); return; } @@ -599,9 +599,9 @@ void upload_new_resource(const std::string& src_filename, std::string name, IMG_CODEC_PNG )) { error_message = llformat("Problem with file %s:\n\n%s\n", - src_filename.c_str(), LLImageBase::getLastError().c_str()); + src_filename.c_str(), LLImage::getLastError().c_str()); args["[FILE]"] = src_filename; - args["[ERROR]"] = LLImageBase::getLastError(); + args["[ERROR]"] = LLImage::getLastError(); upload_error(error_message, "ProblemWithFile", filename, args); return; } diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index b22ca7d2e9..f8c7b317f0 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1389,6 +1389,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url) capabilityNames.append("EventQueueGet"); capabilityNames.append("FetchInventoryDescendents"); capabilityNames.append("GroupProposalBallot"); + capabilityNames.append("HomeLocation"); capabilityNames.append("MapLayer"); capabilityNames.append("MapLayerGod"); capabilityNames.append("NewFileAgentInventory"); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e9440dc9cb..d5d7056ef7 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1131,7 +1131,7 @@ void LLVOAvatar::dumpBakedStatus() } - F64 dist_to_camera = (inst->getPositionGlobal() - camera_pos_global).magVec(); + F64 dist_to_camera = (inst->getPositionGlobal() - camera_pos_global).length(); llcont << " " << dist_to_camera << "m "; llcont << " " << inst->mPixelArea << " pixels"; @@ -2684,8 +2684,8 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) else { getSpatialExtents(ext[0], ext[1]); - if ((ext[1]-mImpostorExtents[1]).magVec() > 0.05f || - (ext[0]-mImpostorExtents[0]).magVec() > 0.05f) + if ((ext[1]-mImpostorExtents[1]).length() > 0.05f || + (ext[0]-mImpostorExtents[0]).length() > 0.05f) { mNeedsImpostorUpdate = TRUE; } @@ -2852,7 +2852,7 @@ void LLVOAvatar::idleUpdateWindEffect() F32 time_delta = mRippleTimer.getElapsedTimeF32() - mRippleTimeLast; mRippleTimeLast = mRippleTimer.getElapsedTimeF32(); LLVector3 velocity = getVelocity(); - F32 speed = velocity.magVec(); + F32 speed = velocity.length(); //RN: velocity varies too much frame to frame for this to work mRippleAccel.clearVec();//lerp(mRippleAccel, (velocity - mLastVel) * time_delta, LLCriticalDamp::getInterpolant(0.02f)); mLastVel = velocity; @@ -2871,7 +2871,7 @@ void LLVOAvatar::idleUpdateWindEffect() } wind.mV[VZ] += hover_strength; - wind.normVec(); + wind.normalize(); wind.mV[VW] = llmin(0.025f + (speed * 0.015f) + hover_strength, 0.5f); F32 interp; @@ -2994,10 +2994,10 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) LLVector3 pixel_up_vec; LLViewerCamera::getInstance()->getPixelVectors(root_pos_last, pixel_up_vec, pixel_right_vec); LLVector3 camera_to_av = root_pos_last - LLViewerCamera::getInstance()->getOrigin(); - camera_to_av.normVec(); + camera_to_av.normalize(); LLVector3 local_camera_at = camera_to_av * ~root_rot; LLVector3 local_camera_up = camera_to_av % LLViewerCamera::getInstance()->getLeftAxis(); - local_camera_up.normVec(); + local_camera_up.normalize(); local_camera_up = local_camera_up * ~root_rot; local_camera_up.scaleVec(mBodySize * 0.5f); @@ -3456,7 +3456,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) LLVector3 xyVel = getVelocity(); xyVel.mV[VZ] = 0.0f; - speed = xyVel.magVec(); + speed = xyVel.length(); BOOL throttle = TRUE; @@ -3541,14 +3541,14 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) if (mIsSelf) { primDir = agent.getAtAxis() - projected_vec(agent.getAtAxis(), agent.getReferenceUpVector()); - primDir.normVec(); + primDir.normalize(); } else { primDir = getRotation().getMatrix3().getFwdRow(); } LLVector3 velDir = getVelocity(); - velDir.normVec(); + velDir.normalize(); if ( mSignaledAnimations.find(ANIM_AGENT_WALK) != mSignaledAnimations.end()) { F32 vpD = velDir * primDir; @@ -3570,13 +3570,13 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) LLVector3 at_axis = LLViewerCamera::getInstance()->getAtAxis(); LLVector3 up_vector = gAgent.getReferenceUpVector(); at_axis -= up_vector * (at_axis * up_vector); - at_axis.normVec(); + at_axis.normalize(); F32 dot = fwdDir * at_axis; if (dot < 0.f) { fwdDir -= 2.f * at_axis * dot; - fwdDir.normVec(); + fwdDir.normalize(); } } @@ -3644,7 +3644,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // Now compute the full world space rotation for the whole body (wQv) LLVector3 leftDir = upDir % fwdDir; - leftDir.normVec(); + leftDir.normalize(); fwdDir = leftDir % upDir; LLQuaternion wQv( fwdDir, leftDir, upDir ); @@ -4253,7 +4253,7 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color) LLVector3 pos(getRenderPosition()+mImpostorOffset); LLVector3 at = (pos - LLViewerCamera::getInstance()->getOrigin()); - at.normVec(); + at.normalize(); LLVector3 left = LLViewerCamera::getInstance()->getUpAxis() % at; LLVector3 up = at%left; @@ -5784,7 +5784,7 @@ void LLVOAvatar::setPixelAreaAndAngle(LLAgent &agent) } else { - F32 radius = size.magVec(); + F32 radius = size.length(); mAppAngle = (F32) atan2( radius, range) * RAD_TO_DEG; } @@ -5953,7 +5953,7 @@ void LLVOAvatar::updateShadowFaces() sprite.setPosition(shadow_pos_agent); LLVector3 foot_to_knee = mKneeLeftp->getWorldPosition() - joint_world_pos; - //foot_to_knee.normVec(); + //foot_to_knee.normalize(); foot_to_knee -= projected_vec(foot_to_knee, sun_vec); sprite.setYaw(azimuth(sun_vec - foot_to_knee)); @@ -5986,7 +5986,7 @@ void LLVOAvatar::updateShadowFaces() sprite.setPosition(shadow_pos_agent); LLVector3 foot_to_knee = mKneeRightp->getWorldPosition() - joint_world_pos; - //foot_to_knee.normVec(); + //foot_to_knee.normalize(); foot_to_knee -= projected_vec(foot_to_knee, sun_vec); sprite.setYaw(azimuth(sun_vec - foot_to_knee)); @@ -6355,7 +6355,7 @@ void LLVOAvatar::getOffObject() LLVector3 at_axis = LLVector3::x_axis; at_axis = at_axis * av_rot; at_axis.mV[VZ] = 0.f; - at_axis.normVec(); + at_axis.normalize(); gAgent.resetAxes(at_axis); //reset orientation @@ -9861,7 +9861,7 @@ void LLVOAvatar::getImpostorValues(LLVector3* extents, LLVector3& angle, F32& di extents[1] = ext[1]; LLVector3 at = LLViewerCamera::getInstance()->getOrigin()-(getRenderPosition()+mImpostorOffset); - distance = at.normVec(); + distance = at.normalize(); F32 da = 1.f - (at*LLViewerCamera::getInstance()->getAtAxis()); angle.mV[0] = LLViewerCamera::getInstance()->getYaw()*da; angle.mV[1] = LLViewerCamera::getInstance()->getPitch()*da; diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index cc7d73e37a..c7326688a0 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -273,9 +273,9 @@ U32 LLVOGrass::processUpdateMessage(LLMessageSystem *mesgsys, updateSpecies(); - if ( (getVelocity().magVecSquared() > 0.f) - ||(getAcceleration().magVecSquared() > 0.f) - ||(getAngularVelocity().magVecSquared() > 0.f)) + if ( (getVelocity().lengthSquared() > 0.f) + ||(getAcceleration().lengthSquared() > 0.f) + ||(getAngularVelocity().lengthSquared() > 0.f)) { llinfos << "ACK! Moving grass!" << llendl; setVelocity(LLVector3::zero); @@ -322,7 +322,7 @@ void LLVOGrass::setPixelAreaAndAngle(LLAgent &agent) { // This should be the camera's center, as soon as we move to all region-local. LLVector3 relative_position = getPositionAgent() - agent.getCameraPositionAgent(); - F32 range = relative_position.magVec(); + F32 range = relative_position.length(); F32 max_scale = getMaxScale(); @@ -501,7 +501,7 @@ void LLVOGrass::getGeometry(S32 idx, LLVector3 normal1 = (v1-v2) % (v2-v3); normal1.mV[VZ] = 0.75f; - normal1.normVec(); + normal1.normalize(); LLVector3 normal2 = -normal1; normal2.mV[VZ] = -normal2.mV[VZ]; diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index 6cc61e36e0..3724a94edd 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -95,7 +95,7 @@ void LLVOPartGroup::setPixelAreaAndAngle(LLAgent &agent) { // mPixelArea is calculated during render F32 mid_scale = getMidScale(); - F32 range = (getRenderPosition()-LLViewerCamera::getInstance()->getOrigin()).magVec(); + F32 range = (getRenderPosition()-LLViewerCamera::getInstance()->getOrigin()).length(); if (range < 0.001f || isHUDAttachment()) // range == zero { @@ -189,7 +189,7 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) LLVector3 part_pos_agent(part->mPosAgent); at = part_pos_agent - camera_agent; - F32 camera_dist_squared = at.magVecSquared(); + F32 camera_dist_squared = at.lengthSquared(); F32 inv_camera_dist_squared; if (camera_dist_squared > 1.f) inv_camera_dist_squared = 1.f / camera_dist_squared; @@ -283,26 +283,26 @@ void LLVOPartGroup::getGeometry(S32 idx, LLVector3 up, right; right = at % LLVector3(0.f, 0.f, 1.f); - right.normVec(); + right.normalize(); up = right % at; - up.normVec(); + up.normalize(); if (part.mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK) { LLVector3 normvel = part.mVelocity; - normvel.normVec(); + normvel.normalize(); LLVector2 up_fracs; up_fracs.mV[0] = normvel*right; up_fracs.mV[1] = normvel*up; - up_fracs.normVec(); + up_fracs.normalize(); LLVector3 new_up; LLVector3 new_right; new_up = up_fracs.mV[0] * right + up_fracs.mV[1]*up; new_right = up_fracs.mV[1] * right - up_fracs.mV[0]*up; up = new_up; right = new_right; - up.normVec(); - right.normVec(); + up.normalize(); + right.normalize(); } right *= 0.5f*part.mScale.mV[0]; diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 330d5c370d..e619ca1754 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -528,7 +528,7 @@ void LLVOSky::initSkyTextureDirs(const S32 side, const S32 tile) coeff[x_coef] = F32((x<<1) + 1) * inv_res - 1.f; coeff[y_coef] = F32((y<<1) + 1) * inv_res - 1.f; LLVector3 dir(coeff[0], coeff[1], coeff[2]); - dir.normVec(); + dir.normalize(); mSkyTex[side].setDir(dir, x, y); mShinyTex[side].setDir(dir, x, y); } @@ -762,7 +762,7 @@ void LLVOSky::calcSkyColorWLVert(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLCo Pn *= (-32000.f / Pn[1]); } - Plen = Pn.magVec(); + Plen = Pn.length(); Pn /= Plen; // Initialize temp variables @@ -1082,7 +1082,7 @@ BOOL LLVOSky::updateSky() const static F32 COLOR_CHANGE_THRESHOLD = 0.01f; LLVector3 direction = mSun.getDirection(); - direction.normVec(); + direction.normalize(); const F32 dot_lighting = direction * mLastLightingDirection; LLColor3 delta_color; @@ -1092,7 +1092,7 @@ BOOL LLVOSky::updateSky() if ( mForceUpdate || ((dot_lighting < LIGHT_DIRECTION_THRESHOLD) - || (delta_color.magVec() > COLOR_CHANGE_THRESHOLD) + || (delta_color.length() > COLOR_CHANGE_THRESHOLD) || !mInitialized) && !direction.isExactlyZero()) { @@ -1336,8 +1336,8 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable) const LLVector3 &look_at = LLViewerCamera::getInstance()->getAtAxis(); LLVector3 right = look_at % LLVector3::z_axis; LLVector3 up = right % look_at; - right.normVec(); - up.normVec(); + right.normalize(); + up.normalize(); const static F32 elevation_factor = 0.0f/sResolution; const F32 cos_max_angle = cosHorizon(elevation_factor); @@ -1417,8 +1417,8 @@ BOOL LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 f, cons LLVector3 hb_right = to_dir % LLVector3::z_axis; LLVector3 hb_up = hb_right % to_dir; - hb_right.normVec(); - hb_up.normVec(); + hb_right.normalize(); + hb_up.normalize(); //const static F32 cos_max_turn = sqrt(3.f) / 2; // 30 degrees //const F32 cos_turn_right = 1. / (llmax(cos_max_turn, hb_right * right)); @@ -1601,8 +1601,8 @@ void LLVOSky::updateSunHaloGeometry(LLDrawable *drawable ) const LLVector3 right = 2 * (v_corner[2] - v_corner[0]); LLVector3 up = 2 * (v_corner[2] - v_corner[3]); - up.normVec(); - F32 size = right.magVec(); + up.normalize(); + F32 size = right.length(); up = size * up; const LLVector3 draw_pos = 0.25 * (v_corner[0] + v_corner[1] + v_corner[2] + v_corner[3]); @@ -1654,7 +1654,7 @@ void LLVOSky::updateSunHaloGeometry(LLDrawable *drawable ) F32 dtReflection(const LLVector3& p, F32 cos_dir_from_top, F32 sin_dir_from_top, F32 diff_angl_dir) { LLVector3 P = p; - P.normVec(); + P.normalize(); const F32 cos_dir_angle = -P.mV[VZ]; const F32 sin_dir_angle = sqrt(1 - cos_dir_angle * cos_dir_angle); @@ -1679,9 +1679,9 @@ F32 dtClip(const LLVector3& v0, const LLVector3& v1, F32 far_clip2) { F32 dt_clip; const LLVector3 otrezok = v1 - v0; - const F32 A = otrezok.magVecSquared(); + const F32 A = otrezok.lengthSquared(); const F32 B = v0 * otrezok; - const F32 C = v0.magVecSquared() - far_clip2; + const F32 C = v0.lengthSquared() - far_clip2; const F32 det = sqrt(B*B - A*C); dt_clip = (-B - det) / A; if ((dt_clip < 0) || (dt_clip > 1)) @@ -1701,16 +1701,16 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, LLVector3 hb_pos = to_dir * (HORIZON_DIST - 10); LLVector3 to_dir_proj = to_dir; to_dir_proj.mV[VZ] = 0; - to_dir_proj.normVec(); + to_dir_proj.normalize(); LLVector3 Right = to_dir % LLVector3::z_axis; LLVector3 Up = Right % to_dir; - Right.normVec(); - Up.normVec(); + Right.normalize(); + Up.normalize(); // finding angle between look direction and sprite. LLVector3 look_at_right = look_at % LLVector3::z_axis; - look_at_right.normVec(); + look_at_right.normalize(); const static F32 cos_horizon_angle = cosHorizon(0.0f/sResolution); //const static F32 horizon_angle = acos(cos_horizon_angle); @@ -1745,7 +1745,7 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, else dt_hor = llmax(0.0f, llmin(1.0f, dt_hor)); - top_hb.normVec(); + top_hb.normalize(); const F32 cos_angle_of_view = fabs(top_hb.mV[VZ]); const F32 extension = llmin (5.0f, 1.0f / cos_angle_of_view); @@ -1762,11 +1762,11 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, F32 cos_dir_from_top[2]; LLVector3 dir = stretch_corner[0]; - dir.normVec(); + dir.normalize(); cos_dir_from_top[0] = dir.mV[VZ]; dir = stretch_corner[1]; - dir.normVec(); + dir.normalize(); cos_dir_from_top[1] = dir.mV[VZ]; const F32 sin_dir_from_top = sqrt(1 - cos_dir_from_top[0] * cos_dir_from_top[0]); @@ -1789,7 +1789,7 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, for (vtx = 0; vtx < 2; ++vtx) { LLVector3 light_proj = v_corner[vtx]; - light_proj.normVec(); + light_proj.normalize(); const F32 z = light_proj.mV[VZ]; const F32 sin_angle = sqrt(1 - z * z); @@ -1813,9 +1813,9 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, S32 side = 0; LLVector3 refl_corn_norm[2]; refl_corn_norm[0] = v_refl_corner[1]; - refl_corn_norm[0].normVec(); + refl_corn_norm[0].normalize(); refl_corn_norm[1] = v_refl_corner[3]; - refl_corn_norm[1].normVec(); + refl_corn_norm[1].normalize(); F32 cos_refl_look_at[2]; cos_refl_look_at[0] = refl_corn_norm[0] * look_at; @@ -1833,13 +1833,13 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, F32 dt_clip; F32 vtx_near2, vtx_far2; - if ((vtx_far2 = v_refl_corner[side].magVecSquared()) > far_clip2) + if ((vtx_far2 = v_refl_corner[side].lengthSquared()) > far_clip2) { // whole thing is sprite: reflection is beyond far clip plane. dt_clip = 1.1f; quads = 1; } - else if ((vtx_near2 = v_refl_corner[side+1].magVecSquared()) > far_clip2) + else if ((vtx_near2 = v_refl_corner[side+1].lengthSquared()) > far_clip2) { // part is reflection, the rest is sprite. dt_clip = dtClip(v_refl_corner[side + 1], v_refl_corner[side], far_clip2); @@ -1903,7 +1903,7 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, { for (S32 vtx = 0; vtx < 4; ++vtx) { - F32 ratio = far_clip / v_refl_corner[vtx].magVec(); + F32 ratio = far_clip / v_refl_corner[vtx].length(); *(verticesp++) = v_refl_corner[vtx] = ratio * v_refl_corner[vtx] + mCameraPosAgent; } const LLVector3 draw_pos = 0.25 * @@ -1912,10 +1912,10 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, } else { - F32 ratio = far_clip / v_refl_corner[1].magVec(); + F32 ratio = far_clip / v_refl_corner[1].length(); v_sprite_corner[1] = v_refl_corner[1] * ratio; - ratio = far_clip / v_refl_corner[3].magVec(); + ratio = far_clip / v_refl_corner[3].length(); v_sprite_corner[3] = v_refl_corner[3] * ratio; v_refl_corner[1] = (1 - dt_clip) * v_refl_corner[1] + dt_clip * v_refl_corner[0]; @@ -2039,20 +2039,20 @@ void LLVOSky::updateFog(const F32 distance) LLVector3 tosun = getToSunLast(); const F32 tosun_z = tosun.mV[VZ]; tosun.mV[VZ] = 0.f; - tosun.normVec(); + tosun.normalize(); LLVector3 perp_tosun; perp_tosun.mV[VX] = -tosun.mV[VY]; perp_tosun.mV[VY] = tosun.mV[VX]; LLVector3 tosun_45 = tosun + perp_tosun; - tosun_45.normVec(); + tosun_45.normalize(); F32 delta = 0.06f; tosun.mV[VZ] = delta; perp_tosun.mV[VZ] = delta; tosun_45.mV[VZ] = delta; - tosun.normVec(); - perp_tosun.normVec(); - tosun_45.normVec(); + tosun.normalize(); + perp_tosun.normalize(); + tosun_45.normalize(); // Sky colors, just slightly above the horizon in the direction of the sun, perpendicular to the sun, and at a 45 degree angle to the sun. initAtmospherics(); @@ -2202,8 +2202,8 @@ F32 azimuth(const LLVector3 &v) void LLVOSky::initSunDirection(const LLVector3 &sun_dir, const LLVector3 &sun_ang_velocity) { - LLVector3 sun_direction = (sun_dir.magVec() == 0) ? LLVector3::x_axis : sun_dir; - sun_direction.normVec(); + LLVector3 sun_direction = (sun_dir.length() == 0) ? LLVector3::x_axis : sun_dir; + sun_direction.normalize(); mSun.setDirection(sun_direction); mSun.renewDirection(); mSun.setAngularVelocity(sun_ang_velocity); @@ -2222,8 +2222,8 @@ void LLVOSky::initSunDirection(const LLVector3 &sun_dir, const LLVector3 &sun_an void LLVOSky::setSunDirection(const LLVector3 &sun_dir, const LLVector3 &sun_ang_velocity) { - LLVector3 sun_direction = (sun_dir.magVec() == 0) ? LLVector3::x_axis : sun_dir; - sun_direction.normVec(); + LLVector3 sun_direction = (sun_dir.length() == 0) ? LLVector3::x_axis : sun_dir; + sun_direction.normalize(); // Push the sun "South" as it approaches directly overhead so that we can always see bump mapping // on the upward facing faces of cubes. @@ -2239,7 +2239,7 @@ void LLVOSky::setSunDirection(const LLVector3 &sun_dir, const LLVector3 &sun_ang // Blend between normal sun dir and adjusted sun dir based on how close we are // to having the sun overhead. mBumpSunDir = adjustedDir * sunDot + newDir * (1.0f - sunDot); - mBumpSunDir.normVec(); + mBumpSunDir.normalize(); F32 dp = mLastLightingDirection * sun_direction; mSun.setDirection(sun_direction); diff --git a/indra/newview/llvotextbubble.cpp b/indra/newview/llvotextbubble.cpp index b48a5a989c..952c3c9a87 100644 --- a/indra/newview/llvotextbubble.cpp +++ b/indra/newview/llvotextbubble.cpp @@ -126,7 +126,7 @@ void LLVOTextBubble::updateTextures(LLAgent &agent) LLVector3 position_local = getPositionAgent() - agent.getCameraPositionAgent(); F32 dot_product = position_local * agent.getFrameAgent().getAtAxis(); - F32 cos_angle = dot_product / position_local.magVec(); + F32 cos_angle = dot_product / position_local.length(); if (cos_angle > 1.f) { diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 97a1ed162d..0c9b524f7f 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -273,9 +273,9 @@ U32 LLVOTree::processUpdateMessage(LLMessageSystem *mesgsys, // Do base class updates... U32 retval = LLViewerObject::processUpdateMessage(mesgsys, user_data, block_num, update_type, dp); - if ( (getVelocity().magVecSquared() > 0.f) - ||(getAcceleration().magVecSquared() > 0.f) - ||(getAngularVelocity().magVecSquared() > 0.f)) + if ( (getVelocity().lengthSquared() > 0.f) + ||(getAcceleration().lengthSquared() > 0.f) + ||(getAngularVelocity().lengthSquared() > 0.f)) { llinfos << "ACK! Moving tree!" << llendl; setVelocity(LLVector3::zero); @@ -359,14 +359,14 @@ BOOL LLVOTree::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) mTrunkBend += mTrunkVel; mTrunkVel *= 0.99f; // Add damping - if (mTrunkBend.magVec() > 1.f) + if (mTrunkBend.length() > 1.f) { - mTrunkBend.normVec(); + mTrunkBend.normalize(); } - if (mTrunkVel.magVec() > 1.f) + if (mTrunkVel.length() > 1.f) { - mTrunkVel.normVec(); + mTrunkVel.normalize(); } return TRUE; @@ -391,7 +391,7 @@ void LLVOTree::setPixelAreaAndAngle(LLAgent &agent) // This should be the camera's center, as soon as we move to all region-local. LLVector3 relative_position = getPositionAgent() - agent.getCameraPositionAgent(); - F32 range = relative_position.magVec(); // ugh, square root + F32 range = relative_position.length(); // ugh, square root F32 max_scale = mBillboardScale * getMaxScale(); F32 area = max_scale * (max_scale*mBillboardRatio); @@ -713,9 +713,9 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable) LLVector2 tc; // This isn't totally accurate. Should compute based on slope as well. start_radius = r0 * (1.f + 1.2f*fabs(z - 0.66f*height)/height); - nvec.setVec( cos(nangle * DEG_TO_RAD)*start_radius*nvec_scale, - sin(nangle * DEG_TO_RAD)*start_radius*nvec_scale, - z*nvec_scalez); + nvec.set( cos(nangle * DEG_TO_RAD)*start_radius*nvec_scale, + sin(nangle * DEG_TO_RAD)*start_radius*nvec_scale, + z*nvec_scalez); // First and last slice at 0 radius (to bring in top/bottom of structure) radius = start_radius + turbulence3((F32*)&nvec.mV, (F32)fractal_depth)*noise_scale; @@ -918,7 +918,7 @@ void LLVOTree::updateRadius() void LLVOTree::updateSpatialExtents(LLVector3& newMin, LLVector3& newMax) { - F32 radius = getScale().magVec()*0.05f; + F32 radius = getScale().length()*0.05f; LLVector3 center = getRenderPosition(); F32 sz = mBillboardScale*mBillboardRatio*radius*0.5f; @@ -926,8 +926,8 @@ void LLVOTree::updateSpatialExtents(LLVector3& newMin, LLVector3& newMax) center += LLVector3(0, 0, size.mV[2]) * getRotation(); - newMin.setVec(center-size); - newMax.setVec(center+size); + newMin.set(center-size); + newMax.set(center+size); mDrawable->setPositionGroup(center); } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 225d9a18b2..c6a7e9e28d 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -89,7 +89,7 @@ LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *re mLOD = MIN_LOD; mSculptLevel = -2; mTextureAnimp = NULL; - mVObjRadius = LLVector3(1,1,0.5f).magVec(); + mVObjRadius = LLVector3(1,1,0.5f).length(); mNumFaces = 0; mLODChanged = FALSE; mSculptChanged = FALSE; @@ -570,7 +570,7 @@ F32 LLVOVolume::getTextureVirtualSize(LLFace* face) //get area of circle in texture space LLVector2 tdim = face->mTexExtents[1] - face->mTexExtents[0]; - F32 texel_area = (tdim * 0.5f).magVecSquared()*3.14159f; + F32 texel_area = (tdim * 0.5f).lengthSquared()*3.14159f; if (texel_area <= 0) { // Probably animated, use default @@ -821,7 +821,7 @@ BOOL LLVOVolume::calcLOD() S32 cur_detail = 0; - F32 radius = getVolume()->mLODScaleBias.scaledVec(getScale()).magVec(); + F32 radius = getVolume()->mLODScaleBias.scaledVec(getScale()).length(); F32 distance = mDrawable->mDistanceWRTCamera; distance *= sDistanceFactor; @@ -1680,7 +1680,7 @@ void LLVOVolume::generateSilhouette(LLSelectNode* nodep, const LLVector3& view_p //transform view vector into volume space view_vector -= getRenderPosition(); - mDrawable->mDistanceWRTCamera = view_vector.magVec(); + mDrawable->mDistanceWRTCamera = view_vector.length(); LLQuaternion worldRot = getRenderRotation(); view_vector = view_vector * ~worldRot; if (!isVolumeGlobal()) @@ -1721,7 +1721,7 @@ void LLVOVolume::updateRadius() return; } - mVObjRadius = getScale().magVec(); + mVObjRadius = getScale().length(); mDrawable->setRadius(mVObjRadius); } @@ -1834,7 +1834,7 @@ F32 LLVOVolume::getBinRadius() } else if (shrink_wrap) { - radius = (ext[1]-ext[0]).magVec()*0.5f; + radius = (ext[1]-ext[0]).length()*0.5f; } else if (mDrawable->isStatic()) { @@ -1956,13 +1956,13 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e if (normal != NULL) { *normal = volumeDirectionToAgent(*normal); - (*normal).normVec(); + (*normal).normalize(); } if (bi_normal != NULL) { *bi_normal = volumeDirectionToAgent(*bi_normal); - (*bi_normal).normVec(); + (*bi_normal).normalize(); } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index b9facb28b2..f3168be46c 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -3089,7 +3089,7 @@ void LLPipeline::setupAvatarLights(BOOL for_edit) camera_rot.invert(); LLVector4 light_pos = light_pos_cam * camera_rot; - light_pos.normVec(); + light_pos.normalize(); mHWLightColors[1] = diffuse; glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse.mV); @@ -3107,7 +3107,7 @@ void LLPipeline::setupAvatarLights(BOOL for_edit) LLVector3 opposite_pos = -1.f * mSunDir; LLVector3 orthog_light_pos = mSunDir % LLVector3::z_axis; LLVector4 backlight_pos = LLVector4(lerp(opposite_pos, orthog_light_pos, 0.3f), 0.0f); - backlight_pos.normVec(); + backlight_pos.normalize(); LLColor4 light_diffuse = mSunDiffuse; LLColor4 backlight_diffuse(1.f - light_diffuse.mV[VRED], 1.f - light_diffuse.mV[VGREEN], 1.f - light_diffuse.mV[VBLUE], 1.f); @@ -5172,11 +5172,11 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) LLVector3 left = camera.getLeftAxis(); left *= left; - left.normVec(); + left.normalize(); LLVector3 up = camera.getUpAxis(); up *= up; - up.normVec(); + up.normalize(); tdim.mV[0] = fabsf(half_height * left); tdim.mV[1] = fabsf(half_height * up); |