From 96134e12adb7a6f673f3b6a9a7f392535dd158da Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Sat, 2 Aug 2025 15:04:43 -0500 Subject: [PATCH] adress odd water values review of watergrid value exposure and transform saver usage --- Engine/source/environment/waterBlock.cpp | 7 ++----- Engine/source/environment/waterBlock.h | 2 +- Engine/source/environment/waterObject.cpp | 3 +++ Engine/source/environment/waterPlane.cpp | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Engine/source/environment/waterBlock.cpp b/Engine/source/environment/waterBlock.cpp index 4ec20ebf9..3ee500494 100644 --- a/Engine/source/environment/waterBlock.cpp +++ b/Engine/source/environment/waterBlock.cpp @@ -531,12 +531,9 @@ void WaterBlock::initPersistFields() docsURL; addGroup( "WaterBlock" ); - addProtectedFieldV("gridSize", TypeRangedS32, Offset(mGridElementSize, WaterBlock), &setGridSizeProperty, &defaultProtectedGetFn, &CommonValidators::NaturalNumber, + addProtectedFieldV("gridSize", TypeRangedF32, Offset(mGridElementSize, WaterBlock), &setGridSizeProperty, &defaultProtectedGetFn, &CommonValidators::PositiveFloat, "Spacing between vertices in the WaterBlock mesh"); - - addProtectedFieldV("gridElementSize", TypeRangedS32, Offset(mGridElementSize, WaterBlock), &setGridSizeProperty, &defaultProtectedGetFn, &CommonValidators::NaturalNumber, - "Duplicate of gridElementSize for backwards compatility"); - + addProtectedFieldV("gridElementSize", TypeRangedF32, Offset(mGridElementSize, WaterBlock), &setGridSizeProperty, &defaultProtectedGetFn, &CommonValidators::PositiveFloat, "Duplicate of gridElementSize for backwards compatility"); Parent::initPersistFields(); } diff --git a/Engine/source/environment/waterBlock.h b/Engine/source/environment/waterBlock.h index fcb115841..555a8a8a6 100644 --- a/Engine/source/environment/waterBlock.h +++ b/Engine/source/environment/waterBlock.h @@ -82,7 +82,7 @@ private: GFXPrimitiveBufferHandle mRadialPrimBuff; // misc - U32 mGridElementSize; + F32 mGridElementSize; U32 mWidth; U32 mHeight; F32 mElapsedTime; diff --git a/Engine/source/environment/waterObject.cpp b/Engine/source/environment/waterObject.cpp index a98861d32..66113f43d 100644 --- a/Engine/source/environment/waterObject.cpp +++ b/Engine/source/environment/waterObject.cpp @@ -45,6 +45,7 @@ #include "T3D/sfx/sfx3DWorld.h" #include "sfx/sfxTypes.h" #include "console/typeValidators.h" +#include "gfx/gfxTransformSaver.h" GFXImplementVertexFormat( GFXWaterVertex ) { @@ -699,6 +700,8 @@ void WaterObject::prepRenderImage( SceneRenderState *state ) if( !state->isDiffusePass() ) return; + GFXTransformSaver saver; + // Setup scene transforms mMatrixSet->setSceneView(GFX->getWorldMatrix()); mMatrixSet->setSceneProjection(GFX->getProjectionMatrix()); diff --git a/Engine/source/environment/waterPlane.cpp b/Engine/source/environment/waterPlane.cpp index 7c9d9ec73..9e6f191a8 100644 --- a/Engine/source/environment/waterPlane.cpp +++ b/Engine/source/environment/waterPlane.cpp @@ -124,9 +124,7 @@ void WaterPlane::initPersistFields() addProtectedFieldV( "gridSize", TypeRangedS32, Offset( mGridSize, WaterPlane ), &protectedSetGridSize, &defaultProtectedGetFn, &CommonValidators::NaturalNumber, "Spacing between vertices in the WaterBlock mesh" ); - - addProtectedFieldV( "gridElementSize", TypeRangedS32, Offset( mGridElementSize, WaterPlane ), &protectedSetGridElementSize, &defaultProtectedGetFn, &CommonValidators::NaturalNumber, - "Duplicate of gridElementSize for backwards compatility"); + addProtectedFieldV("gridElementSize", TypeRangedF32, Offset(mGridElementSize, WaterPlane), &protectedSetGridElementSize, &defaultProtectedGetFn, &CommonValidators::PositiveFloat, "Duplicate of gridElementSize for backwards compatility"); endGroup( "WaterPlane" ); @@ -699,6 +697,8 @@ void WaterPlane::prepRenderImage( SceneRenderState *state ) if( !state->isDiffusePass() ) return; + GFXTransformSaver saver; + mBasicLighting = dStricmp( LIGHTMGR->getId(), "BLM" ) == 0; mUnderwater = isUnderwater( state->getCameraPosition() );