mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +00:00
augment imageasset with initMapSlot and bindMap class insert macros (and array variants) to make the conversion process for folks shifting from 3.x to 4.x cleaner, as well as autocreation of getter/setter methods andadditoinal acessor macros for consistency
This commit is contained in:
parent
e93fc3ab7c
commit
22b0785c73
5 changed files with 90 additions and 86 deletions
|
|
@ -97,9 +97,6 @@ ImplementEnumType( MaterialWaveType,
|
|||
{ Material::Square, "Square", "Warps the material along a wave which transitions between two oppposite states. As a Square Wave, the transition is quick and sudden." },
|
||||
EndImplementEnumType;
|
||||
|
||||
#define initMapSlot(name,id) m##name##Filename[id] = String::EmptyString; m##name##AssetId[id] = StringTable->EmptyString(); m##name##Asset[id] = NULL;
|
||||
#define bindMapSlot(name,id) if (m##name##AssetId[id] != String::EmptyString) m##name##Asset[id] = m##name##AssetId[id];
|
||||
|
||||
bool Material::sAllowTextureTargetAssignment = false;
|
||||
|
||||
GFXCubemap * Material::GetNormalizeCube()
|
||||
|
|
@ -138,18 +135,18 @@ Material::Material()
|
|||
mAccuCoverage[i] = 0.9f;
|
||||
mAccuSpecular[i] = 16.0f;
|
||||
|
||||
initMapSlot(DiffuseMap, i);
|
||||
initMapSlot(OverlayMap, i);
|
||||
initMapSlot(LightMap, i);
|
||||
initMapSlot(ToneMap, i);
|
||||
initMapSlot(DetailMap, i);
|
||||
initMapSlot(NormalMap, i);
|
||||
initMapSlot(PBRConfigMap, i);
|
||||
initMapSlot(RoughMap, i);
|
||||
initMapSlot(AOMap, i);
|
||||
initMapSlot(MetalMap, i);
|
||||
initMapSlot(GlowMap, i);
|
||||
initMapSlot(DetailNormalMap, i);
|
||||
initMapArraySlot(DiffuseMap, i);
|
||||
initMapArraySlot(OverlayMap, i);
|
||||
initMapArraySlot(LightMap, i);
|
||||
initMapArraySlot(ToneMap, i);
|
||||
initMapArraySlot(DetailMap, i);
|
||||
initMapArraySlot(NormalMap, i);
|
||||
initMapArraySlot(ORMConfigMap, i);
|
||||
initMapArraySlot(RoughMap, i);
|
||||
initMapArraySlot(AOMap, i);
|
||||
initMapArraySlot(MetalMap, i);
|
||||
initMapArraySlot(GlowMap, i);
|
||||
initMapArraySlot(DetailNormalMap, i);
|
||||
|
||||
mParallaxScale[i] = 0.0f;
|
||||
|
||||
|
|
@ -246,18 +243,18 @@ void Material::initPersistFields()
|
|||
"This color is multiplied against the diffuse texture color. If no diffuse texture "
|
||||
"is present this is the material color." );
|
||||
|
||||
scriptBindMapArraySlot(DiffuseMap, MAX_STAGES, Material);
|
||||
scriptBindMapArraySlot(OverlayMap, MAX_STAGES, Material);
|
||||
scriptBindMapArraySlot(LightMap, MAX_STAGES, Material);
|
||||
scriptBindMapArraySlot(ToneMap, MAX_STAGES, Material);
|
||||
scriptBindMapArraySlot(DetailMap, MAX_STAGES, Material);
|
||||
scriptBindMapArraySlot(NormalMap, MAX_STAGES, Material);
|
||||
scriptBindMapArraySlot(PBRConfigMap, MAX_STAGES, Material);
|
||||
scriptBindMapArraySlot(RoughMap, MAX_STAGES, Material);
|
||||
scriptBindMapArraySlot(AOMap, MAX_STAGES, Material);
|
||||
scriptBindMapArraySlot(MetalMap, MAX_STAGES, Material);
|
||||
scriptBindMapArraySlot(GlowMap, MAX_STAGES, Material);
|
||||
scriptBindMapArraySlot(DetailNormalMap, MAX_STAGES, Material);
|
||||
scriptBindMapArraySlot(DiffuseMap, MAX_STAGES, Material, "Albedo");
|
||||
scriptBindMapArraySlot(OverlayMap, MAX_STAGES, Material, "Overlay");
|
||||
scriptBindMapArraySlot(LightMap, MAX_STAGES, Material, "LightMap");
|
||||
scriptBindMapArraySlot(ToneMap, MAX_STAGES, Material, "ToneMap");
|
||||
scriptBindMapArraySlot(DetailMap, MAX_STAGES, Material, "DetailMap");
|
||||
scriptBindMapArraySlot(NormalMap, MAX_STAGES, Material, "NormalMap");
|
||||
scriptBindMapArraySlot(ORMConfigMap, MAX_STAGES, Material, "AO|Roughness|metalness map");
|
||||
scriptBindMapArraySlot(RoughMap, MAX_STAGES, Material, "RoughMap (also needs MetalMap)");
|
||||
scriptBindMapArraySlot(AOMap, MAX_STAGES, Material, "AOMap");
|
||||
scriptBindMapArraySlot(MetalMap, MAX_STAGES, Material, "MetalMap (also needs RoughMap)");
|
||||
scriptBindMapArraySlot(GlowMap, MAX_STAGES, Material, "GlowMap (needs Albedo)");
|
||||
scriptBindMapArraySlot(DetailNormalMap, MAX_STAGES, Material, "DetailNormalMap");
|
||||
|
||||
addField("diffuseMapSRGB", TypeBool, Offset(mDiffuseMapSRGB, Material), MAX_STAGES,
|
||||
"Enable sRGB for the diffuse color texture map.");
|
||||
|
|
@ -543,29 +540,20 @@ bool Material::onAdd()
|
|||
if ( slash != String::NPos )
|
||||
mPath = scriptFile.substr( 0, slash + 1 );
|
||||
|
||||
/*
|
||||
//bind any assets we have
|
||||
for (U32 i = 0; i < MAX_STAGES; i++)
|
||||
{
|
||||
if (mDiffuseMapAssetId[i] != StringTable->EmptyString())
|
||||
{
|
||||
mDiffuseMapAsset[0] = mDiffuseMapAssetId[0];
|
||||
}
|
||||
}
|
||||
*/
|
||||
for (U32 i = 0; i < MAX_STAGES; i++)
|
||||
{
|
||||
bindMapSlot(DiffuseMap, i);
|
||||
bindMapSlot(OverlayMap, i);
|
||||
bindMapSlot(LightMap, i);
|
||||
bindMapSlot(ToneMap, i);
|
||||
bindMapSlot(DetailMap, i);
|
||||
bindMapSlot(PBRConfigMap, i);
|
||||
bindMapSlot(RoughMap, i);
|
||||
bindMapSlot(AOMap, i);
|
||||
bindMapSlot(MetalMap, i);
|
||||
bindMapSlot(GlowMap, i);
|
||||
bindMapSlot(DetailNormalMap, i);
|
||||
bindMapArraySlot(DiffuseMap, i);
|
||||
bindMapArraySlot(OverlayMap, i);
|
||||
bindMapArraySlot(LightMap, i);
|
||||
bindMapArraySlot(ToneMap, i);
|
||||
bindMapArraySlot(DetailMap, i);
|
||||
bindMapArraySlot(ORMConfigMap, i);
|
||||
bindMapArraySlot(RoughMap, i);
|
||||
bindMapArraySlot(AOMap, i);
|
||||
bindMapArraySlot(MetalMap, i);
|
||||
bindMapArraySlot(GlowMap, i);
|
||||
bindMapArraySlot(DetailNormalMap, i);
|
||||
}
|
||||
|
||||
_mapMaterial();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue