mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-21 20:35:35 +00:00
Removes Direct3D9 functionality.
This commit is contained in:
parent
5ac6f6beb3
commit
edd1e0a270
86 changed files with 382 additions and 10445 deletions
|
|
@ -116,23 +116,23 @@ void AdvancedLightManager::activate( SceneManager *sceneManager )
|
|||
mLightBinManager->assignName( "AL_LightBinMgr" );
|
||||
|
||||
// First look for the deferred bin...
|
||||
RenderDeferredMgr *prePassBin = _findDeferredRenderBin();
|
||||
RenderDeferredMgr *deferredBin = _findDeferredRenderBin();
|
||||
|
||||
// If we didn't find the deferred bin then add one.
|
||||
if ( !prePassBin )
|
||||
if ( !deferredBin )
|
||||
{
|
||||
prePassBin = new RenderDeferredMgr( true, blendTargetFormat );
|
||||
prePassBin->assignName( "AL_DeferredBin" );
|
||||
prePassBin->registerObject();
|
||||
getSceneManager()->getDefaultRenderPass()->addManager( prePassBin );
|
||||
mDeferredRenderBin = prePassBin;
|
||||
deferredBin = new RenderDeferredMgr( true, blendTargetFormat );
|
||||
deferredBin->assignName( "AL_DeferredBin" );
|
||||
deferredBin->registerObject();
|
||||
getSceneManager()->getDefaultRenderPass()->addManager( deferredBin );
|
||||
mDeferredRenderBin = deferredBin;
|
||||
}
|
||||
|
||||
// Tell the material manager that deferred is enabled.
|
||||
MATMGR->setDeferredEnabled( true );
|
||||
|
||||
// Insert our light bin manager.
|
||||
mLightBinManager->setRenderOrder( prePassBin->getRenderOrder() + 0.01f );
|
||||
mLightBinManager->setRenderOrder( deferredBin->getRenderOrder() + 0.01f );
|
||||
getSceneManager()->getDefaultRenderPass()->addManager( mLightBinManager );
|
||||
|
||||
AdvancedLightingFeatures::registerFeatures(mDeferredRenderBin->getTargetFormat(), mLightBinManager->getTargetFormat());
|
||||
|
|
|
|||
|
|
@ -232,7 +232,6 @@ void DeferredBumpFeatGLSL::processVert( Vector<ShaderComponent*> &componentLis
|
|||
|
||||
getOutTexCoord( "texCoord",
|
||||
"vec2",
|
||||
true,
|
||||
useTexAnim,
|
||||
meta,
|
||||
componentList );
|
||||
|
|
@ -272,7 +271,7 @@ void DeferredBumpFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
|
||||
// create texture var
|
||||
Var *bumpMap = getNormalMapTex();
|
||||
Var *texCoord = getInTexCoord( "texCoord", "vec2", true, componentList );
|
||||
Var *texCoord = getInTexCoord( "texCoord", "vec2", componentList );
|
||||
LangElement *texOp = new GenOp( "tex2D(@, @)", bumpMap, texCoord );
|
||||
|
||||
// create bump normal
|
||||
|
|
@ -295,7 +294,7 @@ void DeferredBumpFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
bumpMap->sampler = true;
|
||||
bumpMap->constNum = Var::getTexUnitNum();
|
||||
|
||||
texCoord = getInTexCoord( "detCoord", "vec2", true, componentList );
|
||||
texCoord = getInTexCoord( "detCoord", "vec2", componentList );
|
||||
texOp = new GenOp( "tex2D(@, @)", bumpMap, texCoord );
|
||||
|
||||
Var *detailBump = new Var;
|
||||
|
|
@ -338,7 +337,7 @@ void DeferredBumpFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
{
|
||||
MultiLine *meta = new MultiLine;
|
||||
|
||||
Var *texCoord = getInTexCoord("texCoord", "vec2", true, componentList);
|
||||
Var *texCoord = getInTexCoord("texCoord", "vec2", componentList);
|
||||
|
||||
Var *bumpMap = getNormalMapTex();
|
||||
|
||||
|
|
@ -361,7 +360,7 @@ void DeferredBumpFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
bumpMap->constNum = Var::getTexUnitNum();
|
||||
}
|
||||
|
||||
texCoord = getInTexCoord("detCoord", "vec2", true, componentList);
|
||||
texCoord = getInTexCoord("detCoord", "vec2", componentList);
|
||||
LangElement *texOp = new GenOp("tex2D(@, @)", bumpMap, texCoord);
|
||||
|
||||
Var *detailBump = new Var;
|
||||
|
|
@ -394,7 +393,7 @@ void DeferredBumpFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
Var *bumpSample = (Var *)LangElement::find( "bumpSample" );
|
||||
if( bumpSample == NULL )
|
||||
{
|
||||
Var *texCoord = getInTexCoord( "texCoord", "vec2", true, componentList );
|
||||
Var *texCoord = getInTexCoord( "texCoord", "vec2", componentList );
|
||||
|
||||
Var *bumpMap = getNormalMapTex();
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
void DeferredSpecMapGLSL::processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
|
||||
{
|
||||
// Get the texture coord.
|
||||
Var *texCoord = getInTexCoord( "texCoord", "vec2", true, componentList );
|
||||
Var *texCoord = getInTexCoord( "texCoord", "vec2", componentList );
|
||||
|
||||
// search for color var
|
||||
Var *material = (Var*) LangElement::find( getOutputTargetVarName(ShaderFeature::RenderTarget2) );
|
||||
|
|
@ -98,7 +98,6 @@ void DeferredSpecMapGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
MultiLine *meta = new MultiLine;
|
||||
getOutTexCoord( "texCoord",
|
||||
"vec2",
|
||||
true,
|
||||
fd.features[MFT_TexAnim],
|
||||
meta,
|
||||
componentList );
|
||||
|
|
|
|||
|
|
@ -145,7 +145,6 @@ void GBufferConditionerGLSL::processPix( Vector<ShaderComponent*> &componentLis
|
|||
gbNormal->setName( "gbNormal" );
|
||||
gbNormal->setStructName( "IN" );
|
||||
gbNormal->setType( "float3" );
|
||||
gbNormal->mapsToSampler = false;
|
||||
gbNormal->uniform = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,23 +120,18 @@ void DeferredRTLightingFeatHLSL::processPix( Vector<ShaderComponent*> &component
|
|||
|
||||
// create texture var
|
||||
Var *lightInfoBuffer = new Var;
|
||||
lightInfoBuffer->setType( "sampler2D" );
|
||||
lightInfoBuffer->setType( "SamplerState" );
|
||||
lightInfoBuffer->setName( "lightInfoBuffer" );
|
||||
lightInfoBuffer->uniform = true;
|
||||
lightInfoBuffer->sampler = true;
|
||||
lightInfoBuffer->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var* lightBufferTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
lightInfoBuffer->setType("SamplerState");
|
||||
lightBufferTex = new Var;
|
||||
lightBufferTex->setName("lightInfoBufferTex");
|
||||
lightBufferTex->setType("Texture2D");
|
||||
lightBufferTex->uniform = true;
|
||||
lightBufferTex->texture = true;
|
||||
lightBufferTex->constNum = lightInfoBuffer->constNum;
|
||||
}
|
||||
Var* lightBufferTex = new Var;
|
||||
lightBufferTex->setName("lightInfoBufferTex");
|
||||
lightBufferTex->setType("Texture2D");
|
||||
lightBufferTex->uniform = true;
|
||||
lightBufferTex->texture = true;
|
||||
lightBufferTex->constNum = lightInfoBuffer->constNum;
|
||||
|
||||
// Declare the RTLighting variables in this feature, they will either be assigned
|
||||
// in this feature, or in the tonemap/lightmap feature
|
||||
|
|
@ -152,12 +147,8 @@ void DeferredRTLightingFeatHLSL::processPix( Vector<ShaderComponent*> &component
|
|||
|
||||
// Perform the uncondition here.
|
||||
String unconditionLightInfo = String::ToLower( AdvancedLightBinManager::smBufferName ) + "Uncondition";
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(avar(" %s(@.Sample(@, @), @, @, @);\r\n",
|
||||
unconditionLightInfo.c_str()), lightBufferTex, lightInfoBuffer, uvScene, d_lightcolor, d_NL_Att, d_specular));
|
||||
else
|
||||
meta->addStatement(new GenOp(avar(" %s(tex2D(@, @), @, @, @);\r\n",
|
||||
unconditionLightInfo.c_str()), lightInfoBuffer, uvScene, d_lightcolor, d_NL_Att, d_specular));
|
||||
meta->addStatement(new GenOp(avar(" %s(@.Sample(@, @), @, @, @);\r\n",
|
||||
unconditionLightInfo.c_str()), lightBufferTex, lightInfoBuffer, uvScene, d_lightcolor, d_NL_Att, d_specular));
|
||||
|
||||
// If this has an interlaced pre-pass, do averaging here
|
||||
if( fd.features[MFT_InterlacedDeferred] )
|
||||
|
|
@ -173,12 +164,8 @@ void DeferredRTLightingFeatHLSL::processPix( Vector<ShaderComponent*> &component
|
|||
}
|
||||
|
||||
meta->addStatement( new GenOp( " float id_NL_Att, id_specular;\r\n float3 id_lightcolor;\r\n" ) );
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(avar(" %s(@.Sample(@, @ + float2(0.0, @.y)), id_lightcolor, id_NL_Att, id_specular);\r\n",
|
||||
unconditionLightInfo.c_str()), lightBufferTex, lightInfoBuffer, uvScene, oneOverTargetSize));
|
||||
else
|
||||
meta->addStatement(new GenOp(avar(" %s(tex2D(@, @ + float2(0.0, @.y)), id_lightcolor, id_NL_Att, id_specular);\r\n",
|
||||
unconditionLightInfo.c_str()), lightInfoBuffer, uvScene, oneOverTargetSize));
|
||||
meta->addStatement(new GenOp(avar(" %s(@.Sample(@, @ + float2(0.0, @.y)), id_lightcolor, id_NL_Att, id_specular);\r\n",
|
||||
unconditionLightInfo.c_str()), lightBufferTex, lightInfoBuffer, uvScene, oneOverTargetSize));
|
||||
|
||||
meta->addStatement( new GenOp(" @ = lerp(@, id_lightcolor, 0.5);\r\n", d_lightcolor, d_lightcolor ) );
|
||||
meta->addStatement( new GenOp(" @ = lerp(@, id_NL_Att, 0.5);\r\n", d_NL_Att, d_NL_Att ) );
|
||||
|
|
@ -252,7 +239,6 @@ void DeferredBumpFeatHLSL::processVert( Vector<ShaderComponent*> &componentLis
|
|||
|
||||
getOutTexCoord( "texCoord",
|
||||
"float2",
|
||||
true,
|
||||
useTexAnim,
|
||||
meta,
|
||||
componentList );
|
||||
|
|
@ -292,17 +278,10 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
|
||||
// create texture var
|
||||
Var *bumpMap = getNormalMapTex();
|
||||
Var *texCoord = getInTexCoord("texCoord", "float2", true, componentList);
|
||||
Var *texCoord = getInTexCoord("texCoord", "float2", componentList);
|
||||
|
||||
LangElement *texOp = NULL;
|
||||
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
Var *bumpMapTex = (Var*)LangElement::find("bumpMapTex");
|
||||
texOp = new GenOp("@.Sample(@, @)", bumpMapTex, bumpMap, texCoord);
|
||||
}
|
||||
else
|
||||
texOp = new GenOp("tex2D(@, @)", bumpMap, texCoord);
|
||||
Var *bumpMapTex = (Var*)LangElement::find("bumpMapTex");
|
||||
LangElement *texOp = new GenOp("@.Sample(@, @)", bumpMapTex, bumpMap, texCoord);
|
||||
|
||||
// create bump normal
|
||||
Var *bumpNorm = new Var;
|
||||
|
|
@ -318,31 +297,22 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
if ( fd.features.hasFeature( MFT_DetailNormalMap ) )
|
||||
{
|
||||
bumpMap = new Var;
|
||||
bumpMap->setType( "sampler2D" );
|
||||
bumpMap->setType( "SamplerState" );
|
||||
bumpMap->setName( "detailBumpMap" );
|
||||
bumpMap->uniform = true;
|
||||
bumpMap->sampler = true;
|
||||
bumpMap->constNum = Var::getTexUnitNum();
|
||||
|
||||
Var* detailNormalTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
bumpMap->setType("SamplerState");
|
||||
detailNormalTex = new Var;
|
||||
detailNormalTex->setName("detailBumpMapTex");
|
||||
detailNormalTex->setType("Texture2D");
|
||||
detailNormalTex->uniform = true;
|
||||
detailNormalTex->texture = true;
|
||||
detailNormalTex->constNum = bumpMap->constNum;
|
||||
}
|
||||
Var* detailNormalTex = new Var;
|
||||
detailNormalTex->setName("detailBumpMapTex");
|
||||
detailNormalTex->setType("Texture2D");
|
||||
detailNormalTex->uniform = true;
|
||||
detailNormalTex->texture = true;
|
||||
detailNormalTex->constNum = bumpMap->constNum;
|
||||
|
||||
texCoord = getInTexCoord("detCoord", "float2", componentList);
|
||||
|
||||
texCoord = getInTexCoord("detCoord", "float2", true, componentList);
|
||||
|
||||
if (mIsDirect3D11)
|
||||
texOp = new GenOp("@.Sample(@, @)", detailNormalTex, bumpMap, texCoord);
|
||||
else
|
||||
texOp = new GenOp("tex2D(@, @)", bumpMap, texCoord);
|
||||
texOp = new GenOp("@.Sample(@, @)", detailNormalTex, bumpMap, texCoord);
|
||||
|
||||
Var *detailBump = new Var;
|
||||
detailBump->setName( "detailBump" );
|
||||
|
|
@ -383,7 +353,7 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
{
|
||||
MultiLine *meta = new MultiLine;
|
||||
|
||||
Var *texCoord = getInTexCoord("texCoord", "float2", true, componentList);
|
||||
Var *texCoord = getInTexCoord("texCoord", "float2", componentList);
|
||||
|
||||
Var *bumpMap = getNormalMapTex();
|
||||
|
||||
|
|
@ -392,13 +362,8 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
bumpSample->setName("bumpSample");
|
||||
LangElement *bumpSampleDecl = new DecOp(bumpSample);
|
||||
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
Var *bumpMapTex = (Var *)LangElement::find("bumpMapTex");
|
||||
output = new GenOp(" @ = @.Sample(@, @);\r\n", bumpSampleDecl, bumpMapTex, bumpMap, texCoord);
|
||||
}
|
||||
else
|
||||
output = new GenOp(" @ = tex2D(@, @);\r\n", bumpSampleDecl, bumpMap, texCoord);
|
||||
Var *bumpMapTex = (Var *)LangElement::find("bumpMapTex");
|
||||
output = new GenOp(" @ = @.Sample(@, @);\r\n", bumpSampleDecl, bumpMapTex, bumpMap, texCoord);
|
||||
|
||||
if ( fd.features.hasFeature( MFT_DetailNormalMap ) )
|
||||
{
|
||||
|
|
@ -414,7 +379,7 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
}
|
||||
|
||||
Var* bumpMapTex = (Var*)LangElement::find("detailBumpMap");
|
||||
if (mIsDirect3D11 && !bumpMapTex)
|
||||
if (!bumpMapTex)
|
||||
{
|
||||
bumpMap->setType("SamplerState");
|
||||
bumpMapTex = new Var;
|
||||
|
|
@ -425,12 +390,8 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
bumpMapTex->constNum = bumpMap->constNum;
|
||||
}
|
||||
|
||||
texCoord = getInTexCoord( "detCoord", "float2", true, componentList );
|
||||
LangElement *texOp = NULL;
|
||||
if (mIsDirect3D11)
|
||||
texOp = new GenOp("@.Sample(@, @)", bumpMap, bumpMapTex, texCoord);
|
||||
else
|
||||
texOp = new GenOp( "tex2D(@, @)", bumpMap, texCoord );
|
||||
texCoord = getInTexCoord( "detCoord", "float2", componentList );
|
||||
LangElement *texOp = new GenOp("@.Sample(@, @)", bumpMap, bumpMapTex, texCoord);
|
||||
|
||||
Var *detailBump = new Var;
|
||||
detailBump->setName( "detailBump" );
|
||||
|
|
@ -462,7 +423,7 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
Var *bumpSample = (Var *)LangElement::find( "bumpSample" );
|
||||
if( bumpSample == NULL )
|
||||
{
|
||||
Var *texCoord = getInTexCoord( "texCoord", "float2", true, componentList );
|
||||
Var *texCoord = getInTexCoord( "texCoord", "float2", componentList );
|
||||
|
||||
Var *bumpMap = getNormalMapTex();
|
||||
|
||||
|
|
@ -471,13 +432,8 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
bumpSample->setName( "bumpSample" );
|
||||
LangElement *bumpSampleDecl = new DecOp( bumpSample );
|
||||
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
Var *bumpMapTex = (Var *)LangElement::find("bumpMapTex");
|
||||
output = new GenOp(" @ = @.Sample(@, @);\r\n", bumpSampleDecl, bumpMapTex, bumpMap, texCoord);
|
||||
}
|
||||
else
|
||||
output = new GenOp(" @ = tex2D(@, @);\r\n", bumpSampleDecl, bumpMap, texCoord);
|
||||
Var *bumpMapTex = (Var *)LangElement::find("bumpMapTex");
|
||||
output = new GenOp(" @ = @.Sample(@, @);\r\n", bumpSampleDecl, bumpMapTex, bumpMap, texCoord);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -742,23 +698,18 @@ void DeferredMinnaertHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
|
||||
// create texture var
|
||||
Var *deferredBuffer = new Var;
|
||||
deferredBuffer->setType( "sampler2D" );
|
||||
deferredBuffer->setType( "SamplerState" );
|
||||
deferredBuffer->setName( "deferredBuffer" );
|
||||
deferredBuffer->uniform = true;
|
||||
deferredBuffer->sampler = true;
|
||||
deferredBuffer->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var* prePassTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
deferredBuffer->setType("SamplerState");
|
||||
prePassTex = new Var;
|
||||
prePassTex->setName("prePassTex");
|
||||
prePassTex->setType("Texture2D");
|
||||
prePassTex->uniform = true;
|
||||
prePassTex->texture = true;
|
||||
prePassTex->constNum = deferredBuffer->constNum;
|
||||
}
|
||||
Var* prePassTex = new Var;
|
||||
prePassTex->setName("prePassTex");
|
||||
prePassTex->setType("Texture2D");
|
||||
prePassTex->uniform = true;
|
||||
prePassTex->texture = true;
|
||||
prePassTex->constNum = deferredBuffer->constNum;
|
||||
|
||||
// Texture coord
|
||||
Var *uvScene = (Var*) LangElement::find( "uvScene" );
|
||||
|
|
@ -773,10 +724,7 @@ void DeferredMinnaertHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
|
||||
Var *d_NL_Att = (Var*)LangElement::find( "d_NL_Att" );
|
||||
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(avar(" float4 normalDepth = %s(@, ,@, @);\r\n", unconditionDeferredMethod.c_str()), deferredBuffer, prePassTex, uvScene));
|
||||
else
|
||||
meta->addStatement(new GenOp(avar(" float4 normalDepth = %s(@, @);\r\n", unconditionDeferredMethod.c_str()), deferredBuffer, uvScene));
|
||||
meta->addStatement(new GenOp(avar(" float4 normalDepth = %s(@, ,@, @);\r\n", unconditionDeferredMethod.c_str()), deferredBuffer, prePassTex, uvScene));
|
||||
|
||||
meta->addStatement( new GenOp( " float vDotN = dot(normalDepth.xyz, @);\r\n", wsViewVec ) );
|
||||
meta->addStatement( new GenOp( " float Minnaert = pow( @, @) * pow(vDotN, 1.0 - @);\r\n", d_NL_Att, minnaertConstant, minnaertConstant ) );
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
void DeferredSpecMapHLSL::processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
|
||||
{
|
||||
// Get the texture coord.
|
||||
Var *texCoord = getInTexCoord( "texCoord", "float2", true, componentList );
|
||||
Var *texCoord = getInTexCoord( "texCoord", "float2", componentList );
|
||||
|
||||
// search for color var
|
||||
Var *material = (Var*) LangElement::find( getOutputTargetVarName(ShaderFeature::RenderTarget2) );
|
||||
|
|
@ -57,23 +57,18 @@ void DeferredSpecMapHLSL::processPix( Vector<ShaderComponent*> &componentList, c
|
|||
|
||||
// create texture var
|
||||
Var *specularMap = new Var;
|
||||
specularMap->setType( "sampler2D" );
|
||||
specularMap->setType( "SamplerState" );
|
||||
specularMap->setName( "specularMap" );
|
||||
specularMap->uniform = true;
|
||||
specularMap->sampler = true;
|
||||
specularMap->constNum = Var::getTexUnitNum();
|
||||
|
||||
Var* specularMapTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
specularMap->setType("SamplerState");
|
||||
specularMapTex = new Var;
|
||||
specularMapTex->setName("specularMapTex");
|
||||
specularMapTex->setType("Texture2D");
|
||||
specularMapTex->uniform = true;
|
||||
specularMapTex->texture = true;
|
||||
specularMapTex->constNum = specularMap->constNum;
|
||||
}
|
||||
Var* specularMapTex = new Var;
|
||||
specularMapTex->setName("specularMapTex");
|
||||
specularMapTex->setType("Texture2D");
|
||||
specularMapTex->uniform = true;
|
||||
specularMapTex->texture = true;
|
||||
specularMapTex->constNum = specularMap->constNum;
|
||||
|
||||
//matinfo.g slot reserved for AO later
|
||||
Var* specColor = new Var;
|
||||
|
|
@ -83,10 +78,7 @@ void DeferredSpecMapHLSL::processPix( Vector<ShaderComponent*> &componentList, c
|
|||
|
||||
meta->addStatement(new GenOp(" @.g = 1.0;\r\n", material));
|
||||
//sample specular map
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(" @ = @.Sample(@, @);\r\n", specColorElem, specularMapTex, specularMap, texCoord));
|
||||
else
|
||||
meta->addStatement(new GenOp(" @ = tex2D(@, @);\r\n", specColorElem, specularMap, texCoord));
|
||||
meta->addStatement(new GenOp(" @ = @.Sample(@, @);\r\n", specColorElem, specularMapTex, specularMap, texCoord));
|
||||
|
||||
meta->addStatement(new GenOp(" @.b = dot(@.rgb, float3(0.3, 0.59, 0.11));\r\n", material, specColor));
|
||||
meta->addStatement(new GenOp(" @.a = @.a;\r\n", material, specColor));
|
||||
|
|
@ -123,7 +115,6 @@ void DeferredSpecMapHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
MultiLine *meta = new MultiLine;
|
||||
getOutTexCoord( "texCoord",
|
||||
"float2",
|
||||
true,
|
||||
fd.features[MFT_TexAnim],
|
||||
meta,
|
||||
componentList );
|
||||
|
|
|
|||
|
|
@ -145,7 +145,6 @@ void GBufferConditionerHLSL::processPix( Vector<ShaderComponent*> &componentLis
|
|||
gbNormal->setName( "gbNormal" );
|
||||
gbNormal->setStructName( "IN" );
|
||||
gbNormal->setType( "float3" );
|
||||
gbNormal->mapsToSampler = false;
|
||||
gbNormal->uniform = false;
|
||||
}
|
||||
|
||||
|
|
@ -222,7 +221,6 @@ Var* GBufferConditionerHLSL::printMethodHeader( MethodType methodType, const Str
|
|||
retVal = Parent::printMethodHeader( methodType, methodName, stream, meta );
|
||||
else
|
||||
{
|
||||
const bool isDirect3D11 = GFX->getAdapterType() == Direct3D11;
|
||||
Var *methodVar = new Var;
|
||||
methodVar->setName(methodName);
|
||||
methodVar->setType("inline float4");
|
||||
|
|
@ -230,7 +228,7 @@ Var* GBufferConditionerHLSL::printMethodHeader( MethodType methodType, const Str
|
|||
|
||||
Var *deferredSampler = new Var;
|
||||
deferredSampler->setName("deferredSamplerVar");
|
||||
deferredSampler->setType("sampler2D");
|
||||
deferredSampler->setType("SamplerState");
|
||||
DecOp *deferredSamplerDecl = new DecOp(deferredSampler);
|
||||
|
||||
Var *screenUV = new Var;
|
||||
|
|
@ -238,28 +236,21 @@ Var* GBufferConditionerHLSL::printMethodHeader( MethodType methodType, const Str
|
|||
screenUV->setType("float2");
|
||||
DecOp *screenUVDecl = new DecOp(screenUV);
|
||||
|
||||
Var *deferredTex = NULL;
|
||||
DecOp *deferredTexDecl = NULL;
|
||||
if (isDirect3D11)
|
||||
{
|
||||
deferredSampler->setType("SamplerState");
|
||||
deferredTex = new Var;
|
||||
deferredTex->setName("deferredTexVar");
|
||||
deferredTex->setType("Texture2D");
|
||||
deferredTex->texture = true;
|
||||
deferredTex->constNum = deferredSampler->constNum;
|
||||
deferredTexDecl = new DecOp(deferredTex);
|
||||
}
|
||||
|
||||
Var *deferredTex = new Var;
|
||||
deferredTex->setName("deferredTexVar");
|
||||
deferredTex->setType("Texture2D");
|
||||
deferredTex->texture = true;
|
||||
deferredTex->constNum = deferredSampler->constNum;
|
||||
deferredTexDecl = new DecOp(deferredTex);
|
||||
|
||||
Var *bufferSample = new Var;
|
||||
bufferSample->setName("bufferSample");
|
||||
bufferSample->setType("float4");
|
||||
DecOp *bufferSampleDecl = new DecOp(bufferSample);
|
||||
|
||||
if (isDirect3D11)
|
||||
meta->addStatement(new GenOp("@(@, @, @)\r\n", methodDecl, deferredSamplerDecl, deferredTexDecl, screenUVDecl));
|
||||
else
|
||||
meta->addStatement( new GenOp( "@(@, @)\r\n", methodDecl, deferredSamplerDecl, screenUVDecl ) );
|
||||
meta->addStatement(new GenOp("@(@, @, @)\r\n", methodDecl, deferredSamplerDecl, deferredTexDecl, screenUVDecl));
|
||||
|
||||
meta->addStatement( new GenOp( "{\r\n" ) );
|
||||
|
||||
|
|
@ -267,15 +258,7 @@ Var* GBufferConditionerHLSL::printMethodHeader( MethodType methodType, const Str
|
|||
|
||||
// The gbuffer has no mipmaps, so use tex2dlod when
|
||||
// possible so that the shader compiler can optimize.
|
||||
meta->addStatement( new GenOp( " #if TORQUE_SM >= 30\r\n" ) );
|
||||
if (isDirect3D11)
|
||||
meta->addStatement(new GenOp(" @ = @.SampleLevel(@, @,0);\r\n", bufferSampleDecl, deferredTex, deferredSampler, screenUV));
|
||||
else
|
||||
meta->addStatement(new GenOp(" @ = tex2Dlod(@, float4(@,0,0));\r\n", bufferSampleDecl, deferredSampler, screenUV));
|
||||
|
||||
meta->addStatement(new GenOp(" #else\r\n"));
|
||||
meta->addStatement(new GenOp(" @ = tex2D(@, @);\r\n", bufferSampleDecl, deferredSampler, screenUV));
|
||||
meta->addStatement(new GenOp(" #endif\r\n\r\n"));
|
||||
meta->addStatement(new GenOp(" @ = @.SampleLevel(@, @,0);\r\n", bufferSampleDecl, deferredTex, deferredSampler, screenUV));
|
||||
|
||||
// We don't use this way of passing var's around, so this should cause a crash
|
||||
// if something uses this improperly
|
||||
|
|
|
|||
|
|
@ -185,12 +185,12 @@ void BasicLightManager::activate( SceneManager *sceneManager )
|
|||
FEATUREMGR->unregisterFeature( MFT_SubSurface );
|
||||
|
||||
// First look for the deferred bin...
|
||||
RenderDeferredMgr *prePassBin = _findDeferredRenderBin();
|
||||
RenderDeferredMgr *deferredBin = _findDeferredRenderBin();
|
||||
|
||||
/*
|
||||
// If you would like to use forward shading, and have a linear depth pre-pass
|
||||
// than un-comment this code block.
|
||||
if ( !prePassBin )
|
||||
if ( !deferredBin )
|
||||
{
|
||||
Vector<GFXFormat> formats;
|
||||
formats.push_back( GFXFormatR32F );
|
||||
|
|
@ -204,12 +204,12 @@ void BasicLightManager::activate( SceneManager *sceneManager )
|
|||
// Uncomment this for a no-color-write z-fill pass.
|
||||
//linearDepthFormat = GFXFormat_COUNT;
|
||||
|
||||
prePassBin = new RenderDeferredMgr( linearDepthFormat != GFXFormat_COUNT, linearDepthFormat );
|
||||
prePassBin->registerObject();
|
||||
rpm->addManager( prePassBin );
|
||||
deferredBin = new RenderDeferredMgr( linearDepthFormat != GFXFormat_COUNT, linearDepthFormat );
|
||||
deferredBin->registerObject();
|
||||
rpm->addManager( deferredBin );
|
||||
}
|
||||
*/
|
||||
mDeferredRenderBin = prePassBin;
|
||||
mDeferredRenderBin = deferredBin;
|
||||
|
||||
// If there is a deferred bin
|
||||
MATMGR->setDeferredEnabled( mDeferredRenderBin.isValid() );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue