mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-21 12:25:30 +00:00
Direct3D11 Engine/source changes
This commit is contained in:
parent
3a9b50f702
commit
41e5caf22b
81 changed files with 1291 additions and 617 deletions
|
|
@ -70,6 +70,13 @@ void BumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
Var *bumpMap = getNormalMapTex();
|
||||
LangElement *texOp = NULL;
|
||||
|
||||
//if it's D3D11 let's create the texture object
|
||||
Var* bumpMapTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
bumpMapTex = (Var*)LangElement::find("bumpMapTex");
|
||||
}
|
||||
|
||||
// Handle atlased textures
|
||||
// http://www.infinity-universe.com/Infinity/index.php?option=com_content&task=view&id=65&Itemid=47
|
||||
if(fd.features[MFT_NormalMapAtlas])
|
||||
|
|
@ -127,18 +134,25 @@ void BumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
// Add a newline
|
||||
meta->addStatement( new GenOp( "\r\n" ) );
|
||||
|
||||
if(is_sm3)
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
texOp = new GenOp( "tex2Dlod(@, float4(@, 0.0, mipLod_bump))", bumpMap, texCoord );
|
||||
texOp = new GenOp("@.SampleLevel(@, @, mipLod_bump)", bumpMapTex, bumpMap, texCoord);
|
||||
}
|
||||
else if (is_sm3)
|
||||
{
|
||||
texOp = new GenOp("tex2Dlod(@, float4(@, 0.0, mipLod_bump))", bumpMap, texCoord);
|
||||
}
|
||||
else
|
||||
{
|
||||
texOp = new GenOp( "tex2D(@, @)", bumpMap, texCoord );
|
||||
texOp = new GenOp("tex2D(@, @)", bumpMap, texCoord);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
texOp = new GenOp( "tex2D(@, @)", bumpMap, texCoord );
|
||||
if (mIsDirect3D11)
|
||||
texOp = new GenOp("@.Sample(@, @)", bumpMapTex, bumpMap, texCoord);
|
||||
else
|
||||
texOp = new GenOp("tex2D(@, @)", bumpMap, texCoord);
|
||||
}
|
||||
|
||||
Var *bumpNorm = new Var( "bumpNormal", "float4" );
|
||||
|
|
@ -156,8 +170,26 @@ void BumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
bumpMap->sampler = true;
|
||||
bumpMap->constNum = Var::getTexUnitNum();
|
||||
|
||||
Var* detailBumpTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
bumpMap->setType("SamplerState");
|
||||
detailBumpTex = new Var;
|
||||
detailBumpTex->setName("detailBumpTex");
|
||||
detailBumpTex->setType("Texture2D");
|
||||
detailBumpTex->uniform = true;
|
||||
detailBumpTex->texture = true;
|
||||
detailBumpTex->constNum = bumpMap->constNum;
|
||||
}
|
||||
else
|
||||
bumpMap->setType("sampler2D");
|
||||
|
||||
texCoord = getInTexCoord( "detCoord", "float2", true, componentList );
|
||||
texOp = new GenOp( "tex2D(@, @)", bumpMap, texCoord );
|
||||
|
||||
if (mIsDirect3D11)
|
||||
texOp = new GenOp("@.Sample(@, @)", detailBumpTex, bumpMap, texCoord);
|
||||
else
|
||||
texOp = new GenOp("tex2D(@, @)", bumpMap, texCoord);
|
||||
|
||||
Var *detailBump = new Var;
|
||||
detailBump->setName( "detailBump" );
|
||||
|
|
@ -345,17 +377,26 @@ void ParallaxFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
// Get the rest of our inputs.
|
||||
Var *parallaxInfo = _getUniformVar( "parallaxInfo", "float", cspPotentialPrimitive );
|
||||
Var *normalMap = getNormalMapTex();
|
||||
Var *bumpMapTexture = (Var*)LangElement::find("bumpMapTex");
|
||||
|
||||
// Call the library function to do the rest.
|
||||
if(fd.features.hasFeature( MFT_IsDXTnm, getProcessIndex() ))
|
||||
if (fd.features.hasFeature(MFT_IsDXTnm, getProcessIndex()))
|
||||
{
|
||||
meta->addStatement( new GenOp( " @.xy += parallaxOffsetDxtnm( @, @.xy, @, @ );\r\n",
|
||||
texCoord, normalMap, texCoord, negViewTS, parallaxInfo ) );
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(" @.xy += parallaxOffsetDxtnm( @, @, @.xy, @, @ );\r\n",
|
||||
texCoord, bumpMapTexture, normalMap, texCoord, negViewTS, parallaxInfo));
|
||||
else
|
||||
meta->addStatement(new GenOp(" @.xy += parallaxOffsetDxtnm( @, @.xy, @, @ );\r\n",
|
||||
texCoord, normalMap, texCoord, negViewTS, parallaxInfo));
|
||||
}
|
||||
else
|
||||
{
|
||||
meta->addStatement( new GenOp( " @.xy += parallaxOffset( @, @.xy, @, @ );\r\n",
|
||||
texCoord, normalMap, texCoord, negViewTS, parallaxInfo ) );
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(" @.xy += parallaxOffset( @, @, @.xy, @, @ );\r\n",
|
||||
texCoord, bumpMapTexture, normalMap, texCoord, negViewTS, parallaxInfo));
|
||||
else
|
||||
meta->addStatement(new GenOp(" @.xy += parallaxOffset( @, @.xy, @, @ );\r\n",
|
||||
texCoord, normalMap, texCoord, negViewTS, parallaxInfo));
|
||||
}
|
||||
|
||||
// TODO: Fix second UV maybe?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue