MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / cam_Update

Method cam_Update

ogsr_engine/xrGame/WeaponStatMgun.cpp:205–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203}
204
205void CWeaponStatMgun::cam_Update(float dt, float fov)
206{
207 Fvector P, Da;
208 Da.set(0, 0, 0);
209
210 IKinematics* K = smart_cast<IKinematics*>(Visual());
211 K->CalculateBones_Invalidate();
212 K->CalculateBones();
213 const Fmatrix& C = K->LL_GetTransform(m_camera_bone);
214 XFORM().transform_tiny(P, C.c);
215
216 Fvector d = C.k;
217 XFORM().transform_dir(d);
218 Fvector2 des_cam_dir;
219
220 d.getHP(des_cam_dir.x, des_cam_dir.y);
221 des_cam_dir.mul(-1.0f);
222
223 Camera()->yaw = angle_inertion_var(Camera()->yaw, des_cam_dir.x, 0.5f, 7.5f, PI_DIV_6, Device.fTimeDelta);
224 Camera()->pitch = angle_inertion_var(Camera()->pitch, des_cam_dir.y, 0.5f, 7.5f, PI_DIV_6, Device.fTimeDelta);
225
226 if (OwnerActor())
227 {
228 // rotate head
229 OwnerActor()->Orientation().yaw = -Camera()->yaw;
230 OwnerActor()->Orientation().pitch = -Camera()->pitch;
231 }
232
233 Camera()->Update(P, Da);
234 Level().Cameras().UpdateFromCamera(Camera());
235}
236
237void CWeaponStatMgun::renderable_Render(u32 context_id, IRenderable* root)
238{

Callers

nothing calls this directly

Calls 15

VisualFunction · 0.85
XFORMFunction · 0.85
CameraFunction · 0.85
angle_inertion_varFunction · 0.85
OwnerActorFunction · 0.85
transform_tinyMethod · 0.80
getHPMethod · 0.80
UpdateFromCameraMethod · 0.80
setMethod · 0.45
CalculateBonesMethod · 0.45
transform_dirMethod · 0.45

Tested by

no test coverage detected