mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
Cleanup.
This commit is contained in:
parent
49e14b2a54
commit
fe53e02b7c
1 changed files with 33 additions and 41 deletions
|
@ -944,7 +944,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
{
|
{
|
||||||
StencilReflectionScene = 0,
|
StencilReflectionScene = 0,
|
||||||
ProjectionShadowsScene,
|
ProjectionShadowsScene,
|
||||||
}
|
};
|
||||||
|
|
||||||
Scene scene = StencilReflectionScene;
|
Scene scene = StencilReflectionScene;
|
||||||
float settings_numLights = 4.0f;
|
float settings_numLights = 4.0f;
|
||||||
|
@ -958,12 +958,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
"Projection Shadows Scene",
|
"Projection Shadows Scene",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
entry::MouseState mouseState;
|
entry::MouseState mouseState;
|
||||||
while (!entry::processEvents(viewState.m_width, viewState.m_height, debug, reset, &mouseState) )
|
while (!entry::processEvents(viewState.m_width, viewState.m_height, debug, reset, &mouseState) )
|
||||||
{
|
{
|
||||||
//imgui
|
|
||||||
|
|
||||||
imguiBeginFrame(mouseState.m_mx
|
imguiBeginFrame(mouseState.m_mx
|
||||||
, mouseState.m_my
|
, mouseState.m_my
|
||||||
, (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
, (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
||||||
|
@ -1062,12 +1059,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
}
|
}
|
||||||
bgfx::setUniform(u_lightPosRadius, lightPosRadius, numLights);
|
bgfx::setUniform(u_lightPosRadius, lightPosRadius, numLights);
|
||||||
|
|
||||||
|
// Floor position.
|
||||||
//-------------------------------------------------
|
|
||||||
// Render
|
|
||||||
//-------------------------------------------------
|
|
||||||
|
|
||||||
//floor position
|
|
||||||
float floorMtx[16];
|
float floorMtx[16];
|
||||||
mtxScaleRotateTranslate(floorMtx
|
mtxScaleRotateTranslate(floorMtx
|
||||||
, 20.0f //scaleX
|
, 20.0f //scaleX
|
||||||
|
@ -1081,21 +1073,21 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
, 0.0f //translateZ
|
, 0.0f //translateZ
|
||||||
);
|
);
|
||||||
|
|
||||||
//bunny position
|
// Bunny position.
|
||||||
float bunnyMtx[16];
|
float bunnyMtx[16];
|
||||||
mtxScaleRotateTranslate(bunnyMtx
|
mtxScaleRotateTranslate(bunnyMtx
|
||||||
, 5.0f //scaleX
|
, 5.0f
|
||||||
, 5.0f //scaleY
|
, 5.0f
|
||||||
, 5.0f //scaleZ
|
, 5.0f
|
||||||
, 0.0f //rotX
|
, 0.0f
|
||||||
, 1.56f + sceneTimeAccumulator //rotY
|
, 1.56f + sceneTimeAccumulator
|
||||||
, 0.0f //rotZ
|
, 0.0f
|
||||||
, 0.0f //translateX
|
, 0.0f
|
||||||
, 2.0f //translateY
|
, 2.0f
|
||||||
, 0.0f //translateZ
|
, 0.0f
|
||||||
);
|
);
|
||||||
|
|
||||||
//columns position
|
// Columns position.
|
||||||
const float dist = 14.0f;
|
const float dist = 14.0f;
|
||||||
const float columnPositions[4][3] =
|
const float columnPositions[4][3] =
|
||||||
{
|
{
|
||||||
|
@ -1109,15 +1101,15 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
for (uint8_t ii = 0; ii < 4; ++ii)
|
for (uint8_t ii = 0; ii < 4; ++ii)
|
||||||
{
|
{
|
||||||
mtxScaleRotateTranslate(columnMtx[ii]
|
mtxScaleRotateTranslate(columnMtx[ii]
|
||||||
, 1.0f //scaleX
|
, 1.0f
|
||||||
, 1.0f //scaleY
|
, 1.0f
|
||||||
, 1.0f //scaleZ
|
, 1.0f
|
||||||
, 0.0f //rotX
|
, 0.0f
|
||||||
, 0.0f //rotY
|
, 0.0f
|
||||||
, 0.0f //rotZ
|
, 0.0f
|
||||||
, columnPositions[ii][0] //translateX
|
, columnPositions[ii][0]
|
||||||
, columnPositions[ii][1] //translateY
|
, columnPositions[ii][1]
|
||||||
, columnPositions[ii][2] //translateZ
|
, columnPositions[ii][2]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1126,23 +1118,23 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
for (uint16_t ii = 0; ii < numCubes; ++ii)
|
for (uint16_t ii = 0; ii < numCubes; ++ii)
|
||||||
{
|
{
|
||||||
mtxScaleRotateTranslate(cubeMtx[ii]
|
mtxScaleRotateTranslate(cubeMtx[ii]
|
||||||
, 1.0f //scaleX
|
, 1.0f
|
||||||
, 1.0f //scaleY
|
, 1.0f
|
||||||
, 1.0f //scaleZ
|
, 1.0f
|
||||||
, 0.0f //rotX
|
, 0.0f
|
||||||
, 0.0f //rotY
|
, 0.0f
|
||||||
, 0.0f //rotZ
|
, 0.0f
|
||||||
, sin(ii * 2.0f + 13.0f + sceneTimeAccumulator) * 13.0f //translateX
|
, sin(ii * 2.0f + 13.0f + sceneTimeAccumulator) * 13.0f
|
||||||
, 4.0f //translateY
|
, 4.0f
|
||||||
, cos(ii * 2.0f + 13.0f + sceneTimeAccumulator) * 13.0f //translateZ
|
, cos(ii * 2.0f + 13.0f + sceneTimeAccumulator) * 13.0f
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure at the beginning everything gets cleared
|
// Make sure at the beginning everything gets cleared.
|
||||||
clearView(0, BGFX_CLEAR_COLOR_BIT | BGFX_CLEAR_DEPTH_BIT | BGFX_CLEAR_STENCIL_BIT, clearValues);
|
clearView(0, BGFX_CLEAR_COLOR_BIT | BGFX_CLEAR_DEPTH_BIT | BGFX_CLEAR_STENCIL_BIT, clearValues);
|
||||||
submit(0);
|
submit(0);
|
||||||
|
|
||||||
//white bunny and columns
|
// White bunny and columns.
|
||||||
color[0] = 1.0f;
|
color[0] = 1.0f;
|
||||||
color[1] = 1.0f;
|
color[1] = 1.0f;
|
||||||
color[2] = 1.0f;
|
color[2] = 1.0f;
|
||||||
|
|
Loading…
Reference in a new issue