MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / InitCameraPars

Method InitCameraPars

engine/Poseidon/World/WorldInit.cpp:368–395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

366}
367
368void World::InitCameraPars()
369{
370 Camera camera;
371 if (_cameraOn != nullptr)
372 {
373 for (int i = 0; i < MaxCameraType; i++)
374 {
375 _cameraOn->InitVirtual((CameraType)i, _camHeading[i], _camDive[i], _camFOV[i]);
376 _camHeadingWanted[i] = _camHeading[i];
377 _camDiveWanted[i] = _camDive[i];
378 _camFOVWanted[i] = _camFOV[i];
379 }
380 Matrix4 transform;
381
382 transform = _cameraOn->Transform() * _cameraOn->InsideCamera(_camType);
383 transform.SetOrientation(transform.Orientation());
384
385 camera.SetTransform(transform);
386 camera.SetSpeed(_cameraOn->ObjectSpeed());
387 float fov = _camFOV[_camType];
388 float cNear = 0.067f / fov; // near plane scales inversely with fov; typical soldier fov ~0.85
389 saturate(cNear, 0.07f, 0.2f);
390
391 camera.SetPerspectiveForView(GEngine, cNear, _scene.GetFogMaxRange(), fov);
392 camera.Adjust(GEngine);
393 _scene.SetCamera(camera);
394 }
395}
396
397void World::FreelookChange(bool active)
398{

Callers

nothing calls this directly

Calls 12

saturateFunction · 0.85
ObjectSpeedMethod · 0.80
SetPerspectiveForViewMethod · 0.80
GetFogMaxRangeMethod · 0.80
AdjustMethod · 0.80
SetCameraMethod · 0.80
InitVirtualMethod · 0.45
TransformMethod · 0.45
InsideCameraMethod · 0.45
SetOrientationMethod · 0.45
SetTransformMethod · 0.45
SetSpeedMethod · 0.45

Tested by

no test coverage detected