mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 11:43:49 +00:00
fill in the validated variables
This commit is contained in:
parent
fa760fa746
commit
f633ef3a3d
184 changed files with 1359 additions and 1216 deletions
|
|
@ -38,6 +38,7 @@
|
|||
#include "T3D/accumulationVolume.h"
|
||||
#include "gui/controls/guiTreeViewCtrl.h"
|
||||
#include <console/persistenceManager.h>
|
||||
#include "console/typeValidators.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT(Material);
|
||||
|
||||
|
|
@ -239,6 +240,11 @@ Material::Material()
|
|||
mReverbSoundOcclusion = 1.0;
|
||||
}
|
||||
|
||||
IRangeValidator bmpChanRange(0, 3);
|
||||
FRangeValidator glowMulRange(0.0f, 20.0f);
|
||||
FRangeValidator parallaxScaleRange(0.0f, 4.0f);
|
||||
FRangeValidator scrollSpeedRange(0.0f, 10.0f);
|
||||
FRangeValidator waveFreqRange(0.0f, 10.0f);
|
||||
void Material::onImageAssetChanged()
|
||||
{
|
||||
flush();
|
||||
|
|
@ -265,32 +271,31 @@ void Material::initPersistFields()
|
|||
endGroup("Basic Texture Maps");
|
||||
|
||||
addGroup("Light Influence Maps");
|
||||
addField("roughness", TypeF32, Offset(mRoughness, Material), MAX_STAGES,
|
||||
"The degree of roughness when not using a ORMConfigMap.");
|
||||
|
||||
addField("metalness", TypeF32, Offset(mMetalness, Material), MAX_STAGES,
|
||||
"The degree of Metalness when not using a ORMConfigMap.");
|
||||
|
||||
addField("invertRoughness", TypeBool, Offset(mInvertRoughness, Material), MAX_STAGES,
|
||||
"Treat Roughness as Roughness");
|
||||
|
||||
addField("AOChan", TypeF32, Offset(mAOChan, Material), MAX_STAGES,
|
||||
"The input channel AO maps use.");
|
||||
addField("roughnessChan", TypeF32, Offset(mRoughnessChan, Material), MAX_STAGES,
|
||||
"The input channel roughness maps use.");
|
||||
addField("metalChan", TypeF32, Offset(mMetalChan, Material), MAX_STAGES,
|
||||
"The input channel metalness maps use.");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(ORMConfigMap, MAX_STAGES, Material, "AO|Roughness|metalness map");
|
||||
addField("isSRGb", TypeBool, Offset(mIsSRGb, Material), MAX_STAGES,
|
||||
"Substance Designer Workaround.");
|
||||
addField("invertRoughness", TypeBool, Offset(mInvertRoughness, Material), MAX_STAGES,
|
||||
"Treat Roughness as Roughness");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(AOMap, MAX_STAGES, Material, "AOMap");
|
||||
addFieldV("AOChan", TypeRangedS32, Offset(mAOChan, Material), &bmpChanRange, MAX_STAGES,
|
||||
"The input channel AO maps use.");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(RoughMap, MAX_STAGES, Material, "RoughMap (also needs MetalMap)");
|
||||
addFieldV("roughness", TypeRangedF32, Offset(mRoughness, Material), &CommonValidators::F32_8BitPercent,MAX_STAGES,
|
||||
"The degree of roughness when not using a ORMConfigMap.");
|
||||
addFieldV("roughnessChan", TypeRangedS32, Offset(mRoughnessChan, Material), &bmpChanRange, MAX_STAGES,
|
||||
"The input channel roughness maps use.");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(MetalMap, MAX_STAGES, Material, "MetalMap (also needs RoughMap)");
|
||||
addFieldV("metalness", TypeRangedF32, Offset(mMetalness, Material), &CommonValidators::F32_8BitPercent, MAX_STAGES,
|
||||
"The degree of Metalness when not using a ORMConfigMap.");
|
||||
addFieldV("metalChan", TypeRangedS32, Offset(mMetalChan, Material), &bmpChanRange, MAX_STAGES,
|
||||
"The input channel metalness maps use.");
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(GlowMap, MAX_STAGES, Material, "GlowMap (needs Albedo)");
|
||||
|
||||
addField("glowMul", TypeF32, Offset(mGlowMul, Material), MAX_STAGES,
|
||||
addFieldV("glowMul", TypeRangedF32, Offset(mGlowMul, Material),&glowMulRange, MAX_STAGES,
|
||||
"glow mask multiplier");
|
||||
endGroup("Light Influence Maps");
|
||||
|
||||
|
|
@ -300,7 +305,7 @@ void Material::initPersistFields()
|
|||
"The scale factor for the detail map.");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(DetailNormalMap, MAX_STAGES, Material, "DetailNormalMap");
|
||||
addField("detailNormalMapStrength", TypeF32, Offset(mDetailNormalMapStrength, Material), MAX_STAGES,
|
||||
addFieldV("detailNormalMapStrength", TypeRangedF32, Offset(mDetailNormalMapStrength, Material), &CommonValidators::PositiveFloat, MAX_STAGES,
|
||||
"Used to scale the strength of the detail normal map when blended with the base normal map.");
|
||||
|
||||
INITPERSISTFIELD_IMAGEASSET_ARRAY(OverlayMap, MAX_STAGES, Material, "Overlay");
|
||||
|
|
@ -312,19 +317,19 @@ void Material::initPersistFields()
|
|||
addProtectedField("accuEnabled", TYPEID< bool >(), Offset(mAccuEnabled, Material),
|
||||
&_setAccuEnabled, &defaultProtectedGetFn, MAX_STAGES, "Accumulation texture.");
|
||||
|
||||
addField("accuScale", TypeF32, Offset(mAccuScale, Material), MAX_STAGES,
|
||||
addFieldV("accuScale", TypeRangedF32, Offset(mAccuScale, Material), &CommonValidators::PositiveFloat, MAX_STAGES,
|
||||
"The scale that is applied to the accu map texture. You can use this to fit the texture to smaller or larger objects.");
|
||||
|
||||
addField("accuDirection", TypeF32, Offset(mAccuDirection, Material), MAX_STAGES,
|
||||
addFieldV("accuDirection", TypeRangedF32, Offset(mAccuDirection, Material), &CommonValidators::DirFloat, MAX_STAGES,
|
||||
"The direction of the accumulation. Chose whether you want the accu map to go from top to bottom (ie. snow) or upwards (ie. mold).");
|
||||
|
||||
addField("accuStrength", TypeF32, Offset(mAccuStrength, Material), MAX_STAGES,
|
||||
addFieldV("accuStrength", TypeRangedF32, Offset(mAccuStrength, Material), &CommonValidators::NormalizedFloat, MAX_STAGES,
|
||||
"The strength of the accu map. This changes the transparency of the accu map texture. Make it subtle or add more contrast.");
|
||||
|
||||
addField("accuCoverage", TypeF32, Offset(mAccuCoverage, Material), MAX_STAGES,
|
||||
addFieldV("accuCoverage", TypeRangedF32, Offset(mAccuCoverage, Material), &CommonValidators::NormalizedFloat, MAX_STAGES,
|
||||
"The coverage ratio of the accu map texture. Use this to make the entire shape pick up some of the accu map texture or none at all.");
|
||||
|
||||
addField("accuSpecular", TypeF32, Offset(mAccuSpecular, Material), MAX_STAGES,
|
||||
addFieldV("accuSpecular", TypeRangedF32, Offset(mAccuSpecular, Material), &CommonValidators::NormalizedFloat, MAX_STAGES,
|
||||
"Changes specularity to this value where the accumulated material is present.");
|
||||
endGroup("Accumulation Properties");
|
||||
|
||||
|
|
@ -335,7 +340,7 @@ void Material::initPersistFields()
|
|||
"Enables emissive lighting for the material.");
|
||||
addField("glow", TypeBool, Offset(mGlow, Material), MAX_STAGES,
|
||||
"Enables rendering as glowing.");
|
||||
addField("parallaxScale", TypeF32, Offset(mParallaxScale, Material), MAX_STAGES,
|
||||
addFieldV("parallaxScale", TypeRangedF32, Offset(mParallaxScale, Material),¶llaxScaleRange, MAX_STAGES,
|
||||
"Enables parallax mapping and defines the scale factor for the parallax effect. Typically "
|
||||
"this value is less than 0.4 else the effect breaks down.");
|
||||
|
||||
|
|
@ -346,7 +351,7 @@ void Material::initPersistFields()
|
|||
"If true the vertex color is used for lighting.");
|
||||
addField("vertColor", TypeBool, Offset(mVertColor, Material), MAX_STAGES,
|
||||
"If enabled, vertex colors are premultiplied with diffuse colors.");
|
||||
|
||||
/* presently unsupported directly. advice would be to use a glowmap+glowmul to fine tune backscatter effects
|
||||
addField("subSurface", TypeBool, Offset(mSubSurface, Material), MAX_STAGES,
|
||||
"Enables the subsurface scattering approximation.");
|
||||
addField("minnaertConstant", TypeF32, Offset(mMinnaertConstant, Material), MAX_STAGES,
|
||||
|
|
@ -355,6 +360,7 @@ void Material::initPersistFields()
|
|||
"The color used for the subsurface scattering approximation.");
|
||||
addField("subSurfaceRolloff", TypeF32, Offset(mSubSurfaceRolloff, Material), MAX_STAGES,
|
||||
"The 0 to 1 rolloff factor used in the subsurface scattering approximation.");
|
||||
*/
|
||||
endGroup("Lighting Properties");
|
||||
|
||||
addGroup("Animation Properties");
|
||||
|
|
@ -364,10 +370,10 @@ void Material::initPersistFields()
|
|||
addField("scrollDir", TypePoint2F, Offset(mScrollDir, Material), MAX_STAGES,
|
||||
"The scroll direction in UV space when scroll animation is enabled.");
|
||||
|
||||
addField("scrollSpeed", TypeF32, Offset(mScrollSpeed, Material), MAX_STAGES,
|
||||
addFieldV("scrollSpeed", TypeRangedF32, Offset(mScrollSpeed, Material), &scrollSpeedRange, MAX_STAGES,
|
||||
"The speed to scroll the texture in UVs per second when scroll animation is enabled.");
|
||||
|
||||
addField("rotSpeed", TypeF32, Offset(mRotSpeed, Material), MAX_STAGES,
|
||||
addFieldV("rotSpeed", TypeRangedF32, Offset(mRotSpeed, Material), &CommonValidators::DegreeRange, MAX_STAGES,
|
||||
"The speed to rotate the texture in degrees per second when rotation animation is enabled.");
|
||||
|
||||
addField("rotPivotOffset", TypePoint2F, Offset(mRotPivotOffset, Material), MAX_STAGES,
|
||||
|
|
@ -376,10 +382,10 @@ void Material::initPersistFields()
|
|||
addField("waveType", TYPEID< WaveType >(), Offset(mWaveType, Material), MAX_STAGES,
|
||||
"The type of wave animation to perform when wave animation is enabled.");
|
||||
|
||||
addField("waveFreq", TypeF32, Offset(mWaveFreq, Material), MAX_STAGES,
|
||||
addFieldV("waveFreq", TypeRangedF32, Offset(mWaveFreq, Material),&waveFreqRange, MAX_STAGES,
|
||||
"The wave frequency when wave animation is enabled.");
|
||||
|
||||
addField("waveAmp", TypeF32, Offset(mWaveAmp, Material), MAX_STAGES,
|
||||
addFieldV("waveAmp", TypeRangedF32, Offset(mWaveAmp, Material), &CommonValidators::NormalizedFloat, MAX_STAGES,
|
||||
"The wave amplitude when wave animation is enabled.");
|
||||
|
||||
addField("sequenceFramePerSec", TypeF32, Offset(mSeqFramePerSec, Material), MAX_STAGES,
|
||||
|
|
@ -393,7 +399,7 @@ void Material::initPersistFields()
|
|||
"@internal");
|
||||
addField("cellLayout", TypePoint2I, Offset(mCellLayout, Material), MAX_STAGES,
|
||||
"@internal");
|
||||
addField("cellSize", TypeS32, Offset(mCellSize, Material), MAX_STAGES,
|
||||
addFieldV("cellSize", TypeRangedS32, Offset(mCellSize, Material), &CommonValidators::PositiveInt, MAX_STAGES,
|
||||
"@internal");
|
||||
addField("bumpAtlas", TypeBool, Offset(mNormalMapAtlas, Material), MAX_STAGES,
|
||||
"@internal");
|
||||
|
|
@ -423,7 +429,7 @@ void Material::initPersistFields()
|
|||
addField("alphaTest", TypeBool, Offset(mAlphaTest, Material),
|
||||
"Enables alpha test when rendering the material.\n@see alphaRef\n");
|
||||
|
||||
addField("alphaRef", TypeS32, Offset(mAlphaRef, Material),
|
||||
addFieldV("alphaRef", TypeRangedS32, Offset(mAlphaRef, Material), &CommonValidators::S32_8BitCap,
|
||||
"The alpha reference value for alpha testing. Must be between 0 to 255.\n@see alphaTest\n");
|
||||
|
||||
addField("cubemap", TypeRealString, Offset(mCubemapName, Material),
|
||||
|
|
@ -498,10 +504,10 @@ void Material::initPersistFields()
|
|||
endGroup("Behavioral (All Layers)");
|
||||
|
||||
// For backwards compatibility.
|
||||
//
|
||||
// They point at the new 'map' fields, but reads always return
|
||||
// an empty string and writes only apply if the value is not empty.
|
||||
//
|
||||
//
|
||||
// They point at the new 'map' fields, but reads always return
|
||||
// an empty string and writes only apply if the value is not empty.
|
||||
//
|
||||
addProtectedField("baseTex", TypeImageFilename, Offset(mDiffuseMapName, Material),
|
||||
defaultProtectedSetNotEmptyFn, emptyStringProtectedGetFn, MAX_STAGES,
|
||||
"For backwards compatibility.\n@see diffuseMap\n", AbstractClassRep::FIELD_HideInInspectors);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue