mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 12:14:45 +00:00
Merge pull request #1639 from Azaezel/alpha41/matTileScale
Some checks failed
MacOSX Build / ${{matrix.config.name}} (map[build_type:Release cc:clang cxx:clang++ generator:Ninja name:MacOSX Latest Clang]) (push) Has been cancelled
Linux Build / ${{matrix.config.name}} (map[build_type:Release cc:gcc cxx:g++ generator:Ninja name:Ubuntu Latest GCC]) (push) Has been cancelled
Windows Build / ${{matrix.config.name}} (map[build_type:Release cc:cl cxx:cl environment_script:C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat generator:Visual Studio 17 2022 name:Windows Latest MSVC]) (push) Has been cancelled
Some checks failed
MacOSX Build / ${{matrix.config.name}} (map[build_type:Release cc:clang cxx:clang++ generator:Ninja name:MacOSX Latest Clang]) (push) Has been cancelled
Linux Build / ${{matrix.config.name}} (map[build_type:Release cc:gcc cxx:g++ generator:Ninja name:Ubuntu Latest GCC]) (push) Has been cancelled
Windows Build / ${{matrix.config.name}} (map[build_type:Release cc:cl cxx:cl environment_script:C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat generator:Visual Studio 17 2022 name:Windows Latest MSVC]) (push) Has been cancelled
add material tileScale
This commit is contained in:
commit
5246202357
|
|
@ -158,7 +158,7 @@ Material::Material()
|
|||
mIgnoreLighting[i] = false;
|
||||
|
||||
mDetailScale[i].set(2.0f, 2.0f);
|
||||
|
||||
mTileScale[i].set(1.0f, 1.0f);
|
||||
mDetailNormalMapStrength[i] = 1.0f;
|
||||
|
||||
mMinnaertConstant[i] = -1.0f;
|
||||
|
|
@ -257,6 +257,8 @@ void Material::initPersistFields()
|
|||
"is present this is the material color.");
|
||||
addField("diffuseMapSRGB", TypeBool, Offset(mDiffuseMapSRGB, Material), MAX_STAGES,
|
||||
"Enable sRGB for the diffuse color texture map.");
|
||||
addField("TileScale", TypePoint2F, Offset(mTileScale, Material), MAX_STAGES,
|
||||
"The scale factor for the detail map.");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(NormalMap, MAX_STAGES, Material, "NormalMap");
|
||||
endGroup("Basic Texture Maps");
|
||||
|
|
|
|||
|
|
@ -270,6 +270,7 @@ public:
|
|||
/// The repetition scale of the detail texture
|
||||
/// over the base texture.
|
||||
Point2F mDetailScale[MAX_STAGES];
|
||||
Point2F mTileScale[MAX_STAGES];
|
||||
|
||||
U32 mAnimFlags[MAX_STAGES];
|
||||
Point2F mScrollDir[MAX_STAGES];
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@
|
|||
void ShaderConstHandles::init( GFXShader *shader, CustomMaterial* mat /*=NULL*/)
|
||||
{
|
||||
mDiffuseColorSC = shader->getShaderConstHandle("$diffuseMaterialColor");
|
||||
mTileScaleSC = shader->getShaderConstHandle(ShaderGenVars::tileScale);
|
||||
mTexMatSC = shader->getShaderConstHandle(ShaderGenVars::texMat);
|
||||
mToneMapTexSC = shader->getShaderConstHandle(ShaderGenVars::toneMap);
|
||||
mORMConfigSC = shader->getShaderConstHandle(ShaderGenVars::ormConfig);
|
||||
|
|
@ -1142,6 +1143,8 @@ void ProcessedShaderMaterial::_setShaderConstants(SceneRenderState * state, cons
|
|||
shaderConsts->set( handles->mOneOverRTSizeSC, oneOverTargetSize );
|
||||
}
|
||||
|
||||
shaderConsts->setSafe(handles->mTileScaleSC, mMaterial->mTileScale[stageNum]);
|
||||
|
||||
// set detail scale
|
||||
shaderConsts->setSafe(handles->mDetailScaleSC, mMaterial->mDetailScale[stageNum]);
|
||||
shaderConsts->setSafe(handles->mDetailBumpStrength, mMaterial->mDetailNormalMapStrength[stageNum]);
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ class ShaderConstHandles
|
|||
public:
|
||||
GFXShaderConstHandle* mDiffuseColorSC;
|
||||
GFXShaderConstHandle* mToneMapTexSC;
|
||||
GFXShaderConstHandle* mTileScaleSC;
|
||||
GFXShaderConstHandle* mTexMatSC;
|
||||
GFXShaderConstHandle* mORMConfigSC;
|
||||
GFXShaderConstHandle* mRoughnessSC;
|
||||
|
|
|
|||
|
|
@ -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…
Reference in a new issue