MCPcopy Create free account
hub / github.com/BabylonJS/BabylonNative / CreateProjectionMatrix

Function CreateProjectionMatrix

Plugins/NativeXr/Source/NativeXr.cpp:47–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45 // clang-format on
46
47 std::array<float, 16> CreateProjectionMatrix(const xr::System::Session::Frame::View& view)
48 {
49 const float n{view.DepthNearZ};
50 const float f{view.DepthFarZ};
51
52 const float r{std::tanf(view.FieldOfView.AngleRight) * n};
53 const float l{std::tanf(view.FieldOfView.AngleLeft) * n};
54 const float t{std::tanf(view.FieldOfView.AngleUp) * n};
55 const float b{std::tanf(view.FieldOfView.AngleDown) * n};
56
57 std::array<float, 16> bxResult{};
58 bx::mtxProj(bxResult.data(), t, b, l, r, n, f, false, bx::Handness::Right);
59
60 return bxResult;
61 }
62
63 std::array<float, 16> CreateTransformMatrix(const xr::System::Session::Frame::Space& space, bool viewSpace = true)
64 {

Callers 1

UpdateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected