mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
Cleanup.
This commit is contained in:
parent
2d62896623
commit
ff21c42797
1 changed files with 59 additions and 56 deletions
|
@ -1333,7 +1333,7 @@ void shadowVolumeTransform(float* __restrict _outMtx
|
||||||
, const float* __restrict _lightPos // world pos
|
, const float* __restrict _lightPos // world pos
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
/*
|
/**
|
||||||
* Instead of transforming all the vertices, transform light instead:
|
* Instead of transforming all the vertices, transform light instead:
|
||||||
* mtx = pivotTranslate -> rotateZYX -> invScale
|
* mtx = pivotTranslate -> rotateZYX -> invScale
|
||||||
* light = mtx * origin
|
* light = mtx * origin
|
||||||
|
@ -2236,9 +2236,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
|
|
||||||
//setup light positions
|
//setup light positions
|
||||||
float lightPosRadius[MAX_NUM_LIGHTS][4];
|
float lightPosRadius[MAX_NUM_LIGHTS][4];
|
||||||
switch (lightPattern)
|
if (LightPattern0 == lightPattern)
|
||||||
{
|
{
|
||||||
case LightPattern0:
|
|
||||||
for (uint8_t ii = 0; ii < settings_numLights; ++ii)
|
for (uint8_t ii = 0; ii < settings_numLights; ++ii)
|
||||||
{
|
{
|
||||||
lightPosRadius[ii][0] = cos(2.0f*float(M_PI)/settings_numLights * float(ii) + lightTimeAccumulator * 1.1f + 3.0f) * 20.0f;
|
lightPosRadius[ii][0] = cos(2.0f*float(M_PI)/settings_numLights * float(ii) + lightTimeAccumulator * 1.1f + 3.0f) * 20.0f;
|
||||||
|
@ -2246,8 +2245,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
lightPosRadius[ii][2] = sin(2.0f*float(M_PI)/settings_numLights * float(ii) + lightTimeAccumulator * 1.1f + 3.0f) * 20.0f;
|
lightPosRadius[ii][2] = sin(2.0f*float(M_PI)/settings_numLights * float(ii) + lightTimeAccumulator * 1.1f + 3.0f) * 20.0f;
|
||||||
lightPosRadius[ii][3] = 20.0f;
|
lightPosRadius[ii][3] = 20.0f;
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case LightPattern1:
|
else
|
||||||
|
{
|
||||||
for (uint8_t ii = 0; ii < settings_numLights; ++ii)
|
for (uint8_t ii = 0; ii < settings_numLights; ++ii)
|
||||||
{
|
{
|
||||||
lightPosRadius[ii][0] = cos(float(ii) * 2.0f/settings_numLights + lightTimeAccumulator * 1.3f + float(M_PI) ) * 40.0f;
|
lightPosRadius[ii][0] = cos(float(ii) * 2.0f/settings_numLights + lightTimeAccumulator * 1.3f + float(M_PI) ) * 40.0f;
|
||||||
|
@ -2255,7 +2255,6 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
lightPosRadius[ii][2] = sin(float(ii) * 2.0f/settings_numLights + lightTimeAccumulator * 1.3f + float(M_PI) ) * 40.0f;
|
lightPosRadius[ii][2] = sin(float(ii) * 2.0f/settings_numLights + lightTimeAccumulator * 1.3f + float(M_PI) ) * 40.0f;
|
||||||
lightPosRadius[ii][3] = 20.0f;
|
lightPosRadius[ii][3] = 20.0f;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//use debug font to print information about this example.
|
//use debug font to print information about this example.
|
||||||
|
@ -2426,6 +2425,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scene 1 - shadow casters - Bunny instances
|
// Scene 1 - shadow casters - Bunny instances
|
||||||
|
{
|
||||||
enum Direction
|
enum Direction
|
||||||
{
|
{
|
||||||
Left = 0,
|
Left = 0,
|
||||||
|
@ -2435,6 +2435,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
|
|
||||||
DirectionCount,
|
DirectionCount,
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t currentDirection = Left;
|
uint8_t currentDirection = Left;
|
||||||
float currX = 0.0f;
|
float currX = 0.0f;
|
||||||
float currY = 0.0f;
|
float currY = 0.0f;
|
||||||
|
@ -2474,6 +2475,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Scene 1 - shadow receivers - Floor.
|
// Scene 1 - shadow receivers - Floor.
|
||||||
{
|
{
|
||||||
|
@ -2565,7 +2567,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create near clip volume for current light.
|
// Create near clip volume for current light.
|
||||||
float nearClipVolume[6 * 4];
|
float nearClipVolume[6 * 4] = {};
|
||||||
float pointLight[4];
|
float pointLight[4];
|
||||||
if (settings_mixedSvImpl)
|
if (settings_mixedSvImpl)
|
||||||
{
|
{
|
||||||
|
@ -2714,9 +2716,10 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
s_uniforms.m_params.m_ambientPass = 0.0f;
|
s_uniforms.m_params.m_ambientPass = 0.0f;
|
||||||
s_uniforms.m_params.m_lightningPass = 1.0f;
|
s_uniforms.m_params.m_lightningPass = 1.0f;
|
||||||
|
|
||||||
RenderState& drawDiffuse = (settings_useStencilTexture ?
|
RenderState& drawDiffuse = settings_useStencilTexture
|
||||||
s_renderStates[RenderState::ShadowVolume_UsingStencilTexture_DrawDiffuse] :
|
? s_renderStates[RenderState::ShadowVolume_UsingStencilTexture_DrawDiffuse]
|
||||||
s_renderStates[RenderState::ShadowVolume_UsingStencilBuffer_DrawDiffuse]);
|
: s_renderStates[RenderState::ShadowVolume_UsingStencilBuffer_DrawDiffuse]
|
||||||
|
;
|
||||||
|
|
||||||
// If using stencil texture, viewId is set to render target. Incr it to render to default back buffer.
|
// If using stencil texture, viewId is set to render target. Incr it to render to default back buffer.
|
||||||
viewId += uint8_t(settings_useStencilTexture);
|
viewId += uint8_t(settings_useStencilTexture);
|
||||||
|
|
Loading…
Reference in a new issue