MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / UpdateCache

Method UpdateCache

Source/Engine/Level/Actors/Camera.cpp:406–443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

404#endif
405
406void Camera::UpdateCache()
407{
408 // Calculate view and projection matrices
409 Matrix view, projection;
410 GetMatrices(view, projection);
411
412 // Update frustum and bounding box
413 _frustum.SetMatrix(view, projection);
414 _frustum.GetBox(_box);
415 BoundingSphere::FromBox(_box, _sphere);
416
417#if USE_EDITOR
418
419 // Update editor preview model cache
420 Matrix rot, tmp, world;
421 GetLocalToWorldMatrix(tmp);
422 Matrix::RotationY(PI * -0.5f, rot);
423 Matrix::Multiply(rot, tmp, world);
424
425 // Calculate snap box for preview model
426 if (_previewModel && _previewModel->IsLoaded())
427 {
428 _previewModelBox = _previewModel->GetBox(world);
429 }
430 else
431 {
432 Vector3 min(-10.0f), max(10.0f);
433 min = Vector3::Transform(min, world);
434 max = Vector3::Transform(max, world);
435 _previewModelBox = BoundingBox(min, max);
436 }
437
438 // Extend culling bounding box
439 BoundingBox::Merge(_box, _previewModelBox, _box);
440 BoundingSphere::FromBox(_box, _sphere);
441
442#endif
443}
444
445void Camera::Serialize(SerializeStream& stream, const void* otherObj)
446{

Callers

nothing calls this directly

Calls 8

RotationYFunction · 0.85
MultiplyFunction · 0.50
TransformClass · 0.50
BoundingBoxClass · 0.50
MergeFunction · 0.50
SetMatrixMethod · 0.45
GetBoxMethod · 0.45
IsLoadedMethod · 0.45

Tested by

no test coverage detected