This commit is contained in:
bkaradzic 2013-10-20 13:11:41 -07:00
parent 2d62896623
commit ff21c42797

View file

@ -1333,7 +1333,7 @@ void shadowVolumeTransform(float* __restrict _outMtx
, const float* __restrict _lightPos // world pos
)
{
/*
/**
* Instead of transforming all the vertices, transform light instead:
* mtx = pivotTranslate -> rotateZYX -> invScale
* light = mtx * origin
@ -2236,9 +2236,8 @@ int _main_(int /*_argc*/, char** /*_argv*/)
//setup light positions
float lightPosRadius[MAX_NUM_LIGHTS][4];
switch (lightPattern)
if (LightPattern0 == lightPattern)
{
case LightPattern0:
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;
@ -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][3] = 20.0f;
}
break;
case LightPattern1:
}
else
{
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;
@ -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][3] = 20.0f;
}
break;
}
//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
{
enum Direction
{
Left = 0,
@ -2435,6 +2435,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
DirectionCount,
};
uint8_t currentDirection = Left;
float currX = 0.0f;
float currY = 0.0f;
@ -2474,6 +2475,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
default: break;
}
}
}
// Scene 1 - shadow receivers - Floor.
{
@ -2565,7 +2567,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
}
// Create near clip volume for current light.
float nearClipVolume[6 * 4];
float nearClipVolume[6 * 4] = {};
float pointLight[4];
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_lightningPass = 1.0f;
RenderState& drawDiffuse = (settings_useStencilTexture ?
s_renderStates[RenderState::ShadowVolume_UsingStencilTexture_DrawDiffuse] :
s_renderStates[RenderState::ShadowVolume_UsingStencilBuffer_DrawDiffuse]);
RenderState& drawDiffuse = settings_useStencilTexture
? s_renderStates[RenderState::ShadowVolume_UsingStencilTexture_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.
viewId += uint8_t(settings_useStencilTexture);