Skip to content
Snippets Groups Projects
Commit 6cd39982 authored by Patric Schmitz's avatar Patric Schmitz
Browse files

allow zero camera smoothing, more assertions

API change: rename to *SmoothingHalfTimeMillis
parent decfd2e3
No related branches found
No related tags found
1 merge request!138allow zero camera smoothing, more assertions
......@@ -337,9 +337,17 @@ void CameraController::update(float elapsedSeconds)
mRight = normalize(cross(mFwd, mUp));
mUp = normalize(cross(mRight, mFwd));
TG_ASSERT(s.TranslationalSmoothingHalfTimeMillis >= 0);
TG_ASSERT(s.RotationalSmoothingHalfTimeMillis >= 0);
// smoothing
auto alphaTranslational = tg::pow(0.5f, 1000 * elapsedSeconds / s.TranslationalSmoothingHalfTime);
auto alphaRotational = tg::pow(0.5f, 1000 * elapsedSeconds / s.RotationalSmoothingHalfTime);
auto alphaTranslational = 0.f;
auto alphaRotational = 0.f;
if (s.TranslationalSmoothingHalfTimeMillis > 0)
alphaTranslational = tg::pow(0.5f, 1000 * elapsedSeconds / s.TranslationalSmoothingHalfTimeMillis);
if (s.RotationalSmoothingHalfTimeMillis > 0)
alphaRotational = tg::pow(0.5f, 1000 * elapsedSeconds / s.RotationalSmoothingHalfTimeMillis);
mSmoothedTargetDistance = tg::mix(mTargetDistance, mSmoothedTargetDistance, alphaTranslational);
mSmoothedTargetPos = mix(mTargetPos, mSmoothedTargetPos, alphaTranslational);
mSmoothedPos = mix(mPos, mSmoothedPos, alphaTranslational);
......
......@@ -16,8 +16,8 @@ struct CameraSettings
tg::angle NumpadRotateDegree = 30_deg;
// smoothing halftimes in ms
float TranslationalSmoothingHalfTime = 40;
float RotationalSmoothingHalfTime = 30;
float TranslationalSmoothingHalfTimeMillis = 40;
float RotationalSmoothingHalfTimeMillis = 30;
float FocusRefDistance = 30 * 1000;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment