mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-28 15:55:39 +00:00
add material tileScale
by request
This commit is contained in:
parent
0fb68936f9
commit
c0ce94f32a
8 changed files with 32 additions and 9 deletions
|
|
@ -364,6 +364,13 @@ Var* ShaderFeatureGLSL::getOutTexCoord( const char *name,
|
|||
texCoord->setStructName( "OUT" );
|
||||
texCoord->setType( type );
|
||||
|
||||
// create detail variable
|
||||
Var* tileScale = new Var;
|
||||
tileScale->setType("vec2");
|
||||
tileScale->setName("tileScale");
|
||||
tileScale->uniform = true;
|
||||
tileScale->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
if( useTexAnim )
|
||||
{
|
||||
inTex->setType( "vec4" );
|
||||
|
|
@ -377,15 +384,15 @@ Var* ShaderFeatureGLSL::getOutTexCoord( const char *name,
|
|||
|
||||
// Statement allows for casting of different types which
|
||||
// eliminates vector truncation problems.
|
||||
String statement = String::ToString( " @ = %s(tMul(@, @).xy);\r\n", type );
|
||||
meta->addStatement( new GenOp( statement , texCoord, texMat, inTex ) );
|
||||
String statement = String::ToString( " @ = %s(tMul(@, @).xy * @);\r\n", type );
|
||||
meta->addStatement( new GenOp( statement , texCoord, texMat, inTex, tileScale) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Statement allows for casting of different types which
|
||||
// eliminates vector truncation problems.
|
||||
String statement = String::ToString( " @ = %s(@);\r\n", type );
|
||||
meta->addStatement( new GenOp( statement, texCoord, inTex ) );
|
||||
String statement = String::ToString( " @ = %s(@ * @);\r\n", type );
|
||||
meta->addStatement( new GenOp( statement, texCoord, inTex, tileScale) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -364,6 +364,13 @@ Var* ShaderFeatureHLSL::getOutTexCoord( const char *name,
|
|||
texCoord->setStructName( "OUT" );
|
||||
texCoord->setType( type );
|
||||
|
||||
// create detail variable
|
||||
Var* tileScale = new Var;
|
||||
tileScale->setType("float2");
|
||||
tileScale->setName("tileScale");
|
||||
tileScale->uniform = true;
|
||||
tileScale->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
if ( useTexAnim )
|
||||
{
|
||||
inTex->setType( "float2" );
|
||||
|
|
@ -377,15 +384,15 @@ Var* ShaderFeatureHLSL::getOutTexCoord( const char *name,
|
|||
|
||||
// Statement allows for casting of different types which
|
||||
// eliminates vector truncation problems.
|
||||
String statement = String::ToString(" @ = (%s)mul(@, float4(@,1,1));\r\n", type);
|
||||
meta->addStatement( new GenOp( statement, texCoord, texMat, inTex ) );
|
||||
String statement = String::ToString(" @ = (%s)mul(@, float4(@,1,1))*@;\r\n", type);
|
||||
meta->addStatement( new GenOp( statement, texCoord, texMat, inTex, tileScale) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Statement allows for casting of different types which
|
||||
// eliminates vector truncation problems.
|
||||
String statement = String::ToString( " @ = (%s)@;\r\n", type );
|
||||
meta->addStatement( new GenOp( statement, texCoord, inTex ) );
|
||||
String statement = String::ToString( " @ = (%s)(@ * @);\r\n", type );
|
||||
meta->addStatement( new GenOp( statement, texCoord, inTex, tileScale) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ const String ShaderGenVars::fogColor("$fogColor");
|
|||
const String ShaderGenVars::detailScale("$detailScale");
|
||||
const String ShaderGenVars::visibility("$visibility");
|
||||
const String ShaderGenVars::colorMultiply("$colorMultiply");
|
||||
const String ShaderGenVars::tileScale("$tileScale");
|
||||
const String ShaderGenVars::alphaTestValue("$alphaTestValue");
|
||||
const String ShaderGenVars::texMat("$texMat");
|
||||
const String ShaderGenVars::accumTime("$accumTime");
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ struct ShaderGenVars
|
|||
const static String detailScale;
|
||||
const static String visibility;
|
||||
const static String colorMultiply;
|
||||
const static String tileScale;
|
||||
const static String alphaTestValue;
|
||||
const static String texMat;
|
||||
const static String accumTime;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue