mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-26 18:13:47 +00:00
Shadow tests
only works on vectorLight (eg sun and scatter sky) for now
This commit is contained in:
parent
abbfb634f3
commit
239c7e58d2
9 changed files with 182 additions and 121 deletions
|
|
@ -807,7 +807,9 @@ void AdvancedLightBinManager::LightMaterialInfo::setLightParameters( const Light
|
|||
const F32 innerCone = getMin(lightInfo->getInnerConeAngle(), outerCone);
|
||||
const F32 outerCos = mCos(mDegToRad(outerCone / 2.0f));
|
||||
const F32 innerCos = mCos(mDegToRad(innerCone / 2.0f));
|
||||
Point2F spotParams(outerCos,innerCos - outerCos);
|
||||
const F32 lightAngleScale = 1.0f / getMax(0.001f, (innerCos - outerCos));
|
||||
const F32 lightAngleOffset = -outerCos * lightAngleScale;
|
||||
Point2F spotParams(lightAngleScale, lightAngleOffset);
|
||||
|
||||
matParams->setSafe( lightSpotParams, spotParams );
|
||||
matParams->setSafe( lightDirection, lightInfo->getDirection());
|
||||
|
|
|
|||
|
|
@ -265,8 +265,16 @@ bool LightShadowMap::setTextureStage( U32 currTexFlag, LightingShaderConstants*
|
|||
{
|
||||
S32 reg = lsc->mShadowMapSC->getSamplerRegister();
|
||||
|
||||
if ( reg != -1 )
|
||||
GFX->setTexture( reg, mShadowMapTex);
|
||||
if (reg != -1)
|
||||
{
|
||||
GFX->setTexture(reg, mShadowMapTex);
|
||||
}
|
||||
|
||||
reg = lsc->mShadowMapCMPSC->getSamplerRegister();
|
||||
if (reg != -1)
|
||||
{
|
||||
GFX->setTexture(reg, mShadowMapTex);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if ( currTexFlag == Material::DynamicLightMask )
|
||||
|
|
@ -427,7 +435,8 @@ LightingShaderConstants::LightingShaderConstants()
|
|||
mVectorLightDirectionSC(NULL),
|
||||
mVectorLightColorSC(NULL),
|
||||
mVectorLightBrightnessSC(NULL),
|
||||
mShadowMapSC(NULL),
|
||||
mShadowMapSC(NULL),
|
||||
mShadowMapCMPSC(NULL),
|
||||
mShadowMapSizeSC(NULL),
|
||||
mCookieMapSC(NULL),
|
||||
mRandomDirsConst(NULL),
|
||||
|
|
@ -487,6 +496,7 @@ void LightingShaderConstants::init(GFXShader* shader)
|
|||
mVectorLightBrightnessSC = shader->getShaderConstHandle(ShaderGenVars::vectorLightBrightness);
|
||||
|
||||
mShadowMapSC = shader->getShaderConstHandle("$shadowMap");
|
||||
mShadowMapCMPSC = shader->getShaderConstHandle("$shadowMapCMP");
|
||||
mShadowMapSizeSC = shader->getShaderConstHandle("$shadowMapSize");
|
||||
|
||||
mCookieMapSC = shader->getShaderConstHandle("$cookieMap");
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ struct LightingShaderConstants
|
|||
GFXShaderConstHandle* mVectorLightBrightnessSC;
|
||||
|
||||
GFXShaderConstHandle* mShadowMapSC;
|
||||
GFXShaderConstHandle* mShadowMapCMPSC;
|
||||
GFXShaderConstHandle* mShadowMapSizeSC;
|
||||
|
||||
GFXShaderConstHandle* mCookieMapSC;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue