AMFP Enhanced
C++ reference: the code this unofficial fork added
Loading...
Searching...
No Matches
LuxComfortBody.h
Go to the documentation of this file.
1/*
2 * AMFP-2026: comfort pass, body / view model helpers (PLAN.md "Comfort pass", rows 8b, 8c).
3 * Pure, unit tested in tests/cpp/test_comfort_body.cpp. Shared values live in LuxComfort.h.
4 */
5#ifndef LUX_COMFORT_BODY_H
6#define LUX_COMFORT_BODY_H
7
8/** Lantern pendulum as shown. The physics keep running at vanilla values (so nothing new can
9 * oscillate or jitter); only the swing away from its rest angle (straight down, from the camera
10 * pitch and roll) is scaled on output, which damps the shown amplitude and swing speed alike.
11 * afMul 1 (or more) returns the vanilla angle untouched; 0 hangs the lantern at rest. */
12inline float LuxComfortSwayAngle(float afAngle, float afRest, float afMul, float afMin, float afMax)
13{
14 if(afMul >= 1.0f) return afAngle;
15 if(!(afMul > 0.0f)) afMul = 0.0f; // also NaN
16 float fShown = afRest + (afAngle - afRest) * afMul;
17 if(fShown < afMin) fShown = afMin;
18 if(fShown > afMax) fShown = afMax;
19 return fShown;
20}
21
22#endif
float LuxComfortSwayAngle(float afAngle, float afRest, float afMul, float afMin, float afMax)
Lantern pendulum as shown.