-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added water options to 'TopMenubar/Settings' menu. #3142
base: master
Are you sure you want to change the base?
Conversation
6f67ed0
to
7409958
Compare
7409958
to
e0f8b62
Compare
I've bumped this PR with one small fix. I couldn't fix the glitch but I got closer, see #3137 (comment) |
RoR_2024-08-06_01-59-35.mp4Switching between reflection water types often results in white, and Hydrax always crashes: The options remain shown when on a terrain that doesn't feature water (but doesn't do anything besides crash without error if Hydrax is selected) Real time waves adjustment is fun, also now would be a good opportunity to add a water level slider. |
Looks like something isn't cleaned up properly and then duplicates and breaks. Might also be Cg or Ogre bug. |
The module type isn't configurable, it's hardcoddd in hydrax setup - file 'HydraxWater.cpp', function `InitHydrax()`. The corresponding dummy line was removed from file 'HydraxDefault.hdx' and the check for it's presence was removed from file 'hydrax/Module.cpp'
Most occurences are long commented out, but this one slipped because nobody called that function until I started working on diag. UI.
This version is based on HydraX hardcoded defaults, but needs to be adjusted based on RoR's defaults.
Also cleaned up code and fixed a bug in Terrain.cpp - game would crash if other Water mode than HydraX was selected.
Codechanges: * DustPool.cpp - // Make sure water wasn't disabled in Top menubar - if yes, just drop the particle. * Water.cpp - just code cleanup actually - to clarify the water plane is the same with or without waves - so they can safely be toggled ad-hoc. * GUIUtils - DrawGCombo() now returns bool - true if value changed. * GUI_TopMenubar.cpp - change cvar `gfx_water_mode` and run `Terrain::reInitWater()` * Terrain - added function `reInitWater()`
uninitialized variable :/
Uninitialized variables `m_cam_forced`* :/ I cleaned up the variable init, using in-class initializers for all.
e0f8b62
to
cf91749
Compare
@CuriousMike56 I tried only under Dx9 and didn't see the white surfaces... but I got a lot of other glitches/crashes. I fixed switching between all modes except Hydrax which still crashes when toggled the 2nd time. |
Summary of changes: * introduced ✉️ `MSG_SIM_REINIT_WATER_REQUESTED` - Request restarting water subsystem based on cvar 'gfx_water_mode'; sent by TopMenubar UI, also accepted from scripts via `game.pushMessage()`. * HydraX resources are now loaded each time. * Removed all direct interaction with HydraX - both classic water (Water.cpp, `class Water`) and HydraX water (HydraxWater.cpp, `class HydraxWater`) are now controlled exclusively via interface `IWater` - see comments in file 'IWater.h' * Added 'active_water_mode' field to `IWater` - because the cvar 'gfx_water_mode' can now change anytime.
cf91749
to
41239a5
Compare
Looks like the white surfaces are gone now. Hydrax options seem to do nothing: RoR_2024-08-18_21-55-36.mp4Switching to Hydrax results in visual glitches: RoR_2024-08-18_22-03-45.mp4And finally, basic water visuals freeze if waves are disabled: RoR_2024-08-18_21-59-46.mp4 |
I tried to investigate #3137 but got nothing. So I at least analyzed the water code and added UI for tweaking HydraX water.
Both basic water with waves and HydraX water boil down to the same thing: a dynamic grid-mesh updated in code. The only major difference is how the waves are calculated: Basic uses configurable "wave trains", HydraX uses Perlin noise with adjustable params (via .hdx config file). Since both systems are in our codebase, it would make sense to unify them. To better understand how the system operates, I added the UI.