From 635128f353758e59c1ae158b2f01d291b0cea30f Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Thu, 26 Aug 2010 11:44:08 -0400 Subject: Added graphics preference setting for physics. --- indra/newview/app_settings/high_graphics.xml | 2 ++ indra/newview/app_settings/low_graphics.xml | 2 ++ indra/newview/app_settings/mid_graphics.xml | 2 ++ indra/newview/app_settings/settings.xml | 20 +++++++++--- indra/newview/app_settings/ultra_graphics.xml | 2 ++ indra/newview/llappviewer.cpp | 1 + indra/newview/llbreastmotion.cpp | 23 +++++++++++-- indra/newview/llbreastmotion.h | 1 + indra/newview/llfloaterpreference.cpp | 1 + indra/newview/llviewercontrol.cpp | 7 ++++ indra/newview/llvoavatar.cpp | 1 + indra/newview/llvoavatar.h | 1 + .../default/xui/en/panel_preferences_graphics1.xml | 38 +++++++++++++++++++--- 13 files changed, 90 insertions(+), 11 deletions(-) diff --git a/indra/newview/app_settings/high_graphics.xml b/indra/newview/app_settings/high_graphics.xml index 587b2f2a89..45236284f4 100644 --- a/indra/newview/app_settings/high_graphics.xml +++ b/indra/newview/app_settings/high_graphics.xml @@ -4,6 +4,8 @@ + + diff --git a/indra/newview/app_settings/low_graphics.xml b/indra/newview/app_settings/low_graphics.xml index a5bbdfc1d0..ad0073dfac 100644 --- a/indra/newview/app_settings/low_graphics.xml +++ b/indra/newview/app_settings/low_graphics.xml @@ -5,6 +5,8 @@ + + diff --git a/indra/newview/app_settings/mid_graphics.xml b/indra/newview/app_settings/mid_graphics.xml index a1430a58f9..d9d8682055 100644 --- a/indra/newview/app_settings/mid_graphics.xml +++ b/indra/newview/app_settings/mid_graphics.xml @@ -4,6 +4,8 @@ + + diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 8310c50b1e..d190ac7136 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -607,7 +607,17 @@ Value 10 - + AvatarPhysics + + Comment + Enable avatar physics, such as breast physics. + Persist + 1 + Type + Boolean + Value + 1 + AvatarSex Comment @@ -620,16 +630,16 @@ 0 - AvatarPhysics + RenderAvatarPhysicsLODFactor Comment - Enable avatar physics, such as breast physics. + Controls level of detail of avatar physics (such as breast physics). Persist 1 Type - Boolean + F32 Value - 1 + 1.0 BackgroundYieldTime diff --git a/indra/newview/app_settings/ultra_graphics.xml b/indra/newview/app_settings/ultra_graphics.xml index f741089ca2..3d588cf57d 100644 --- a/indra/newview/app_settings/ultra_graphics.xml +++ b/indra/newview/app_settings/ultra_graphics.xml @@ -4,6 +4,8 @@ + + diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index bfe3e52657..15e91b57fa 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -443,6 +443,7 @@ static void settings_to_globals() LLVolumeImplFlexible::sUpdateFactor = gSavedSettings.getF32("RenderFlexTimeFactor"); LLVOTree::sTreeFactor = gSavedSettings.getF32("RenderTreeLODFactor"); LLVOAvatar::sLODFactor = gSavedSettings.getF32("RenderAvatarLODFactor"); + LLVOAvatar::sPhysicsLODFactor = gSavedSettings.getF32("RenderAvatarPhysicsLODFactor"); LLVOAvatar::sMaxVisible = (U32)gSavedSettings.getS32("RenderAvatarMaxVisible"); LLVOAvatar::sVisibleInFirstPerson = gSavedSettings.getBOOL("FirstPersonAvatarVisible"); // clamp auto-open time to some minimum usable value diff --git a/indra/newview/llbreastmotion.cpp b/indra/newview/llbreastmotion.cpp index 036aa2ff39..2c8a38710a 100644 --- a/indra/newview/llbreastmotion.cpp +++ b/indra/newview/llbreastmotion.cpp @@ -76,6 +76,7 @@ LLBreastMotion::LLBreastMotion(const LLUUID &id) : mCharLastVelocity_local_vec = LLVector3(0,0,0); mCharLastAcceleration_local_vec = LLVector3(0,0,0); mBreastLastPosition_local_pt = LLVector3(0,0,0); + mBreastLastUpdatePosition_local_pt = LLVector3(0,0,0); mBreastVelocity_local_vec = LLVector3(0,0,0); } @@ -236,6 +237,12 @@ BOOL LLBreastMotion::onUpdate(F32 time, U8* joint_mask) return TRUE; } + const F32 lod_factor = LLVOAvatar::sPhysicsLODFactor; + if (lod_factor == 0) + { + return TRUE; + } + /* TEST: 1. Change outfits 2. FPS effect @@ -354,8 +361,20 @@ BOOL LLBreastMotion::onUpdate(F32 time, U8* joint_mask) mBreastMassParam ); } - + + LLVector3 position_diff = mBreastLastUpdatePosition_local_pt-new_local_pt; + for (U32 i=0; i < 3; i++) + { + const F32 min_delta = (1.0-lod_factor)*(mBreastParamsMax[i]-mBreastParamsMin[i])/2.0; + if (llabs(position_diff[i]) > min_delta) + { + mCharacter->updateVisualParams(); + mBreastLastUpdatePosition_local_pt = new_local_pt; + break; + } + } + mBreastLastPosition_local_pt = new_local_pt; - mCharacter->updateVisualParams(); + return TRUE; } diff --git a/indra/newview/llbreastmotion.h b/indra/newview/llbreastmotion.h index 7dbe604a76..6a2e3788ad 100644 --- a/indra/newview/llbreastmotion.h +++ b/indra/newview/llbreastmotion.h @@ -138,6 +138,7 @@ private: LLVector3 mBreastLastPosition_local_pt; // Last parameters for breast LLVector3 mBreastVelocity_local_vec; // How fast the breast params are moving + LLVector3 mBreastLastUpdatePosition_local_pt; // Last parameters when visual update was sent F32 mBreastMassParam; diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 3804a1b858..dbc50ddbea 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1064,6 +1064,7 @@ void LLFloaterPreference::refresh() updateSliderText(getChild("FlexibleMeshDetail", true), getChild("FlexibleMeshDetailText", true)); updateSliderText(getChild("TreeMeshDetail", true), getChild("TreeMeshDetailText", true)); updateSliderText(getChild("AvatarMeshDetail", true), getChild("AvatarMeshDetailText", true)); + updateSliderText(getChild("AvatarPhysicsDetail", true), getChild("AvatarPhysicsDetailText", true)); updateSliderText(getChild("TerrainMeshDetail", true), getChild("TerrainMeshDetailText", true)); updateSliderText(getChild("RenderPostProcess", true), getChild("PostProcessText", true)); updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true)); diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 522b5a7dfa..df5a376631 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -144,6 +144,12 @@ static bool handleAvatarLODChanged(const LLSD& newvalue) return true; } +static bool handleAvatarPhysicsLODChanged(const LLSD& newvalue) +{ + LLVOAvatar::sPhysicsLODFactor = (F32) newvalue.asReal(); + return true; +} + static bool handleAvatarMaxVisibleChanged(const LLSD& newvalue) { LLVOAvatar::sMaxVisible = (U32) newvalue.asInteger(); @@ -509,6 +515,7 @@ void settings_setup_listeners() gSavedSettings.getControl("RenderAvatarMaxVisible")->getSignal()->connect(boost::bind(&handleAvatarMaxVisibleChanged, _2)); gSavedSettings.getControl("RenderVolumeLODFactor")->getSignal()->connect(boost::bind(&handleVolumeLODChanged, _2)); gSavedSettings.getControl("RenderAvatarLODFactor")->getSignal()->connect(boost::bind(&handleAvatarLODChanged, _2)); + gSavedSettings.getControl("RenderAvatarPhysicsLODFactor")->getSignal()->connect(boost::bind(&handleAvatarPhysicsLODChanged, _2)); gSavedSettings.getControl("RenderTerrainLODFactor")->getSignal()->connect(boost::bind(&handleTerrainLODChanged, _2)); gSavedSettings.getControl("RenderTreeLODFactor")->getSignal()->connect(boost::bind(&handleTreeLODChanged, _2)); gSavedSettings.getControl("RenderFlexTimeFactor")->getSignal()->connect(boost::bind(&handleFlexLODChanged, _2)); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index b98c64310d..be55c5b5c2 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -619,6 +619,7 @@ BOOL LLVOAvatar::sShowAnimationDebug = FALSE; BOOL LLVOAvatar::sShowFootPlane = FALSE; BOOL LLVOAvatar::sVisibleInFirstPerson = FALSE; F32 LLVOAvatar::sLODFactor = 1.f; +F32 LLVOAvatar::sPhysicsLODFactor = 1.f; BOOL LLVOAvatar::sUseImpostors = FALSE; BOOL LLVOAvatar::sJointDebug = FALSE; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index c522af7d55..4417e37abb 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -230,6 +230,7 @@ public: static BOOL sDebugInvisible; static BOOL sShowAttachmentPoints; static F32 sLODFactor; // user-settable LOD factor + static F32 sPhysicsLODFactor; // user-settable physics LOD factor static BOOL sJointDebug; // output total number of joints being touched for each avatar static BOOL sDebugAvatarRotation; diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml index 113d5fb6dc..23024cd0eb 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -2,7 +2,7 @@ + + + + Low + + @@ -662,7 +692,7 @@ left="358" left_pad="-30" name="TerrainDetailText" - top="226" + top="250" width="155"> Terrain detail: @@ -700,7 +730,7 @@ layout="topleft" left="10" name="Apply" - top="383" + top="390" width="115" > -- cgit v1.2.3