|
@@ -12,9 +12,9 @@
|
|
|
#include <bgfx.h>
|
|
#include <bgfx.h>
|
|
|
#include <bx/timer.h>
|
|
#include <bx/timer.h>
|
|
|
#include <bx/readerwriter.h>
|
|
#include <bx/readerwriter.h>
|
|
|
|
|
+#include <bx/fpumath.h>
|
|
|
#include "entry/entry.h"
|
|
#include "entry/entry.h"
|
|
|
#include "camera.h"
|
|
#include "camera.h"
|
|
|
-#include "fpumath.h"
|
|
|
|
|
#include "imgui/imgui.h"
|
|
#include "imgui/imgui.h"
|
|
|
|
|
|
|
|
#define RENDERVIEW_SHADOWMAP_0_ID 1
|
|
#define RENDERVIEW_SHADOWMAP_0_ID 1
|
|
@@ -479,7 +479,7 @@ struct Light
|
|
|
|
|
|
|
|
void computeViewSpaceComponents(float* _viewMtx)
|
|
void computeViewSpaceComponents(float* _viewMtx)
|
|
|
{
|
|
{
|
|
|
- vec4MulMtx(m_position_viewSpace, m_position.m_v, _viewMtx);
|
|
|
|
|
|
|
+ bx::vec4MulMtx(m_position_viewSpace, m_position.m_v, _viewMtx);
|
|
|
|
|
|
|
|
float tmp[] =
|
|
float tmp[] =
|
|
|
{
|
|
{
|
|
@@ -488,7 +488,7 @@ struct Light
|
|
|
, m_spotDirectionInner.m_z
|
|
, m_spotDirectionInner.m_z
|
|
|
, 0.0f
|
|
, 0.0f
|
|
|
};
|
|
};
|
|
|
- vec4MulMtx(m_spotDirectionInner_viewSpace, tmp, _viewMtx);
|
|
|
|
|
|
|
+ bx::vec4MulMtx(m_spotDirectionInner_viewSpace, tmp, _viewMtx);
|
|
|
m_spotDirectionInner_viewSpace[3] = m_spotDirectionInner.m_v[3];
|
|
m_spotDirectionInner_viewSpace[3] = m_spotDirectionInner.m_v[3];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1235,7 +1235,7 @@ void worldSpaceFrustumCorners(float* _corners24f
|
|
|
float (*out)[3] = (float(*)[3])_corners24f;
|
|
float (*out)[3] = (float(*)[3])_corners24f;
|
|
|
for (uint8_t ii = 0; ii < numCorners; ++ii)
|
|
for (uint8_t ii = 0; ii < numCorners; ++ii)
|
|
|
{
|
|
{
|
|
|
- vec3MulMtx( (float*)&out[ii], (float*)&corners[ii], _invViewMtx);
|
|
|
|
|
|
|
+ bx::vec3MulMtx( (float*)&out[ii], (float*)&corners[ii], _invViewMtx);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2074,7 +2074,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
const float camFar = 2000.0f;
|
|
const float camFar = 2000.0f;
|
|
|
const float projHeight = 1.0f/tanf(camFovy*( (float)M_PI/180.0f)*0.5f);
|
|
const float projHeight = 1.0f/tanf(camFovy*( (float)M_PI/180.0f)*0.5f);
|
|
|
const float projWidth = projHeight * 1.0f/camAspect;
|
|
const float projWidth = projHeight * 1.0f/camAspect;
|
|
|
- mtxProj(viewState.m_proj, camFovy, camAspect, camNear, camFar);
|
|
|
|
|
|
|
+ bx::mtxProj(viewState.m_proj, camFovy, camAspect, camNear, camFar);
|
|
|
cameraGetViewMtx(viewState.m_view);
|
|
cameraGetViewMtx(viewState.m_view);
|
|
|
|
|
|
|
|
float timeAccumulatorLight = 0.0f;
|
|
float timeAccumulatorLight = 0.0f;
|
|
@@ -2293,7 +2293,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
// Setup instance matrices.
|
|
// Setup instance matrices.
|
|
|
float mtxFloor[16];
|
|
float mtxFloor[16];
|
|
|
const float floorScale = 550.0f;
|
|
const float floorScale = 550.0f;
|
|
|
- mtxSRT(mtxFloor
|
|
|
|
|
|
|
+ bx::mtxSRT(mtxFloor
|
|
|
, floorScale //scaleX
|
|
, floorScale //scaleX
|
|
|
, floorScale //scaleY
|
|
, floorScale //scaleY
|
|
|
, floorScale //scaleZ
|
|
, floorScale //scaleZ
|
|
@@ -2306,7 +2306,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
float mtxBunny[16];
|
|
float mtxBunny[16];
|
|
|
- mtxSRT(mtxBunny
|
|
|
|
|
|
|
+ bx::mtxSRT(mtxBunny
|
|
|
, 5.0f
|
|
, 5.0f
|
|
|
, 5.0f
|
|
, 5.0f
|
|
|
, 5.0f
|
|
, 5.0f
|
|
@@ -2319,7 +2319,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
float mtxHollowcube[16];
|
|
float mtxHollowcube[16];
|
|
|
- mtxSRT(mtxHollowcube
|
|
|
|
|
|
|
+ bx::mtxSRT(mtxHollowcube
|
|
|
, 2.5f
|
|
, 2.5f
|
|
|
, 2.5f
|
|
, 2.5f
|
|
|
, 2.5f
|
|
, 2.5f
|
|
@@ -2332,7 +2332,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
float mtxCube[16];
|
|
float mtxCube[16];
|
|
|
- mtxSRT(mtxCube
|
|
|
|
|
|
|
+ bx::mtxSRT(mtxCube
|
|
|
, 2.5f
|
|
, 2.5f
|
|
|
, 2.5f
|
|
, 2.5f
|
|
|
, 2.5f
|
|
, 2.5f
|
|
@@ -2348,17 +2348,17 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
float mtxTrees[numTrees][16];
|
|
float mtxTrees[numTrees][16];
|
|
|
for (uint8_t ii = 0; ii < numTrees; ++ii)
|
|
for (uint8_t ii = 0; ii < numTrees; ++ii)
|
|
|
{
|
|
{
|
|
|
- mtxSRT(mtxTrees[ii]
|
|
|
|
|
- , 2.0f
|
|
|
|
|
- , 2.0f
|
|
|
|
|
- , 2.0f
|
|
|
|
|
- , 0.0f
|
|
|
|
|
- , float(ii)
|
|
|
|
|
- , 0.0f
|
|
|
|
|
- , sin(float(ii)*2.0f*float(M_PI)/float(numTrees) ) * 60.0f
|
|
|
|
|
- , 0.0f
|
|
|
|
|
- , cos(float(ii)*2.0f*float(M_PI)/float(numTrees) ) * 60.0f
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ bx::mtxSRT(mtxTrees[ii]
|
|
|
|
|
+ , 2.0f
|
|
|
|
|
+ , 2.0f
|
|
|
|
|
+ , 2.0f
|
|
|
|
|
+ , 0.0f
|
|
|
|
|
+ , float(ii)
|
|
|
|
|
+ , 0.0f
|
|
|
|
|
+ , sinf(float(ii)*2.0f*float(M_PI)/float(numTrees) ) * 60.0f
|
|
|
|
|
+ , 0.0f
|
|
|
|
|
+ , cosf(float(ii)*2.0f*float(M_PI)/float(numTrees) ) * 60.0f
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Compute transform matrices.
|
|
// Compute transform matrices.
|
|
@@ -2369,14 +2369,14 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
|
|
|
|
|
float screenProj[16];
|
|
float screenProj[16];
|
|
|
float screenView[16];
|
|
float screenView[16];
|
|
|
- mtxIdentity(screenView);
|
|
|
|
|
- mtxOrtho(screenProj, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 100.0f);
|
|
|
|
|
|
|
+ bx::mtxIdentity(screenView);
|
|
|
|
|
+ bx::mtxOrtho(screenProj, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 100.0f);
|
|
|
|
|
|
|
|
if (LightType::SpotLight == settings.m_lightType)
|
|
if (LightType::SpotLight == settings.m_lightType)
|
|
|
{
|
|
{
|
|
|
const float fovy = settings.m_coverageSpotL;
|
|
const float fovy = settings.m_coverageSpotL;
|
|
|
const float aspect = 1.0f;
|
|
const float aspect = 1.0f;
|
|
|
- mtxProj(lightProj[ProjType::Horizontal], fovy, aspect, currentSmSettings->m_near, currentSmSettings->m_far);
|
|
|
|
|
|
|
+ bx::mtxProj(lightProj[ProjType::Horizontal], fovy, aspect, currentSmSettings->m_near, currentSmSettings->m_far);
|
|
|
|
|
|
|
|
//For linear depth, prevent depth division by variable w-component in shaders and divide here by far plane
|
|
//For linear depth, prevent depth division by variable w-component in shaders and divide here by far plane
|
|
|
if (DepthImpl::Linear == settings.m_depthImpl)
|
|
if (DepthImpl::Linear == settings.m_depthImpl)
|
|
@@ -2386,17 +2386,17 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
float at[3];
|
|
float at[3];
|
|
|
- vec3Add(at, pointLight.m_position.m_v, pointLight.m_spotDirectionInner.m_v);
|
|
|
|
|
- mtxLookAt(lightView[TetrahedronFaces::Green], pointLight.m_position.m_v, at);
|
|
|
|
|
|
|
+ bx::vec3Add(at, pointLight.m_position.m_v, pointLight.m_spotDirectionInner.m_v);
|
|
|
|
|
+ bx::mtxLookAt(lightView[TetrahedronFaces::Green], pointLight.m_position.m_v, at);
|
|
|
}
|
|
}
|
|
|
else if (LightType::PointLight == settings.m_lightType)
|
|
else if (LightType::PointLight == settings.m_lightType)
|
|
|
{
|
|
{
|
|
|
float ypr[TetrahedronFaces::Count][3] =
|
|
float ypr[TetrahedronFaces::Count][3] =
|
|
|
{
|
|
{
|
|
|
- { toRad( 0.0f), toRad( 27.36780516f), toRad(0.0f) }
|
|
|
|
|
- ,{ toRad(180.0f), toRad( 27.36780516f), toRad(0.0f) }
|
|
|
|
|
- ,{ toRad(-90.0f), toRad(-27.36780516f), toRad(0.0f) }
|
|
|
|
|
- ,{ toRad( 90.0f), toRad(-27.36780516f), toRad(0.0f) }
|
|
|
|
|
|
|
+ { bx::toRad( 0.0f), bx::toRad( 27.36780516f), bx::toRad(0.0f) },
|
|
|
|
|
+ { bx::toRad(180.0f), bx::toRad( 27.36780516f), bx::toRad(0.0f) },
|
|
|
|
|
+ { bx::toRad(-90.0f), bx::toRad(-27.36780516f), bx::toRad(0.0f) },
|
|
|
|
|
+ { bx::toRad( 90.0f), bx::toRad(-27.36780516f), bx::toRad(0.0f) },
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2404,9 +2404,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
{
|
|
{
|
|
|
const float fovx = 143.98570868f + 3.51f + settings.m_fovXAdjust;
|
|
const float fovx = 143.98570868f + 3.51f + settings.m_fovXAdjust;
|
|
|
const float fovy = 125.26438968f + 9.85f + settings.m_fovYAdjust;
|
|
const float fovy = 125.26438968f + 9.85f + settings.m_fovYAdjust;
|
|
|
- const float aspect = tanf(toRad(fovx*0.5f) )/tanf(toRad(fovy*0.5f) );
|
|
|
|
|
|
|
+ const float aspect = tanf(bx::toRad(fovx*0.5f) )/tanf(bx::toRad(fovy*0.5f) );
|
|
|
|
|
|
|
|
- mtxProj(lightProj[ProjType::Vertical]
|
|
|
|
|
|
|
+ bx::mtxProj(lightProj[ProjType::Vertical]
|
|
|
, fovx
|
|
, fovx
|
|
|
, aspect
|
|
, aspect
|
|
|
, currentSmSettings->m_near
|
|
, currentSmSettings->m_near
|
|
@@ -2420,17 +2420,17 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
lightProj[ProjType::Vertical][14] /= currentSmSettings->m_far;
|
|
lightProj[ProjType::Vertical][14] /= currentSmSettings->m_far;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- ypr[TetrahedronFaces::Green][2] = toRad(180.0f);
|
|
|
|
|
- ypr[TetrahedronFaces::Yellow][2] = toRad( 0.0f);
|
|
|
|
|
- ypr[TetrahedronFaces::Blue][2] = toRad( 90.0f);
|
|
|
|
|
- ypr[TetrahedronFaces::Red][2] = toRad(-90.0f);
|
|
|
|
|
|
|
+ ypr[TetrahedronFaces::Green ][2] = bx::toRad(180.0f);
|
|
|
|
|
+ ypr[TetrahedronFaces::Yellow][2] = bx::toRad( 0.0f);
|
|
|
|
|
+ ypr[TetrahedronFaces::Blue ][2] = bx::toRad( 90.0f);
|
|
|
|
|
+ ypr[TetrahedronFaces::Red ][2] = bx::toRad(-90.0f);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const float fovx = 143.98570868f + 7.8f + settings.m_fovXAdjust;
|
|
const float fovx = 143.98570868f + 7.8f + settings.m_fovXAdjust;
|
|
|
const float fovy = 125.26438968f + 3.0f + settings.m_fovYAdjust;
|
|
const float fovy = 125.26438968f + 3.0f + settings.m_fovYAdjust;
|
|
|
- const float aspect = tanf(toRad(fovx*0.5f) )/tanf(toRad(fovy*0.5f) );
|
|
|
|
|
|
|
+ const float aspect = tanf(bx::toRad(fovx*0.5f) )/tanf(bx::toRad(fovy*0.5f) );
|
|
|
|
|
|
|
|
- mtxProj(lightProj[ProjType::Horizontal], fovy, aspect, currentSmSettings->m_near, currentSmSettings->m_far);
|
|
|
|
|
|
|
+ bx::mtxProj(lightProj[ProjType::Horizontal], fovy, aspect, currentSmSettings->m_near, currentSmSettings->m_far);
|
|
|
|
|
|
|
|
//For linear depth, prevent depth division by variable w component in shaders and divide here by far plane
|
|
//For linear depth, prevent depth division by variable w component in shaders and divide here by far plane
|
|
|
if (DepthImpl::Linear == settings.m_depthImpl)
|
|
if (DepthImpl::Linear == settings.m_depthImpl)
|
|
@@ -2447,12 +2447,12 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
|
|
|
|
|
float tmp[3] =
|
|
float tmp[3] =
|
|
|
{
|
|
{
|
|
|
- -vec3Dot(pointLight.m_position.m_v, &mtxTmp[0])
|
|
|
|
|
- , -vec3Dot(pointLight.m_position.m_v, &mtxTmp[4])
|
|
|
|
|
- , -vec3Dot(pointLight.m_position.m_v, &mtxTmp[8])
|
|
|
|
|
|
|
+ -bx::vec3Dot(pointLight.m_position.m_v, &mtxTmp[0]),
|
|
|
|
|
+ -bx::vec3Dot(pointLight.m_position.m_v, &mtxTmp[4]),
|
|
|
|
|
+ -bx::vec3Dot(pointLight.m_position.m_v, &mtxTmp[8]),
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- mtxTranspose(mtxYpr[ii], mtxTmp);
|
|
|
|
|
|
|
+ bx::mtxTranspose(mtxYpr[ii], mtxTmp);
|
|
|
|
|
|
|
|
memcpy(lightView[ii], mtxYpr[ii], 12*sizeof(float) );
|
|
memcpy(lightView[ii], mtxYpr[ii], 12*sizeof(float) );
|
|
|
lightView[ii][12] = tmp[0];
|
|
lightView[ii][12] = tmp[0];
|
|
@@ -2471,11 +2471,11 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
, -directionalLight.m_position.m_z
|
|
, -directionalLight.m_position.m_z
|
|
|
};
|
|
};
|
|
|
float at[3] = { 0.0f, 0.0f, 0.0f };
|
|
float at[3] = { 0.0f, 0.0f, 0.0f };
|
|
|
- mtxLookAt(lightView[0], eye, at);
|
|
|
|
|
|
|
+ bx::mtxLookAt(lightView[0], eye, at);
|
|
|
|
|
|
|
|
// Compute camera inverse view mtx.
|
|
// Compute camera inverse view mtx.
|
|
|
float mtxViewInv[16];
|
|
float mtxViewInv[16];
|
|
|
- mtxInverse(mtxViewInv, viewState.m_view);
|
|
|
|
|
|
|
+ bx::mtxInverse(mtxViewInv, viewState.m_view);
|
|
|
|
|
|
|
|
// Compute split distances.
|
|
// Compute split distances.
|
|
|
const uint8_t maxNumSplits = 4;
|
|
const uint8_t maxNumSplits = 4;
|
|
@@ -2492,7 +2492,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
float mtxProj[16];
|
|
float mtxProj[16];
|
|
|
- mtxOrtho(mtxProj, 1.0f, -1.0f, 1.0f, -1.0f, -currentSmSettings->m_far, currentSmSettings->m_far);
|
|
|
|
|
|
|
+ bx::mtxOrtho(mtxProj, 1.0f, -1.0f, 1.0f, -1.0f, -currentSmSettings->m_far, currentSmSettings->m_far);
|
|
|
|
|
|
|
|
const uint8_t numCorners = 8;
|
|
const uint8_t numCorners = 8;
|
|
|
float frustumCorners[maxNumSplits][numCorners][3];
|
|
float frustumCorners[maxNumSplits][numCorners][3];
|
|
@@ -2508,21 +2508,21 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
{
|
|
{
|
|
|
// Transform to light space.
|
|
// Transform to light space.
|
|
|
float lightSpaceFrustumCorner[3];
|
|
float lightSpaceFrustumCorner[3];
|
|
|
- vec3MulMtx(lightSpaceFrustumCorner, frustumCorners[ii][jj], lightView[0]);
|
|
|
|
|
|
|
+ bx::vec3MulMtx(lightSpaceFrustumCorner, frustumCorners[ii][jj], lightView[0]);
|
|
|
|
|
|
|
|
// Update bounding box.
|
|
// Update bounding box.
|
|
|
- min[0] = fminf(min[0], lightSpaceFrustumCorner[0]);
|
|
|
|
|
- max[0] = fmaxf(max[0], lightSpaceFrustumCorner[0]);
|
|
|
|
|
- min[1] = fminf(min[1], lightSpaceFrustumCorner[1]);
|
|
|
|
|
- max[1] = fmaxf(max[1], lightSpaceFrustumCorner[1]);
|
|
|
|
|
- min[2] = fminf(min[2], lightSpaceFrustumCorner[2]);
|
|
|
|
|
- max[2] = fmaxf(max[2], lightSpaceFrustumCorner[2]);
|
|
|
|
|
|
|
+ min[0] = bx::fmin(min[0], lightSpaceFrustumCorner[0]);
|
|
|
|
|
+ max[0] = bx::fmax(max[0], lightSpaceFrustumCorner[0]);
|
|
|
|
|
+ min[1] = bx::fmin(min[1], lightSpaceFrustumCorner[1]);
|
|
|
|
|
+ max[1] = bx::fmax(max[1], lightSpaceFrustumCorner[1]);
|
|
|
|
|
+ min[2] = bx::fmin(min[2], lightSpaceFrustumCorner[2]);
|
|
|
|
|
+ max[2] = bx::fmax(max[2], lightSpaceFrustumCorner[2]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
float minproj[3];
|
|
float minproj[3];
|
|
|
float maxproj[3];
|
|
float maxproj[3];
|
|
|
- vec3MulMtxH(minproj, min, mtxProj);
|
|
|
|
|
- vec3MulMtxH(maxproj, max, mtxProj);
|
|
|
|
|
|
|
+ bx::vec3MulMtxH(minproj, min, mtxProj);
|
|
|
|
|
+ bx::vec3MulMtxH(maxproj, max, mtxProj);
|
|
|
|
|
|
|
|
float offsetx, offsety;
|
|
float offsetx, offsety;
|
|
|
float scalex, scaley;
|
|
float scalex, scaley;
|
|
@@ -2548,13 +2548,13 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
float mtxCrop[16];
|
|
float mtxCrop[16];
|
|
|
- mtxIdentity(mtxCrop);
|
|
|
|
|
|
|
+ bx::mtxIdentity(mtxCrop);
|
|
|
mtxCrop[ 0] = scalex;
|
|
mtxCrop[ 0] = scalex;
|
|
|
mtxCrop[ 5] = scaley;
|
|
mtxCrop[ 5] = scaley;
|
|
|
mtxCrop[12] = offsetx;
|
|
mtxCrop[12] = offsetx;
|
|
|
mtxCrop[13] = offsety;
|
|
mtxCrop[13] = offsety;
|
|
|
|
|
|
|
|
- mtxMul(lightProj[ii], mtxCrop, mtxProj);
|
|
|
|
|
|
|
+ bx::mtxMul(lightProj[ii], mtxCrop, mtxProj);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2976,8 +2976,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
if (LightType::SpotLight == settings.m_lightType)
|
|
if (LightType::SpotLight == settings.m_lightType)
|
|
|
{
|
|
{
|
|
|
float mtxTmp[16];
|
|
float mtxTmp[16];
|
|
|
- mtxMul(mtxTmp, lightProj[ProjType::Horizontal], mtxBias);
|
|
|
|
|
- mtxMul(mtxShadow, lightView[0], mtxTmp); //lightViewProjBias
|
|
|
|
|
|
|
+ bx::mtxMul(mtxTmp, lightProj[ProjType::Horizontal], mtxBias);
|
|
|
|
|
+ bx::mtxMul(mtxShadow, lightView[0], mtxTmp); //lightViewProjBias
|
|
|
}
|
|
}
|
|
|
else if (LightType::PointLight == settings.m_lightType)
|
|
else if (LightType::PointLight == settings.m_lightType)
|
|
|
{
|
|
{
|
|
@@ -3061,11 +3061,11 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
uint8_t biasIndex = cropBiasIndices[settings.m_stencilPack][uint8_t(s_flipV)][ii];
|
|
uint8_t biasIndex = cropBiasIndices[settings.m_stencilPack][uint8_t(s_flipV)][ii];
|
|
|
|
|
|
|
|
float mtxTmp[16];
|
|
float mtxTmp[16];
|
|
|
- mtxMul(mtxTmp, mtxYpr[ii], lightProj[projType]);
|
|
|
|
|
- mtxMul(shadowMapMtx[ii], mtxTmp, mtxCropBias[settings.m_stencilPack][biasIndex]); //mtxYprProjBias
|
|
|
|
|
|
|
+ bx::mtxMul(mtxTmp, mtxYpr[ii], lightProj[projType]);
|
|
|
|
|
+ bx::mtxMul(shadowMapMtx[ii], mtxTmp, mtxCropBias[settings.m_stencilPack][biasIndex]); //mtxYprProjBias
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- mtxTranslate(mtxShadow //lightInvTranslate
|
|
|
|
|
|
|
+ bx::mtxTranslate(mtxShadow //lightInvTranslate
|
|
|
, -pointLight.m_position.m_v[0]
|
|
, -pointLight.m_position.m_v[0]
|
|
|
, -pointLight.m_position.m_v[1]
|
|
, -pointLight.m_position.m_v[1]
|
|
|
, -pointLight.m_position.m_v[2]
|
|
, -pointLight.m_position.m_v[2]
|
|
@@ -3077,15 +3077,15 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
{
|
|
{
|
|
|
float mtxTmp[16];
|
|
float mtxTmp[16];
|
|
|
|
|
|
|
|
- mtxMul(mtxTmp, lightProj[ii], mtxBias);
|
|
|
|
|
- mtxMul(shadowMapMtx[ii], lightView[0], mtxTmp); //lViewProjCropBias
|
|
|
|
|
|
|
+ bx::mtxMul(mtxTmp, lightProj[ii], mtxBias);
|
|
|
|
|
+ bx::mtxMul(shadowMapMtx[ii], lightView[0], mtxTmp); //lViewProjCropBias
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Floor.
|
|
// Floor.
|
|
|
if (LightType::DirectionalLight != settings.m_lightType)
|
|
if (LightType::DirectionalLight != settings.m_lightType)
|
|
|
{
|
|
{
|
|
|
- mtxMul(lightMtx, mtxFloor, mtxShadow); //not needed for directional light
|
|
|
|
|
|
|
+ bx::mtxMul(lightMtx, mtxFloor, mtxShadow); //not needed for directional light
|
|
|
}
|
|
}
|
|
|
hplaneMesh.submit(RENDERVIEW_DRAWSCENE_0_ID
|
|
hplaneMesh.submit(RENDERVIEW_DRAWSCENE_0_ID
|
|
|
, mtxFloor
|
|
, mtxFloor
|
|
@@ -3096,7 +3096,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
// Bunny.
|
|
// Bunny.
|
|
|
if (LightType::DirectionalLight != settings.m_lightType)
|
|
if (LightType::DirectionalLight != settings.m_lightType)
|
|
|
{
|
|
{
|
|
|
- mtxMul(lightMtx, mtxBunny, mtxShadow);
|
|
|
|
|
|
|
+ bx::mtxMul(lightMtx, mtxBunny, mtxShadow);
|
|
|
}
|
|
}
|
|
|
bunnyMesh.submit(RENDERVIEW_DRAWSCENE_0_ID
|
|
bunnyMesh.submit(RENDERVIEW_DRAWSCENE_0_ID
|
|
|
, mtxBunny
|
|
, mtxBunny
|
|
@@ -3107,7 +3107,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
// Hollow cube.
|
|
// Hollow cube.
|
|
|
if (LightType::DirectionalLight != settings.m_lightType)
|
|
if (LightType::DirectionalLight != settings.m_lightType)
|
|
|
{
|
|
{
|
|
|
- mtxMul(lightMtx, mtxHollowcube, mtxShadow);
|
|
|
|
|
|
|
+ bx::mtxMul(lightMtx, mtxHollowcube, mtxShadow);
|
|
|
}
|
|
}
|
|
|
hollowcubeMesh.submit(RENDERVIEW_DRAWSCENE_0_ID
|
|
hollowcubeMesh.submit(RENDERVIEW_DRAWSCENE_0_ID
|
|
|
, mtxHollowcube
|
|
, mtxHollowcube
|
|
@@ -3118,7 +3118,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
// Cube.
|
|
// Cube.
|
|
|
if (LightType::DirectionalLight != settings.m_lightType)
|
|
if (LightType::DirectionalLight != settings.m_lightType)
|
|
|
{
|
|
{
|
|
|
- mtxMul(lightMtx, mtxCube, mtxShadow);
|
|
|
|
|
|
|
+ bx::mtxMul(lightMtx, mtxCube, mtxShadow);
|
|
|
}
|
|
}
|
|
|
cubeMesh.submit(RENDERVIEW_DRAWSCENE_0_ID
|
|
cubeMesh.submit(RENDERVIEW_DRAWSCENE_0_ID
|
|
|
, mtxCube
|
|
, mtxCube
|
|
@@ -3131,7 +3131,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
{
|
|
{
|
|
|
if (LightType::DirectionalLight != settings.m_lightType)
|
|
if (LightType::DirectionalLight != settings.m_lightType)
|
|
|
{
|
|
{
|
|
|
- mtxMul(lightMtx, mtxTrees[ii], mtxShadow);
|
|
|
|
|
|
|
+ bx::mtxMul(lightMtx, mtxTrees[ii], mtxShadow);
|
|
|
}
|
|
}
|
|
|
treeMesh.submit(RENDERVIEW_DRAWSCENE_0_ID
|
|
treeMesh.submit(RENDERVIEW_DRAWSCENE_0_ID
|
|
|
, mtxTrees[ii]
|
|
, mtxTrees[ii]
|
|
@@ -3156,7 +3156,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
|
|
|
|
|
|
|
// Draw floor bottom.
|
|
// Draw floor bottom.
|
|
|
float floorBottomMtx[16];
|
|
float floorBottomMtx[16];
|
|
|
- mtxSRT(floorBottomMtx
|
|
|
|
|
|
|
+ bx::mtxSRT(floorBottomMtx
|
|
|
, floorScale //scaleX
|
|
, floorScale //scaleX
|
|
|
, floorScale //scaleY
|
|
, floorScale //scaleY
|
|
|
, floorScale //scaleZ
|
|
, floorScale //scaleZ
|