Cleanup.
This commit is contained in:
parent
f56cf4c88e
commit
5b3c9609cb
@ -66,6 +66,16 @@
|
|||||||
#define SHADOW_MAP_DIM 512
|
#define SHADOW_MAP_DIM 512
|
||||||
#define LIGHT_DIST 10.0f
|
#define LIGHT_DIST 10.0f
|
||||||
|
|
||||||
|
static const char * m_meshPaths[MESH_COUNT] =
|
||||||
|
{
|
||||||
|
"meshes/cube.bin",
|
||||||
|
"meshes/orb.bin",
|
||||||
|
"meshes/column.bin",
|
||||||
|
"meshes/bunny.bin",
|
||||||
|
"meshes/tree.bin",
|
||||||
|
"meshes/hollowcube.bin"
|
||||||
|
};
|
||||||
|
|
||||||
// Vertex decl for our screen space quad (used in deferred rendering)
|
// Vertex decl for our screen space quad (used in deferred rendering)
|
||||||
struct PosTexCoord0Vertex
|
struct PosTexCoord0Vertex
|
||||||
{
|
{
|
||||||
@ -318,9 +328,11 @@ class ExampleReflectiveShadowMap : public entry::AppI
|
|||||||
|
|
||||||
int shutdown() BX_OVERRIDE
|
int shutdown() BX_OVERRIDE
|
||||||
{
|
{
|
||||||
for (uint32_t i = 0; i < MESH_COUNT; i++) {
|
for (uint32_t i = 0; i < MESH_COUNT; i++)
|
||||||
|
{
|
||||||
meshUnload(m_meshes[i]);
|
meshUnload(m_meshes[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
meshUnload(m_ground);
|
meshUnload(m_ground);
|
||||||
meshUnload(m_lightSphere);
|
meshUnload(m_lightSphere);
|
||||||
|
|
||||||
@ -553,8 +565,10 @@ class ExampleReflectiveShadowMap : public entry::AppI
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawAllModels(uint8_t _pass, bgfx::ProgramHandle _program) {
|
void drawAllModels(uint8_t _pass, bgfx::ProgramHandle _program)
|
||||||
for (const Model & m : m_models) {
|
{
|
||||||
|
for (const Model & m : m_models)
|
||||||
|
{
|
||||||
// Set up transform matrix for each model
|
// Set up transform matrix for each model
|
||||||
float scale = m_meshScale[m.mesh];
|
float scale = m_meshScale[m.mesh];
|
||||||
float mtx[16];
|
float mtx[16];
|
||||||
@ -576,7 +590,7 @@ class ExampleReflectiveShadowMap : public entry::AppI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw ground
|
// Draw ground
|
||||||
const float white[4] = {1.0f, 1.0f, 1.0f, 1.0f};
|
const float white[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||||
bgfx::setUniform(u_tint, white);
|
bgfx::setUniform(u_tint, white);
|
||||||
float mtxScale[16];
|
float mtxScale[16];
|
||||||
float scale = 10.0;
|
float scale = 10.0;
|
||||||
@ -596,7 +610,8 @@ class ExampleReflectiveShadowMap : public entry::AppI
|
|||||||
meshSubmit(m_ground, _pass, _program, mtx);
|
meshSubmit(m_ground, _pass, _program, mtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateLightDir () {
|
void updateLightDir()
|
||||||
|
{
|
||||||
float el = m_lightElevation * (bx::pi/180.0f);
|
float el = m_lightElevation * (bx::pi/180.0f);
|
||||||
float az = m_lightAzimuth * (bx::pi/180.0f);
|
float az = m_lightAzimuth * (bx::pi/180.0f);
|
||||||
m_lightDir[0] = cos(el)*cos(az);
|
m_lightDir[0] = cos(el)*cos(az);
|
||||||
@ -653,7 +668,8 @@ class ExampleReflectiveShadowMap : public entry::AppI
|
|||||||
// UI
|
// UI
|
||||||
bool m_cameraSpin = false;
|
bool m_cameraSpin = false;
|
||||||
|
|
||||||
struct Model {
|
struct Model
|
||||||
|
{
|
||||||
uint32_t mesh; // Index of mesh in m_meshes
|
uint32_t mesh; // Index of mesh in m_meshes
|
||||||
float color[4];
|
float color[4];
|
||||||
float position[3];
|
float position[3];
|
||||||
@ -661,15 +677,6 @@ class ExampleReflectiveShadowMap : public entry::AppI
|
|||||||
|
|
||||||
Model m_models[MODEL_COUNT];
|
Model m_models[MODEL_COUNT];
|
||||||
|
|
||||||
const char * m_meshPaths[MESH_COUNT] = {
|
|
||||||
"meshes/cube.bin"
|
|
||||||
,"meshes/orb.bin"
|
|
||||||
,"meshes/column.bin"
|
|
||||||
,"meshes/bunny.bin"
|
|
||||||
,"meshes/tree.bin"
|
|
||||||
,"meshes/hollowcube.bin"
|
|
||||||
};
|
|
||||||
|
|
||||||
// Light position;
|
// Light position;
|
||||||
float m_lightDir[4];
|
float m_lightDir[4];
|
||||||
float m_lightElevation = 35.0f;
|
float m_lightElevation = 35.0f;
|
||||||
|
Loading…
Reference in New Issue
Block a user