|
|
@@ -2453,16 +2453,16 @@ public:
|
|
|
|
|
|
float mtxProj[16];
|
|
|
bx::mtxOrtho(
|
|
|
- mtxProj
|
|
|
- , 1.0f
|
|
|
- , -1.0f
|
|
|
- , 1.0f
|
|
|
- , -1.0f
|
|
|
- , -currentSmSettings->m_far
|
|
|
- , currentSmSettings->m_far
|
|
|
- , 0.0f
|
|
|
- , caps->homogeneousDepth
|
|
|
- );
|
|
|
+ mtxProj
|
|
|
+ , 1.0f
|
|
|
+ , -1.0f
|
|
|
+ , 1.0f
|
|
|
+ , -1.0f
|
|
|
+ , -currentSmSettings->m_far
|
|
|
+ , currentSmSettings->m_far
|
|
|
+ , 0.0f
|
|
|
+ , caps->homogeneousDepth
|
|
|
+ );
|
|
|
|
|
|
const uint8_t numCorners = 8;
|
|
|
float frustumCorners[maxNumSplits][numCorners][3];
|
|
|
@@ -2471,34 +2471,24 @@ public:
|
|
|
// Compute frustum corners for one split in world space.
|
|
|
worldSpaceFrustumCorners( (float*)frustumCorners[ii], splitSlices[nn], splitSlices[ff], projWidth, projHeight, mtxViewInv);
|
|
|
|
|
|
- float min[3] = { 9000.0f, 9000.0f, 9000.0f };
|
|
|
- float max[3] = { -9000.0f, -9000.0f, -9000.0f };
|
|
|
+ bx::Vec3 min = { 9000.0f, 9000.0f, 9000.0f };
|
|
|
+ bx::Vec3 max = { -9000.0f, -9000.0f, -9000.0f };
|
|
|
|
|
|
for (uint8_t jj = 0; jj < numCorners; ++jj)
|
|
|
{
|
|
|
// Transform to light space.
|
|
|
- float lightSpaceFrustumCorner[3];
|
|
|
- bx::vec3MulMtx(lightSpaceFrustumCorner, frustumCorners[ii][jj], lightView[0]);
|
|
|
+ const bx::Vec3 xyz = bx::mul(bx::load<bx::Vec3>(frustumCorners[ii][jj]), lightView[0]);
|
|
|
|
|
|
// Update bounding box.
|
|
|
- min[0] = bx::min(min[0], lightSpaceFrustumCorner[0]);
|
|
|
- max[0] = bx::max(max[0], lightSpaceFrustumCorner[0]);
|
|
|
- min[1] = bx::min(min[1], lightSpaceFrustumCorner[1]);
|
|
|
- max[1] = bx::max(max[1], lightSpaceFrustumCorner[1]);
|
|
|
- min[2] = bx::min(min[2], lightSpaceFrustumCorner[2]);
|
|
|
- max[2] = bx::max(max[2], lightSpaceFrustumCorner[2]);
|
|
|
+ min = bx::min(min, xyz);
|
|
|
+ max = bx::max(max, xyz);
|
|
|
}
|
|
|
|
|
|
- float minproj[3];
|
|
|
- float maxproj[3];
|
|
|
- bx::vec3MulMtxH(minproj, min, mtxProj);
|
|
|
- bx::vec3MulMtxH(maxproj, max, mtxProj);
|
|
|
-
|
|
|
- float offsetx, offsety;
|
|
|
- float scalex, scaley;
|
|
|
+ const bx::Vec3 minproj = bx::mulH(min, mtxProj);
|
|
|
+ const bx::Vec3 maxproj = bx::mulH(max, mtxProj);
|
|
|
|
|
|
- scalex = 2.0f / (maxproj[0] - minproj[0]);
|
|
|
- scaley = 2.0f / (maxproj[1] - minproj[1]);
|
|
|
+ float scalex = 2.0f / (maxproj.x - minproj.x);
|
|
|
+ float scaley = 2.0f / (maxproj.y - minproj.y);
|
|
|
|
|
|
if (m_settings.m_stabilize)
|
|
|
{
|
|
|
@@ -2507,8 +2497,8 @@ public:
|
|
|
scaley = quantizer / bx::ceil(quantizer / scaley);
|
|
|
}
|
|
|
|
|
|
- offsetx = 0.5f * (maxproj[0] + minproj[0]) * scalex;
|
|
|
- offsety = 0.5f * (maxproj[1] + minproj[1]) * scaley;
|
|
|
+ float offsetx = 0.5f * (maxproj.x + minproj.x) * scalex;
|
|
|
+ float offsety = 0.5f * (maxproj.y + minproj.y) * scaley;
|
|
|
|
|
|
if (m_settings.m_stabilize)
|
|
|
{
|