MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / zCameraConversUpdate

Function zCameraConversUpdate

src/SB/Game/zCamera.cpp:206–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204}
205
206static void zCameraConversUpdate(xCamera* cam, F32 dt)
207{
208 if (zcam_dest == NULL)
209 {
210 return;
211 }
212
213 if (zcam_tmr <= 0.0f)
214 {
215 zcam_tmr = 0.0f;
216 return;
217 }
218
219 if ((dt / zcam_tmr) > 1.0f)
220 {
221 cam->mat.right = zcam_dest->right;
222 cam->mat.up = zcam_dest->up;
223 cam->mat.at = zcam_dest->at;
224 cam->mat.pos = zcam_dest->pos;
225
226 zcam_fovcurr = zcam_fovdest;
227 }
228 else
229 {
230 F32 ease1 = EaseInOut(1.0f - (zcam_tmr / zcam_ttm));
231 F32 ease2 = EaseInOut(1.0f - (zcam_tmr - dt) / zcam_ttm);
232 F32 t = (ease2 - ease1) / (1.0f - ease1);
233
234 xQuat tOld;
235 xQuat tNew;
236 xQuatFromMat(&tOld, &cam->mat);
237 xQuatSlerp(&tNew, &tOld, &zcam_quat, t);
238 xQuatToMat(&tNew, &cam->mat);
239 xVec3Lerp(&cam->mat.pos, &cam->mat.pos, &zcam_dest->pos, t);
240 zcam_fovcurr = zcam_fovcurr * (1.0f - t) + (zcam_fovdest * t);
241 }
242
243 zcam_tmr = zcam_tmr - dt;
244}
245
246static F32 TranSpeed(zFlyKey keys[])
247{

Callers

nothing calls this directly

Calls 5

EaseInOutFunction · 0.85
xVec3LerpFunction · 0.85
xQuatFromMatFunction · 0.50
xQuatSlerpFunction · 0.50
xQuatToMatFunction · 0.50

Tested by

no test coverage detected