add material tileScale

by request
This commit is contained in:
AzaezelX 2025-12-25 19:52:06 -06:00
parent 0fb68936f9
commit c0ce94f32a
8 changed files with 32 additions and 9 deletions

View file

@ -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");

View file

@ -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];

View file

@ -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]);

View file

@ -45,6 +45,7 @@ class ShaderConstHandles
public:
GFXShaderConstHandle* mDiffuseColorSC;
GFXShaderConstHandle* mToneMapTexSC;
GFXShaderConstHandle* mTileScaleSC;
GFXShaderConstHandle* mTexMatSC;
GFXShaderConstHandle* mORMConfigSC;
GFXShaderConstHandle* mRoughnessSC;