code review feedback

removed discontinuity in safeDeltaTime, which is used to prevent division by zero.
This commit is contained in:
Anthony J. Thibault 2017-11-10 10:25:29 -08:00
parent 4169e11e77
commit ba4c0f189e
2 changed files with 4 additions and 2 deletions

View file

@ -54,7 +54,8 @@ void LODManager::autoAdjustLOD(float batchTime, float engineRunTime, float delta
float renderTime = batchTime + OVERLAY_AND_SWAP_TIME_BUDGET;
float maxTime = glm::max(renderTime, engineRunTime);
const float BLEND_TIMESCALE = 0.3f; // sec
const float safeDeltaTime = (deltaTimeSec == 0.0f) ? 0.001f : deltaTimeSec;
const float MIN_DELTA_TIME = 0.001f;
const float safeDeltaTime = glm::max(deltaTimeSec, MIN_DELTA_TIME);
float blend = BLEND_TIMESCALE / safeDeltaTime;
if (blend > 1.0f) {
blend = 1.0f;

View file

@ -453,7 +453,8 @@ void Avatar::applyPositionDelta(const glm::vec3& delta) {
void Avatar::measureMotionDerivatives(float deltaTime) {
PerformanceTimer perfTimer("derivatives");
// linear
const float safeDeltaTime = (deltaTime == 0.0f) ? 0.001f : deltaTime;
const float MIN_DELTA_TIME = 0.001f;
const float safeDeltaTime = glm::max(deltaTime, MIN_DELTA_TIME);
float invDeltaTime = 1.0f / safeDeltaTime;
// Floating point error prevents us from computing velocity in a naive way
// (e.g. vel = (pos - oldPos) / dt) so instead we use _positionOffsetAccumulator.