fill in the validated variables

This commit is contained in:
AzaezelX 2025-03-09 11:53:23 -05:00
parent fa760fa746
commit f633ef3a3d
184 changed files with 1359 additions and 1216 deletions

View file

@ -174,22 +174,22 @@ void VolumetricFog::initPersistFields()
addGroup("VolumetricFogData");
addField("FogColor", TypeColorI, Offset(mFogColor, VolumetricFog),
"Fog color RGBA (Alpha is ignored)");
addField("FogDensity", TypeF32, Offset(mFogDensity, VolumetricFog),
addFieldV("FogDensity", TypeRangedF32, Offset(mFogDensity, VolumetricFog), &CommonValidators::PositiveFloat,
"Overal fog density value (0 disables the fog).");
addField("IgnoreWater", TypeBool, Offset(mIgnoreWater, VolumetricFog),
"Set to true if volumetric fog should continue while submerged.");
addField("MinSize", TypeF32, Offset(mMinDisplaySize, VolumetricFog),
addFieldV("MinSize", TypeRangedF32, Offset(mMinDisplaySize, VolumetricFog), &CommonValidators::PositiveFloat,
"Min size (in pixels) for fog to be rendered.");
addField("FadeSize", TypeF32, Offset(mFadeSize, VolumetricFog),
addFieldV("FadeSize", TypeRangedF32, Offset(mFadeSize, VolumetricFog), &CommonValidators::PositiveFloat,
"Object size in pixels at which the FX-fading kicks in (0 disables fading).");
endGroup("VolumetricFogData");
addGroup("VolumetricFogModulation");
INITPERSISTFIELD_IMAGEASSET(Texture, VolumetricFog, "A texture which contains Fogdensity modulator in the red channel and color with 1-green channel. No texture disables modulation.");
addField("tiles", TypeF32, Offset(mTexTiles, VolumetricFog),
addFieldV("tiles", TypeRangedF32, Offset(mTexTiles, VolumetricFog), &CommonValidators::PositiveFloat,
"How many times the texture is mapped to the object.");
addField("modStrength", TypeF32, Offset(mStrength, VolumetricFog),
addFieldV("modStrength", TypeRangedF32, Offset(mStrength, VolumetricFog), &CommonValidators::PositiveFloat,
"Overall strength of the density modulation (0 disables modulation).");
addField("PrimSpeed", TypePoint2F, Offset(mSpeed1, VolumetricFog),
"Overall primary speed of the density modulation (x-speed(u) y-speed(v))");
@ -200,18 +200,18 @@ void VolumetricFog::initPersistFields()
addGroup("Reflections");
addField("Reflectable", TypeBool, Offset(mReflect, VolumetricFog),
"Set to true if volumetric fog should be reflected.");
addField("ReflectStrength", TypeF32, Offset(mFogReflStrength, VolumetricFog),
addFieldV("ReflectStrength", TypeRangedF32, Offset(mFogReflStrength, VolumetricFog), &CommonValidators::NormalizedFloat,
"Strength of the reflections (0 disables the fog).");
endGroup("Reflections");
addGroup("PostFX");
addField("useGlow", TypeBool, Offset(mUseGlow, VolumetricFog),
"Set to true if volumetric fog should use glow PostFX.");
addField("glowStrength", TypeF32, Offset(mGlowStrength, VolumetricFog),
addFieldV("glowStrength", TypeRangedF32, Offset(mGlowStrength, VolumetricFog), &CommonValidators::PositiveFloat,
"Overall strength of the glow PostFX.");
addField("modLightRay", TypeBool, Offset(mModifLightRays, VolumetricFog),
"Set to true if volumetric fog should modify the brightness of the Lightrays.");
addField("lightRayMod", TypeF32, Offset(mLightRayMod, VolumetricFog),
addFieldV("lightRayMod", TypeRangedF32, Offset(mLightRayMod, VolumetricFog), &CommonValidators::PositiveFloat,
"Modifier for LightRay PostFX when inside Fog.");
endGroup("PostFX");
}

View file

@ -179,19 +179,19 @@ void BasicClouds::initPersistFields()
INITPERSISTFIELD_IMAGEASSET_ARRAY(Texture, TEX_COUNT, BasicClouds, "Texture for this layer.");
addField( "texScale", TypeF32, Offset( mTexScale, BasicClouds ), TEX_COUNT,
addFieldV( "texScale", TypeRangedF32, Offset( mTexScale, BasicClouds ), &CommonValidators::PositiveFloat, TEX_COUNT,
"Texture repeat for this layer." );
addField( "texDirection", TypePoint2F, Offset( mTexDirection, BasicClouds ), TEX_COUNT,
"Texture scroll direction for this layer, relative to the world axis." );
addField( "texSpeed", TypeF32, Offset( mTexSpeed, BasicClouds ), TEX_COUNT,
addFieldV( "texSpeed", TypeRangedF32, Offset( mTexSpeed, BasicClouds ), &CommonValidators::PositiveFloat, TEX_COUNT,
"Texture scroll speed for this layer." );
addField( "texOffset", TypePoint2F, Offset( mTexOffset, BasicClouds ), TEX_COUNT,
"UV offset for this layer." );
addField( "height", TypeF32, Offset( mHeight, BasicClouds ), TEX_COUNT,
addFieldV( "height", TypeRangedF32, Offset( mHeight, BasicClouds ), &CommonValidators::F32Range, TEX_COUNT,
"Abstract number which controls the curvature and height of the dome mesh" );
endArray( "Layers" );

View file

@ -198,13 +198,13 @@ void CloudLayer::initPersistFields()
addArray( "Textures", TEX_COUNT );
addField( "texScale", TypeF32, Offset( mTexScale, CloudLayer ), TEX_COUNT,
addFieldV( "texScale", TypeRangedF32, Offset( mTexScale, CloudLayer ), &CommonValidators::PositiveFloat, TEX_COUNT,
"Controls the texture repeat of this slot." );
addField( "texDirection", TypePoint2F, Offset( mTexDirection, CloudLayer ), TEX_COUNT,
"Controls the direction this slot scrolls." );
addField( "texSpeed", TypeF32, Offset( mTexSpeed, CloudLayer ), TEX_COUNT,
addFieldV( "texSpeed", TypeRangedF32, Offset( mTexSpeed, CloudLayer ), &CommonValidators::PositiveFloat, TEX_COUNT,
"Controls the speed this slot scrolls." );
endArray( "Textures" );
@ -212,16 +212,16 @@ void CloudLayer::initPersistFields()
addField( "baseColor", TypeColorF, Offset( mBaseColor, CloudLayer ),
"Base cloud color before lighting." );
addField( "exposure", TypeF32, Offset( mExposure, CloudLayer ),
addFieldV( "exposure", TypeRangedF32, Offset( mExposure, CloudLayer ), &CommonValidators::PositiveFloat,
"Brightness scale so CloudLayer can be overblown if desired." );
addField( "coverage", TypeF32, Offset( mCoverage, CloudLayer ),
addFieldV( "coverage", TypeRangedF32, Offset( mCoverage, CloudLayer ), &CommonValidators::NormalizedFloat,
"Fraction of sky covered by clouds 0-1." );
addField( "windSpeed", TypeF32, Offset( mWindSpeed, CloudLayer ),
addFieldV( "windSpeed", TypeRangedF32, Offset( mWindSpeed, CloudLayer ), &CommonValidators::NormalizedFloat,
"Overall scalar to texture scroll speed." );
addField( "height", TypeF32, Offset( mHeight, CloudLayer ),
addFieldV( "height", TypeRangedF32, Offset( mHeight, CloudLayer ), &CommonValidators::F32Range,
"Abstract number which controls the curvature and height of the dome mesh." );
endGroup( "CloudLayer" );

View file

@ -40,6 +40,7 @@
#include "materials/baseMatInstance.h"
#include "environment/nodeListManager.h"
#include "lighting/lightQuery.h"
#include "console/typeValidators.h"
extern F32 gDecalBias;
@ -300,7 +301,7 @@ IMPLEMENT_CO_NETOBJECT_V1(DecalRoad);
// ConsoleObject
FRangeValidator drTextureLengthV(0.1f,FLT_MAX);
void DecalRoad::initPersistFields()
{
docsURL;
@ -308,10 +309,10 @@ void DecalRoad::initPersistFields()
INITPERSISTFIELD_MATERIALASSET(Material, DecalRoad, "Material used for rendering.");
addProtectedField( "textureLength", TypeF32, Offset( mTextureLength, DecalRoad ), &DecalRoad::ptSetTextureLength, &defaultProtectedGetFn,
addProtectedFieldV("textureLength", TypeRangedF32, Offset(mTextureLength, DecalRoad), &DecalRoad::ptSetTextureLength, &defaultProtectedGetFn, &drTextureLengthV,
"The length in meters of textures mapped to the DecalRoad" );
addProtectedField( "breakAngle", TypeF32, Offset( mBreakAngle, DecalRoad ), &DecalRoad::ptSetBreakAngle, &defaultProtectedGetFn,
addProtectedFieldV( "breakAngle", TypeF32, Offset( mBreakAngle, DecalRoad ), &DecalRoad::ptSetBreakAngle, &defaultProtectedGetFn, &CommonValidators::PosDegreeRange,
"Angle in degrees - DecalRoad will subdivided the spline if its curve is greater than this threshold." );
addField( "renderPriority", TypeS32, Offset( mRenderPriority, DecalRoad ),

View file

@ -215,8 +215,8 @@ bool GuiMeshRoadEditorCtrl::onAdd()
void GuiMeshRoadEditorCtrl::initPersistFields()
{
docsURL;
addField( "DefaultWidth", TypeF32, Offset( mDefaultWidth, GuiMeshRoadEditorCtrl ) );
addField( "DefaultDepth", TypeF32, Offset( mDefaultDepth, GuiMeshRoadEditorCtrl ) );
addFieldV( "DefaultWidth", TypeRangedF32, Offset( mDefaultWidth, GuiMeshRoadEditorCtrl ), &CommonValidators::PositiveFloat);
addFieldV( "DefaultDepth", TypeRangedF32, Offset( mDefaultDepth, GuiMeshRoadEditorCtrl ), &CommonValidators::PositiveFloat);
addField( "DefaultNormal", TypePoint3F,Offset( mDefaultNormal, GuiMeshRoadEditorCtrl ) );
addField( "HoverSplineColor", TypeColorI, Offset( mHoverSplineColor, GuiMeshRoadEditorCtrl ) );
addField( "SelectedSplineColor", TypeColorI, Offset( mSelectedSplineColor, GuiMeshRoadEditorCtrl ) );

View file

@ -169,8 +169,8 @@ bool GuiRiverEditorCtrl::onAdd()
void GuiRiverEditorCtrl::initPersistFields()
{
docsURL;
addField( "DefaultWidth", TypeF32, Offset( mDefaultWidth, GuiRiverEditorCtrl ) );
addField( "DefaultDepth", TypeF32, Offset( mDefaultDepth, GuiRiverEditorCtrl ) );
addFieldV( "DefaultWidth", TypeRangedF32, Offset( mDefaultWidth, GuiRiverEditorCtrl ), &CommonValidators::PositiveFloat);
addFieldV( "DefaultDepth", TypeRangedF32, Offset( mDefaultDepth, GuiRiverEditorCtrl ), &CommonValidators::PositiveFloat);
addField( "DefaultNormal", TypePoint3F,Offset( mDefaultNormal, GuiRiverEditorCtrl ) );
addField( "HoverSplineColor", TypeColorI, Offset( mHoverSplineColor, GuiRiverEditorCtrl ) );
addField( "SelectedSplineColor", TypeColorI, Offset( mSelectedSplineColor, GuiRiverEditorCtrl ) );

View file

@ -159,7 +159,7 @@ bool GuiRoadEditorCtrl::onAdd()
void GuiRoadEditorCtrl::initPersistFields()
{
docsURL;
addField( "DefaultWidth", TypeF32, Offset( mDefaultWidth, GuiRoadEditorCtrl ) );
addFieldV( "DefaultWidth", TypeRangedF32, Offset( mDefaultWidth, GuiRoadEditorCtrl ), &CommonValidators::PositiveFloat);
addField( "HoverSplineColor", TypeColorI, Offset( mHoverSplineColor, GuiRoadEditorCtrl ) );
addField( "SelectedSplineColor", TypeColorI, Offset( mSelectedSplineColor, GuiRoadEditorCtrl ) );
addField( "HoverNodeColor", TypeColorI, Offset( mHoverNodeColor, GuiRoadEditorCtrl ) );

View file

@ -933,6 +933,7 @@ MeshRoad::~MeshRoad()
mConvexList = NULL;
}
FRangeValidator mrTextureLengthV(0.1f, FLT_MAX);
void MeshRoad::initPersistFields()
{
docsURL;
@ -942,13 +943,13 @@ void MeshRoad::initPersistFields()
INITPERSISTFIELD_MATERIALASSET(BottomMaterial, MeshRoad, "Material for the bottom surface of the road.");
INITPERSISTFIELD_MATERIALASSET(SideMaterial, MeshRoad, "Material for the side surface of the road.");
addField( "textureLength", TypeF32, Offset( mTextureLength, MeshRoad ),
addFieldV( "textureLength", TypeRangedF32, Offset( mTextureLength, MeshRoad ), &mrTextureLengthV,
"The length in meters of textures mapped to the MeshRoad." );
addField( "breakAngle", TypeF32, Offset( mBreakAngle, MeshRoad ),
addFieldV( "breakAngle", TypeRangedF32, Offset( mBreakAngle, MeshRoad ), &CommonValidators::PosDegreeRange,
"Angle in degrees - MeshRoad will subdivide the spline if its curve is greater than this threshold." );
addField( "widthSubdivisions", TypeS32, Offset( mWidthSubdivisions, MeshRoad ),
addFieldV( "widthSubdivisions", TypeRangedS32, Offset( mWidthSubdivisions, MeshRoad ), &CommonValidators::PositiveInt,
"Subdivide segments widthwise this many times when generating vertices." );
endGroup( "MeshRoad" );

View file

@ -624,23 +624,26 @@ River::~River()
{
}
FRangeValidator riverSegRange(MIN_METERS_PER_SEGMENT, FLT_MAX);
void River::initPersistFields()
{
docsURL;
addGroup( "River" );
addField( "SegmentLength", TypeF32, Offset( mMetersPerSegment, River ),
addFieldV( "SegmentLength", TypeRangedF32, Offset( mMetersPerSegment, River ), &riverSegRange,
"Divide the River lengthwise into segments of this length in meters. "
"These geometric volumes are used for spacial queries like determining containment." );
addField( "SubdivideLength", TypeF32, Offset( mMaxDivisionSize, River ),
addFieldV( "SubdivideLength", TypeRangedF32, Offset( mMaxDivisionSize, River ), &CommonValidators::PositiveFloat,
"For purposes of generating the renderable geometry River segments are further subdivided "
"such that no quad is of greater width or length than this distance in meters." );
addField( "FlowMagnitude", TypeF32, Offset( mFlowMagnitude, River ),
addFieldV( "FlowMagnitude", TypeRangedF32, Offset( mFlowMagnitude, River ), &CommonValidators::PositiveFloat,
"Magnitude of the force vector applied to dynamic objects within the River." );
addField( "LowLODDistance", TypeF32, Offset( mLodDistance, River ),
addFieldV( "LowLODDistance", TypeRangedF32, Offset( mLodDistance, River ), &CommonValidators::PositiveFloat,
"Segments of the river at this distance in meters or greater will "
"render as a single unsubdivided without undulation effects." );

View file

@ -42,6 +42,7 @@
#include "materials/sceneData.h"
#include "environment/timeOfDay.h"
#include "materials/materialFeatureTypes.h"
#include "console/typeValidators.h"
ConsoleDocClass( ScatterSky,
@ -324,19 +325,19 @@ void ScatterSky::initPersistFields()
addGroup( "ScatterSky",
"Only azimuth and elevation are networked fields. To trigger a full update of all other fields use the applyChanges ConsoleMethod." );
addField( "skyBrightness", TypeF32, Offset( mSkyBrightness, ScatterSky ),
addFieldV( "skyBrightness", TypeRangedF32, Offset( mSkyBrightness, ScatterSky ), &CommonValidators::PositiveFloat,
"Global brightness and intensity applied to the sky and objects in the level." );
addField( "sunSize", TypeF32, Offset( mSunSize, ScatterSky ),
addFieldV( "sunSize", TypeRangedF32, Offset( mSunSize, ScatterSky ), &CommonValidators::PositiveFloat,
"Affects the size of the sun's disk." );
addField( "colorizeAmount", TypeF32, Offset( mColorizeAmt, ScatterSky ),
addFieldV( "colorizeAmount", TypeRangedF32, Offset( mColorizeAmt, ScatterSky ), &CommonValidators::PositiveFloat,
"Controls how much the alpha component of colorize brigthens the sky. Setting to 0 returns default behavior." );
addField( "colorize", TypeColorF, Offset( mColorize, ScatterSky ),
"Tints the sky the color specified, the alpha controls the brigthness. The brightness is multipled by the value of colorizeAmt." );
addField( "rayleighScattering", TypeF32, Offset( mRayleighScattering, ScatterSky ),
addFieldV( "rayleighScattering", TypeRangedF32, Offset( mRayleighScattering, ScatterSky ), &CommonValidators::PositiveFloat,
"Controls how blue the atmosphere is during the day." );
addField( "sunScale", TypeColorF, Offset( mSunScale, ScatterSky ),
@ -350,26 +351,26 @@ void ScatterSky::initPersistFields()
"property, so you should not use LevelInfo.fogColor if the level contains "
"a ScatterSky object." );
addField( "exposure", TypeF32, Offset( mExposure, ScatterSky ),
addFieldV( "exposure", TypeRangedF32, Offset( mExposure, ScatterSky ), &CommonValidators::PositiveFloat,
"Controls the contrast of the sky and sun during daytime." );
addField( "zOffset", TypeF32, Offset( mZOffset, ScatterSky ),
addFieldV( "zOffset", TypeRangedF32, Offset( mZOffset, ScatterSky ), &CommonValidators::F32Range,
"Offsets the scatterSky to avoid canvas rendering. Use 5000 or greater for the initial adjustment" );
endGroup( "ScatterSky" );
addGroup( "Orbit" );
addProtectedField( "azimuth", TypeF32, Offset( mSunAzimuth, ScatterSky ), &ScatterSky::ptSetAzimuth, &defaultProtectedGetFn,
addProtectedFieldV( "azimuth", TypeRangedF32, Offset( mSunAzimuth, ScatterSky ), &ScatterSky::ptSetAzimuth, &defaultProtectedGetFn, &CommonValidators::PosDegreeRange,
"The horizontal angle of the sun measured clockwise from the positive Y world axis. This field is networked." );
addProtectedField( "elevation", TypeF32, Offset( mSunElevation, ScatterSky ), &ScatterSky::ptSetElevation, &defaultProtectedGetFn,
addProtectedFieldV( "elevation", TypeRangedF32, Offset( mSunElevation, ScatterSky ), &ScatterSky::ptSetElevation, &defaultProtectedGetFn, &CommonValidators::DegreeRange,
"The elevation angle of the sun above or below the horizon. This field is networked." );
addField( "moonAzimuth", TypeF32, Offset( mMoonAzimuth, ScatterSky ),
addFieldV( "moonAzimuth", TypeRangedF32, Offset( mMoonAzimuth, ScatterSky ), &CommonValidators::PosDegreeRange,
"The horizontal angle of the moon measured clockwise from the positive Y world axis. This is not animated by time or networked." );
addField( "moonElevation", TypeF32, Offset( mMoonElevation, ScatterSky ),
addFieldV( "moonElevation", TypeRangedF32, Offset( mMoonElevation, ScatterSky ), &CommonValidators::DegreeRange,
"The elevation angle of the moon above or below the horizon. This is not animated by time or networked." );
endGroup( "Orbit" );
@ -382,11 +383,11 @@ void ScatterSky::initPersistFields()
addField( "castShadows", TypeBool, Offset( mCastShadows, ScatterSky ),
"Enables/disables shadows cast by objects due to ScatterSky light." );
/*
addField("staticRefreshFreq", TypeS32, Offset(mStaticRefreshFreq, ScatterSky), "static shadow refresh rate (milliseconds)");
addField("dynamicRefreshFreq", TypeS32, Offset(mDynamicRefreshFreq, ScatterSky), "dynamic shadow refresh rate (milliseconds)");
addField( "brightness", TypeF32, Offset( mBrightness, ScatterSky ),
*/
addFieldV( "brightness", TypeRangedF32, Offset( mBrightness, ScatterSky ), &CommonValidators::PositiveFloat,
"The brightness of the ScatterSky's light object." );
endGroup( "Lighting" );
@ -396,7 +397,7 @@ void ScatterSky::initPersistFields()
addField( "flareType", TYPEID< LightFlareData >(), Offset( mFlareData, ScatterSky ),
"Datablock for the flare produced by the ScatterSky." );
addField( "flareScale", TypeF32, Offset( mFlareScale, ScatterSky ),
addFieldV( "flareScale", TypeRangedF32, Offset( mFlareScale, ScatterSky ), &CommonValidators::PositiveFloat,
"Changes the size and intensity of the flare." );
endGroup( "Misc" );
@ -414,7 +415,7 @@ void ScatterSky::initPersistFields()
INITPERSISTFIELD_MATERIALASSET(MoonMat, ScatterSky, "Material for the moon sprite.");
addField( "moonScale", TypeF32, Offset( mMoonScale, ScatterSky ),
addFieldV( "moonScale", TypeRangedF32, Offset( mMoonScale, ScatterSky ), &CommonValidators::PositiveFloat,
"Controls size the moon sprite renders, specified as a fractional amount of the screen height." );
addField( "moonLightColor", TypeColorF, Offset( mMoonTint, ScatterSky ),

View file

@ -122,7 +122,7 @@ void SkyBox::initPersistFields()
addField( "drawBottom", TypeBool, Offset( mDrawBottom, SkyBox ),
"If false the bottom of the skybox is not rendered." );
addField( "fogBandHeight", TypeF32, Offset( mFogBandHeight, SkyBox ),
addFieldV( "fogBandHeight", TypeRangedF32, Offset( mFogBandHeight, SkyBox ), &CommonValidators::NormalizedFloat,
"The height (0-1) of the fog band from the horizon to the top of the SkyBox." );
endGroup( "Sky Box" );

View file

@ -118,7 +118,7 @@ void SkySphere::initPersistFields()
INITPERSISTFIELD_MATERIALASSET(Material, SkySphere, "The name of a cubemap material for the sky box.");
addField("fogBandHeight", TypeF32, Offset(mFogBandHeight, SkySphere),
addFieldV("fogBandHeight", TypeRangedF32, Offset(mFogBandHeight, SkySphere), &CommonValidators::NormalizedFloat,
"The height (0-1) of the fog band from the horizon to the top of the SkySphere.");
endGroup("Sky Sphere");

View file

@ -145,10 +145,10 @@ void Sun::initPersistFields()
docsURL;
addGroup( "Orbit" );
addField( "azimuth", TypeF32, Offset( mSunAzimuth, Sun ),
addFieldV( "azimuth", TypeRangedF32, Offset( mSunAzimuth, Sun ), &CommonValidators::PosDegreeRange,
"The horizontal angle of the sun measured clockwise from the positive Y world axis." );
addField( "elevation", TypeF32, Offset( mSunElevation, Sun ),
addFieldV( "elevation", TypeRangedF32, Offset( mSunElevation, Sun ), &CommonValidators::DegreeRange,
"The elevation angle of the sun above or below the horizon." );
endGroup( "Orbit" );
@ -165,7 +165,7 @@ void Sun::initPersistFields()
addField( "ambient", TypeColorF, Offset( mLightAmbient, Sun ), "Color shading applied to surfaces not "
"in direct contact with light source, such as in the shadows or interiors.");
addField( "brightness", TypeF32, Offset( mBrightness, Sun ),
addFieldV( "brightness", TypeRangedF32, Offset( mBrightness, Sun ), &CommonValidators::PositiveFloat,
"Adjust the Sun's global contrast/intensity");
addField( "castShadows", TypeBool, Offset( mCastShadows, Sun ),
@ -183,7 +183,7 @@ void Sun::initPersistFields()
INITPERSISTFIELD_MATERIALASSET(CoronaMaterial, Sun, "Material for the corona sprite.");
addField( "coronaScale", TypeF32, Offset( mCoronaScale, Sun ),
addFieldV( "coronaScale", TypeRangedF32, Offset( mCoronaScale, Sun ), &CommonValidators::PositiveFloat,
"Controls size the corona sprite renders, specified as a fractional amount of the screen height." );
addField( "coronaTint", TypeColorF, Offset( mCoronaTint, Sun ),
@ -200,7 +200,7 @@ void Sun::initPersistFields()
addField( "flareType", TYPEID< LightFlareData >(), Offset( mFlareData, Sun ),
"Datablock for the flare produced by the Sun" );
addField( "flareScale", TypeF32, Offset( mFlareScale, Sun ),
addFieldV( "flareScale", TypeRangedF32, Offset( mFlareScale, Sun ), &CommonValidators::PositiveFloat,
"Changes the size and intensity of the flare." );
endGroup( "Misc" );

View file

@ -28,6 +28,7 @@
#include "T3D/gameBase/gameConnection.h"
#include "environment/sun.h"
#include "console/engineAPI.h"
#include "console/typeValidators.h"
TimeOfDayUpdateSignal TimeOfDay::smTimeOfDayUpdateSignal;
@ -127,24 +128,24 @@ void TimeOfDay::initPersistFields()
docsURL;
addGroup( "TimeOfDay" );
addField( "axisTilt", TypeF32, Offset( mAxisTilt, TimeOfDay ),
addFieldV( "axisTilt", TypeRangedF32, Offset( mAxisTilt, TimeOfDay ), &CommonValidators::DegreeRange,
"The angle in degrees between global equator and tropic." );
addProtectedField( "dayLength", TypeF32, Offset( mDayLen, TimeOfDay ), &setDayLength, &defaultProtectedGetFn,
addProtectedFieldV( "dayLength", TypeRangedF32, Offset( mDayLen, TimeOfDay ), &setDayLength, &defaultProtectedGetFn, &CommonValidators::PositiveFloat,
"The length of a virtual day in real world seconds." );
addField( "startTime", TypeF32, Offset( mStartTimeOfDay, TimeOfDay ),
addFieldV( "startTime", TypeRangedF32, Offset( mStartTimeOfDay, TimeOfDay ), &CommonValidators::NormalizedFloat,
"" );
addProtectedField( "time", TypeF32, Offset( mTimeOfDay, TimeOfDay ), &setTimeOfDay, &defaultProtectedGetFn, "Current time of day." );
addProtectedFieldV( "time", TypeRangedF32, Offset( mTimeOfDay, TimeOfDay ), &setTimeOfDay, &defaultProtectedGetFn, &CommonValidators::NormalizedFloat, "Current time of day." );
addProtectedField( "play", TypeBool, Offset( mPlay, TimeOfDay ), &setPlay, &defaultProtectedGetFn, "True when the TimeOfDay object is operating." );
addField( "azimuthOverride", TypeF32, Offset( mAzimuthOverride, TimeOfDay ), "" );
addFieldV( "azimuthOverride", TypeRangedF32, Offset( mAzimuthOverride, TimeOfDay ), &CommonValidators::PosDegreeRange, "" );
addField( "dayScale", TypeF32, Offset( mDayScale, TimeOfDay ), "Scalar applied to time that elapses while the sun is up." );
addFieldV( "dayScale", TypeRangedF32, Offset( mDayScale, TimeOfDay ), &CommonValidators::PositiveFloat, "Scalar applied to time that elapses while the sun is up." );
addField( "nightScale", TypeF32, Offset( mNightScale, TimeOfDay ), "Scalar applied to time that elapses while the sun is down." );
addFieldV( "nightScale", TypeRangedF32, Offset( mNightScale, TimeOfDay ), &CommonValidators::PositiveFloat, "Scalar applied to time that elapses while the sun is down." );
endGroup( "TimeOfDay" );

View file

@ -41,6 +41,7 @@
#include "ts/tsShapeInstance.h"
#include "postFx/postEffect.h"
#include "math/util/matrixSet.h"
#include "console/typeValidators.h"
IMPLEMENT_CO_NETOBJECT_V1(WaterBlock);
@ -529,11 +530,12 @@ void WaterBlock::initPersistFields()
{
docsURL;
addGroup( "WaterBlock" );
addProtectedField( "gridElementSize", TypeF32, Offset( mGridElementSize, WaterBlock ),
&setGridSizeProperty, &defaultProtectedGetFn, "Spacing between vertices in the WaterBlock mesh" );
addProtectedField( "gridSize", TypeF32, Offset( mGridElementSize, WaterBlock ),
&setGridSizeProperty, &defaultProtectedGetFn, "Duplicate of gridElementSize for backwards compatility" );
endGroup( "WaterBlock" );
addProtectedFieldV("gridSize", TypeRangedF32, Offset(mGridElementSize, WaterBlock), &setGridSizeProperty, &defaultProtectedGetFn, &CommonValidators::PositiveNonZeroFloat,
"Spacing between vertices in the WaterBlock mesh");
addProtectedFieldV("gridElementSize", TypeRangedF32, Offset(mGridElementSize, WaterBlock), &setGridSizeProperty, &defaultProtectedGetFn, &CommonValidators::PositiveNonZeroFloat,
"Duplicate of gridElementSize for backwards compatility");
Parent::initPersistFields();
}

View file

@ -44,7 +44,7 @@
#include "sfx/sfxAmbience.h"
#include "T3D/sfx/sfx3DWorld.h"
#include "sfx/sfxTypes.h"
#include "console/typeValidators.h"
GFXImplementVertexFormat( GFXWaterVertex )
{
@ -272,32 +272,32 @@ WaterObject::~WaterObject()
dFree_aligned(mMatrixSet);
}
FRangeValidator densityRange(0.0f,1000.0f);
void WaterObject::initPersistFields()
{
docsURL;
addGroup( "WaterObject" );
addProtectedField( "density", TypeF32, Offset( mDensity, WaterObject ), &WaterObject::_checkDensity, &defaultProtectedGetFn, "Affects buoyancy of an object, thus affecting the Z velocity of a player (jumping, falling, etc.");
addField( "viscosity", TypeF32, Offset( mViscosity, WaterObject ), "Affects drag force applied to an object submerged in this container." );
addProtectedFieldV( "density", TypeRangedF32, Offset( mDensity, WaterObject ), &WaterObject::_checkDensity, &defaultProtectedGetFn, &densityRange, "Affects buoyancy of an object, thus affecting the Z velocity of a player (jumping, falling, etc.");
addFieldV( "viscosity", TypeRangedF32, Offset( mViscosity, WaterObject ), &CommonValidators::PositiveFloat, "Affects drag force applied to an object submerged in this container." );
addField( "liquidType", TypeRealString, Offset( mLiquidType, WaterObject ), "Liquid type of WaterBlock, such as water, ocean, lava"
" Currently only Water is defined and used.");
addField( "baseColor", TypeColorI, Offset( mWaterFogData.color, WaterObject ), "Changes color of water fog." );
addField( "fresnelBias", TypeF32, Offset( mFresnelBias, WaterObject ), "Extent of fresnel affecting reflection fogging." );
addField( "fresnelPower", TypeF32, Offset( mFresnelPower, WaterObject ), "Measures intensity of affect on reflection based on fogging." );
addField( "specularPower", TypeF32, Offset( mSpecularPower, WaterObject ), "Power used for specularity on the water surface ( sun only )." );
addFieldV( "fresnelBias", TypeRangedF32, Offset( mFresnelBias, WaterObject ), &CommonValidators::PositiveFloat, "Extent of fresnel affecting reflection fogging." );
addFieldV( "fresnelPower", TypeRangedF32, Offset( mFresnelPower, WaterObject ), &CommonValidators::PositiveFloat, "Measures intensity of affect on reflection based on fogging." );
addFieldV( "specularPower", TypeRangedF32, Offset( mSpecularPower, WaterObject ), &CommonValidators::PositiveFloat, "Power used for specularity on the water surface ( sun only )." );
addField( "specularColor", TypeColorF, Offset( mSpecularColor, WaterObject ), "Color used for specularity on the water surface ( sun only )." );
addField( "emissive", TypeBool, Offset( mEmissive, WaterObject ), "When true the water colors don't react to changes to environment lighting." );
addArray( "Waves (vertex undulation)", MAX_WAVES );
addField( "waveDir", TypePoint2F, Offset( mWaveDir, WaterObject ), MAX_WAVES, "Direction waves flow toward shores." );
addField( "waveSpeed", TypeF32, Offset( mWaveSpeed, WaterObject ), MAX_WAVES, "Speed of water undulation." );
addField( "waveMagnitude", TypeF32, Offset( mWaveMagnitude, WaterObject ), MAX_WAVES, "Height of water undulation." );
addFieldV( "waveSpeed", TypeRangedF32, Offset( mWaveSpeed, WaterObject ), &CommonValidators::PositiveFloat, MAX_WAVES, "Speed of water undulation." );
addFieldV( "waveMagnitude", TypeRangedF32, Offset( mWaveMagnitude, WaterObject ), &CommonValidators::PositiveFloat, MAX_WAVES, "Height of water undulation." );
endArray( "Waves (vertex undulation)" );
addField( "overallWaveMagnitude", TypeF32, Offset( mOverallWaveMagnitude, WaterObject ), "Master variable affecting entire body"
addFieldV( "overallWaveMagnitude", TypeRangedF32, Offset( mOverallWaveMagnitude, WaterObject ), &CommonValidators::PositiveFloat, "Master variable affecting entire body"
" of water's undulation" );
INITPERSISTFIELD_IMAGEASSET(RippleTex, WaterObject, "Normal map used to simulate small surface ripples");
@ -305,31 +305,31 @@ void WaterObject::initPersistFields()
addArray( "Ripples (texture animation)", MAX_WAVES );
addField( "rippleDir", TypePoint2F, Offset( mRippleDir, WaterObject ), MAX_WAVES, "Modifies the direction of ripples on the surface." );
addField( "rippleSpeed", TypeF32, Offset( mRippleSpeed, WaterObject ), MAX_WAVES, "Modifies speed of surface ripples.");
addFieldV( "rippleSpeed", TypeRangedF32, Offset( mRippleSpeed, WaterObject ), &CommonValidators::PositiveFloat, MAX_WAVES, "Modifies speed of surface ripples.");
addField( "rippleTexScale", TypePoint2F, Offset( mRippleTexScale, WaterObject ), MAX_WAVES, "Intensifies the affect of the normal map "
"applied to the surface.");
addField( "rippleMagnitude", TypeF32, Offset( mRippleMagnitude, WaterObject ), MAX_WAVES, "Intensifies the vertext modification of the surface." );
addFieldV( "rippleMagnitude", TypeRangedF32, Offset( mRippleMagnitude, WaterObject ), &CommonValidators::PositiveFloat, MAX_WAVES, "Intensifies the vertext modification of the surface." );
endArray( "Ripples (texture animation)" );
addField( "overallRippleMagnitude", TypeF32, Offset( mOverallRippleMagnitude, WaterObject ), "Master variable affecting entire surface");
addFieldV( "overallRippleMagnitude", TypeRangedF32, Offset( mOverallRippleMagnitude, WaterObject ), &CommonValidators::PositiveFloat, "Master variable affecting entire surface");
INITPERSISTFIELD_IMAGEASSET(FoamTex, WaterObject, "Diffuse texture for foam in shallow water (advanced lighting only)");
addArray( "Foam", MAX_FOAM );
addField( "foamDir", TypePoint2F, Offset( mFoamDir, WaterObject ), MAX_FOAM, "" );
addField( "foamSpeed", TypeF32, Offset( mFoamSpeed, WaterObject ), MAX_FOAM, "");
addFieldV( "foamSpeed", TypeRangedF32, Offset( mFoamSpeed, WaterObject ), &CommonValidators::PositiveFloat, MAX_FOAM, "");
addField( "foamTexScale", TypePoint2F, Offset( mFoamTexScale, WaterObject ), MAX_FOAM, ""
"applied to the surface.");
addField( "foamOpacity", TypeF32, Offset( mFoamOpacity, WaterObject ), MAX_FOAM, "" );
addFieldV( "foamOpacity", TypeRangedF32, Offset( mFoamOpacity, WaterObject ), &CommonValidators::PositiveFloat, MAX_FOAM, "" );
endArray( "Foam" );
addField( "overallFoamOpacity", TypeF32, Offset( mOverallFoamOpacity, WaterObject ), "" );
addField( "foamMaxDepth", TypeF32, Offset( mFoamMaxDepth, WaterObject ), "" );
addField( "foamAmbientLerp", TypeF32, Offset( mFoamAmbientLerp, WaterObject ), "" );
addField( "foamRippleInfluence", TypeF32, Offset( mFoamRippleInfluence, WaterObject ), "" );
addFieldV( "overallFoamOpacity", TypeRangedF32, Offset( mOverallFoamOpacity, WaterObject ), &CommonValidators::PositiveFloat, "" );
addFieldV( "foamMaxDepth", TypeRangedF32, Offset( mFoamMaxDepth, WaterObject ), &CommonValidators::PositiveFloat, "" );
addFieldV( "foamAmbientLerp", TypeRangedF32, Offset( mFoamAmbientLerp, WaterObject ), &CommonValidators::NormalizedFloat, "" );
addFieldV( "foamRippleInfluence", TypeRangedF32, Offset( mFoamRippleInfluence, WaterObject ), &CommonValidators::PositiveFloat, "" );
endGroup( "WaterObject" );
@ -342,25 +342,25 @@ void WaterObject::initPersistFields()
&defaultProtectedGetFn,
"Enables dynamic reflection rendering." );
addField( "reflectivity", TypeF32, Offset( mReflectivity, WaterObject ), "Overall scalar to the reflectivity of the water surface." );
addField( "reflectPriority", TypeF32, Offset( mReflectorDesc.priority, WaterObject ), "Affects the sort order of reflected objects." );
addField( "reflectMaxRateMs", TypeS32, Offset( mReflectorDesc.maxRateMs, WaterObject ), "Affects the sort time of reflected objects." );
addFieldV( "reflectivity", TypeRangedF32, Offset( mReflectivity, WaterObject ), &CommonValidators::PositiveFloat, "Overall scalar to the reflectivity of the water surface." );
addFieldV( "reflectPriority", TypeRangedF32, Offset( mReflectorDesc.priority, WaterObject ), &CommonValidators::PositiveFloat, "Affects the sort order of reflected objects." );
addFieldV( "reflectMaxRateMs", TypeRangedS32, Offset( mReflectorDesc.maxRateMs, WaterObject ), &CommonValidators::PositiveInt, "Affects the sort time of reflected objects." );
//addField( "reflectMaxDist", TypeF32, Offset( mReflectMaxDist, WaterObject ), "vert distance at which only cubemap color is used" );
//addField( "reflectMinDist", TypeF32, Offset( mReflectMinDist, WaterObject ), "vert distance at which only reflection color is used" );
addField( "reflectDetailAdjust", TypeF32, Offset( mReflectorDesc.detailAdjust, WaterObject ), "scale up or down the detail level for objects rendered in a reflection" );
addFieldV( "reflectDetailAdjust", TypeRangedF32, Offset( mReflectorDesc.detailAdjust, WaterObject ), &CommonValidators::PositiveFloat, "scale up or down the detail level for objects rendered in a reflection" );
addField( "reflectNormalUp", TypeBool, Offset( mReflectNormalUp, WaterObject ), "always use z up as the reflection normal" );
addField( "useOcclusionQuery", TypeBool, Offset( mReflectorDesc.useOcclusionQuery, WaterObject ), "turn off reflection rendering when occluded (delayed)." );
addField( "reflectTexSize", TypeS32, Offset( mReflectorDesc.texSize, WaterObject ), "The texture size used for reflections (square)" );
addFieldV( "reflectTexSize", TypeRangedS32, Offset( mReflectorDesc.texSize, WaterObject ), &CommonValidators::PositiveInt, "The texture size used for reflections (square)" );
endGroup( "Reflect" );
addGroup( "Underwater Fogging" );
addField( "waterFogDensity", TypeF32, Offset( mWaterFogData.density, WaterObject ), "Intensity of underwater fogging." );
addField( "waterFogDensityOffset", TypeF32, Offset( mWaterFogData.densityOffset, WaterObject ), "Delta, or limit, applied to waterFogDensity." );
addField( "wetDepth", TypeF32, Offset( mWaterFogData.wetDepth, WaterObject ), "The depth in world units at which full darkening will be received,"
addFieldV( "waterFogDensity", TypeRangedF32, Offset( mWaterFogData.density, WaterObject ), &CommonValidators::PositiveFloat, "Intensity of underwater fogging." );
addFieldV( "waterFogDensityOffset", TypeRangedF32, Offset( mWaterFogData.densityOffset, WaterObject ), &CommonValidators::PositiveFloat, "Delta, or limit, applied to waterFogDensity." );
addFieldV( "wetDepth", TypeRangedF32, Offset( mWaterFogData.wetDepth, WaterObject ), &CommonValidators::PositiveFloat, "The depth in world units at which full darkening will be received,"
" giving a wet look to objects underwater." );
addField( "wetDarkening", TypeF32, Offset( mWaterFogData.wetDarkening, WaterObject ), "The refract color intensity scaled at wetDepth." );
addFieldV( "wetDarkening", TypeRangedF32, Offset( mWaterFogData.wetDarkening, WaterObject ), &CommonValidators::PositiveFloat, "The refract color intensity scaled at wetDepth." );
endGroup( "Underwater Fogging" );
@ -368,24 +368,24 @@ void WaterObject::initPersistFields()
INITPERSISTFIELD_IMAGEASSET(DepthGradientTex, WaterObject, "1D texture defining the base water color by depth");
addField( "depthGradientMax", TypeF32, Offset( mDepthGradientMax, WaterObject ), "Depth in world units, the max range of the color gradient texture." );
addFieldV( "depthGradientMax", TypeRangedF32, Offset( mDepthGradientMax, WaterObject ), &CommonValidators::PositiveFloat, "Depth in world units, the max range of the color gradient texture." );
endGroup( "Misc" );
addGroup( "Distortion" );
addField( "distortStartDist", TypeF32, Offset( mDistortStartDist, WaterObject ), "Determines start of distortion effect where water"
addFieldV( "distortStartDist", TypeRangedF32, Offset( mDistortStartDist, WaterObject ), &CommonValidators::PositiveFloat, "Determines start of distortion effect where water"
" surface intersects the camera near plane.");
addField( "distortEndDist", TypeF32, Offset( mDistortEndDist, WaterObject ), "Max distance that distortion algorithm is performed. "
addFieldV( "distortEndDist", TypeRangedF32, Offset( mDistortEndDist, WaterObject ), &CommonValidators::PositiveFloat, "Max distance that distortion algorithm is performed. "
"The lower, the more distorted the effect.");
addField( "distortFullDepth", TypeF32, Offset( mDistortFullDepth, WaterObject ), "Determines the scaling down of distortion "
addFieldV( "distortFullDepth", TypeRangedF32, Offset( mDistortFullDepth, WaterObject ), &CommonValidators::PositiveFloat, "Determines the scaling down of distortion "
"in shallow water.");
endGroup( "Distortion" );
addGroup( "Basic Lighting" );
addField( "clarity", TypeF32, Offset( mClarity, WaterObject ), "Relative opacity or transparency of the water surface." );
addFieldV( "clarity", TypeRangedF32, Offset( mClarity, WaterObject ), &CommonValidators::PositiveFloat, "Relative opacity or transparency of the water surface." );
addField( "underwaterColor", TypeColorI, Offset( mUnderwaterColor, WaterObject ), "Changes the color shading of objects beneath"
" the water surface.");
@ -473,13 +473,13 @@ U32 WaterObject::packUpdate( NetConnection * conn, U32 mask, BitStream *stream )
if ( stream->writeFlag( mFullReflect ) )
{
stream->write( mReflectorDesc.priority );
stream->writeInt( mReflectorDesc.maxRateMs, 32 );
stream->write( mReflectorDesc.maxRateMs );
//stream->write( mReflectMaxDist );
//stream->write( mReflectMinDist );
stream->write( mReflectorDesc.detailAdjust );
stream->writeFlag( mReflectNormalUp );
stream->writeFlag( mReflectorDesc.useOcclusionQuery );
stream->writeInt( mReflectorDesc.texSize, 32 );
stream->write( mReflectorDesc.texSize );
}
stream->write( mReflectivity );
@ -575,13 +575,13 @@ void WaterObject::unpackUpdate( NetConnection * conn, BitStream *stream )
{
mFullReflect = true;
stream->read( &mReflectorDesc.priority );
mReflectorDesc.maxRateMs = stream->readInt( 32 );
stream->read(&mReflectorDesc.maxRateMs);
//stream->read( &mReflectMaxDist );
//stream->read( &mReflectMinDist );
stream->read( &mReflectorDesc.detailAdjust );
mReflectNormalUp = stream->readFlag();
mReflectorDesc.useOcclusionQuery = stream->readFlag();
mReflectorDesc.texSize = stream->readInt( 32 );
stream->read(&mReflectorDesc.texSize);
if ( isProperlyAdded() && !mPlaneReflector.isEnabled() && smEnableTrueReflections )
mPlaneReflector.registerReflector( this, &mReflectorDesc );

View file

@ -43,6 +43,7 @@
#include "T3D/gameFunctions.h"
#include "postFx/postEffect.h"
#include "math/util/matrixSet.h"
#include "console/typeValidators.h"
extern ColorI gCanvasClearColor;
@ -121,10 +122,10 @@ void WaterPlane::initPersistFields()
docsURL;
addGroup( "WaterPlane" );
addProtectedField( "gridSize", TypeS32, Offset( mGridSize, WaterPlane ), &protectedSetGridSize, &defaultProtectedGetFn,
addProtectedFieldV( "gridSize", TypeRangedF32, Offset( mGridSize, WaterPlane ), &protectedSetGridSize, &defaultProtectedGetFn, &CommonValidators::PositiveNonZeroFloat,
"Spacing between vertices in the WaterBlock mesh" );
addProtectedField( "gridElementSize", TypeF32, Offset( mGridElementSize, WaterPlane ), &protectedSetGridElementSize, &defaultProtectedGetFn,
addProtectedFieldV( "gridElementSize", TypeRangedF32, Offset( mGridElementSize, WaterPlane ), &protectedSetGridElementSize, &defaultProtectedGetFn, &CommonValidators::PositiveNonZeroFloat,
"Duplicate of gridElementSize for backwards compatility");
endGroup( "WaterPlane" );