MCPcopy Create free account
hub / github.com/axmolengine/axmol / createPlane

Method createPlane

core/3d/Frustum.cpp:84–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84void Frustum::createPlane(const Camera* camera)
85{
86 const Mat4& mat = camera->getViewProjectionMatrix();
87 // ref http://www.lighthouse3d.com/tutorials/view-frustum-culling/clip-space-approach-extracting-the-planes/
88 // extract frustum plane
89 _plane[0].initPlane(-Vec3(mat.m[3] + mat.m[0], mat.m[7] + mat.m[4], mat.m[11] + mat.m[8]),
90 (mat.m[15] + mat.m[12])); // left
91 _plane[1].initPlane(-Vec3(mat.m[3] - mat.m[0], mat.m[7] - mat.m[4], mat.m[11] - mat.m[8]),
92 (mat.m[15] - mat.m[12])); // right
93 _plane[2].initPlane(-Vec3(mat.m[3] + mat.m[1], mat.m[7] + mat.m[5], mat.m[11] + mat.m[9]),
94 (mat.m[15] + mat.m[13])); // bottom
95 _plane[3].initPlane(-Vec3(mat.m[3] - mat.m[1], mat.m[7] - mat.m[5], mat.m[11] - mat.m[9]),
96 (mat.m[15] - mat.m[13])); // top
97 _plane[4].initPlane(-Vec3(mat.m[3] + mat.m[2], mat.m[7] + mat.m[6], mat.m[11] + mat.m[10]),
98 (mat.m[15] + mat.m[14])); // near
99 _plane[5].initPlane(-Vec3(mat.m[3] - mat.m[2], mat.m[7] - mat.m[6], mat.m[11] - mat.m[10]),
100 (mat.m[15] - mat.m[14])); // far
101}
102
103}

Callers

nothing calls this directly

Calls 2

initPlaneMethod · 0.80
Vec3Function · 0.50

Tested by

no test coverage detected