11QSSGClippingFrustum::QSSGClippingFrustum(
const QMatrix4x4 &modelviewprojection,
const QSSGClipPlane &nearPlane)
13 const float *modelviewProjection = modelviewprojection.data();
18#define M(_x, _y) modelviewProjection[(4
* (_y)) + (_x)]
20 mPlanes[0].normal = {
M(3, 0) +
M(0, 0),
M(3, 1) +
M(0, 1),
M(3, 2) +
M(0, 2) };
21 mPlanes[0].d = (
M(3, 3) +
M(0, 3)) / QSSGUtils::vec3::normalize(mPlanes[0].normal);
24 mPlanes[1].normal = {
M(3, 0) -
M(0, 0),
M(3, 1) -
M(0, 1),
M(3, 2) -
M(0, 2) };
25 mPlanes[1].d = (
M(3, 3) -
M(0, 3)) / QSSGUtils::vec3::normalize(mPlanes[1].normal);
28 mPlanes[2].normal = { (
M(3, 0) -
M(2, 0)),
M(3, 1) -
M(2, 1),
M(3, 2) -
M(2, 2) };
29 mPlanes[2].d = (
M(3, 3) -
M(2, 3)) / QSSGUtils::vec3::normalize(mPlanes[2].normal);
32 mPlanes[3].normal = {
M(3, 0) +
M(1, 0),
M(3, 1) +
M(1, 1),
M(3, 2) +
M(1, 2) };
33 mPlanes[3].d = (
M(3, 3) +
M(1, 3)) / QSSGUtils::vec3::normalize(mPlanes[3].normal);
36 mPlanes[4].normal = {
M(3, 0) -
M(1, 0),
M(3, 1) -
M(1, 1),
M(3, 2) -
M(1, 2) };
37 mPlanes[4].d = (
M(3, 3) -
M(1, 3)) / QSSGUtils::vec3::normalize(mPlanes[4].normal);
39 mPlanes[5] = nearPlane;
42 for (quint32 idx = 0; idx < 6; ++idx)
43 mPlanes[idx].calculateBBoxEdges();