Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
8b064070
Commit
8b064070
authored
14 years ago
by
Loren Shih
Browse files
Options
Downloads
Patches
Plain Diff
SH-1381 FIXED avatar physics behavior is tightly tied to viewer framerate
Breaking up physics into smaller integration steps.
parent
91409d40
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/newview/llphysicsmotion.cpp
+184
-170
184 additions, 170 deletions
indra/newview/llphysicsmotion.cpp
with
184 additions
and
170 deletions
indra/newview/llphysicsmotion.cpp
+
184
−
170
View file @
8b064070
...
@@ -43,7 +43,8 @@
...
@@ -43,7 +43,8 @@
typedef
std
::
map
<
std
::
string
,
std
::
string
>
controller_map_t
;
typedef
std
::
map
<
std
::
string
,
std
::
string
>
controller_map_t
;
typedef
std
::
map
<
std
::
string
,
F32
>
default_controller_map_t
;
typedef
std
::
map
<
std
::
string
,
F32
>
default_controller_map_t
;
#define MIN_REQUIRED_PIXEL_AREA_AVATAR_PHYSICS_MOTION 0.f;
#define MIN_REQUIRED_PIXEL_AREA_AVATAR_PHYSICS_MOTION 0.f
#define TIME_ITERATION_STEP 0.1f
inline
F64
llsgn
(
const
F64
a
)
inline
F64
llsgn
(
const
F64
a
)
{
{
...
@@ -453,7 +454,8 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
...
@@ -453,7 +454,8 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
return
FALSE
;
return
FALSE
;
}
}
if
(
time_delta
>
3.0
)
// If less than 1FPS, we don't want to be spending time updating physics at all.
if
(
time_delta
>
1.0
)
{
{
mLastTime
=
time
;
mLastTime
=
time
;
return
FALSE
;
return
FALSE
;
...
@@ -481,6 +483,18 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
...
@@ -481,6 +483,18 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
if
(
physics_test
)
if
(
physics_test
)
behavior_maxeffect
=
1.0
f
;
behavior_maxeffect
=
1.0
f
;
BOOL
update_visuals
=
FALSE
;
// Break up the physics into a bunch of iterations so that differing framerates will show
// roughly the same behavior.
for
(
F32
time_iteration
=
0
;
time_iteration
<=
time_delta
;
time_iteration
+=
TIME_ITERATION_STEP
)
{
F32
time_iteration_step
=
TIME_ITERATION_STEP
;
if
(
time_iteration
+
TIME_ITERATION_STEP
>
time_delta
)
{
time_iteration_step
=
time_delta
;
}
// mPositon_local should be in normalized 0,1 range already. Just making sure...
// mPositon_local should be in normalized 0,1 range already. Just making sure...
F32
position_current_local
=
llclamp
(
mPosition_local
,
F32
position_current_local
=
llclamp
(
mPosition_local
,
0.0
f
,
0.0
f
,
...
@@ -509,8 +523,8 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
...
@@ -509,8 +523,8 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
// Calculate velocity and acceleration in parameter space.
// Calculate velocity and acceleration in parameter space.
//
//
const
F32
velocity_joint_local
=
calculateVelocity_local
(
time_
delta
);
const
F32
velocity_joint_local
=
calculateVelocity_local
(
time_
iteration_step
);
const
F32
acceleration_joint_local
=
calculateAcceleration_local
(
velocity_joint_local
,
time_
delta
);
const
F32
acceleration_joint_local
=
calculateAcceleration_local
(
velocity_joint_local
,
time_
iteration_step
);
//
//
// End velocity and acceleration
// End velocity and acceleration
...
@@ -572,7 +586,7 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
...
@@ -572,7 +586,7 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
velocity_new_local
=
sin
(
time
*
4.0
);
velocity_new_local
=
sin
(
time
*
4.0
);
}
}
// Calculate the new parameters, or remain unchanged if max speed is 0.
// Calculate the new parameters, or remain unchanged if max speed is 0.
F32
position_new_local
=
position_current_local
+
velocity_new_local
*
time_
delta
;
F32
position_new_local
=
position_current_local
+
velocity_new_local
*
time_
iteration_step
;
if
(
behavior_maxeffect
==
0
)
if
(
behavior_maxeffect
==
0
)
position_new_local
=
position_user_local
;
position_new_local
=
position_user_local
;
...
@@ -638,8 +652,6 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
...
@@ -638,8 +652,6 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
// So only update if the params have changed enough, and also take into account
// So only update if the params have changed enough, and also take into account
// the graphics LOD settings.
// the graphics LOD settings.
BOOL
update_visuals
=
FALSE
;
// For non-self, if the avatar is small enough visually, then don't update.
// For non-self, if the avatar is small enough visually, then don't update.
const
F32
area_for_max_settings
=
0.0
;
const
F32
area_for_max_settings
=
0.0
;
const
F32
area_for_min_settings
=
1400.0
;
const
F32
area_for_min_settings
=
1400.0
;
...
@@ -669,6 +681,8 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
...
@@ -669,6 +681,8 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
mPosition_local
=
position_new_local
;
mPosition_local
=
position_new_local
;
mPosition_world
=
joint
->
getWorldPosition
();
mPosition_world
=
joint
->
getWorldPosition
();
}
mLastTime
=
time
;
mLastTime
=
time
;
/*
/*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment