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
WIP: 3d floor support in the map editor 3d mode. #966
WIP: 3d floor support in the map editor 3d mode. #966
Conversation
Sorry for leaving this hanging for so long! I haven't gotten back to Doom stuff for a while. Here's my own TODO list, though I can't guarantee it's entirely up to date:
|
@eevee Super helpful! Many thanks. This is going to give me a lot to think about while reading the code. |
There are a few things I was going to do in the refactor/cleanup that may affect (and/or help) this, particularly to do with how sector floors/ceilings are stored and handled. If you look at the std_string_313_refactor branch, I've added a Ideally I'd like to completely rewrite the 2d/3d rendering code to use modern opengl and have 3d floors in mind from the ground up, but that would be a lot of work :P Though if I ever want to properly support previewing some more advanced GZDoom features in 3d mode i'd probably have to do that anyway :/ |
For a non-Vavoom 3D floor, that makes sense, since the top of the floor is the control sector's ceiling. The terms "upper plane" and "lower plane" could be used instead but you'd have to keep the Vavoom type in mind because for them the upper plane of the 3D floor is the control sector's floor. (The control sector in a Vavoom floor having a negative height, with the floor above the ceiling.) |
9b25b10
to
f4f0390
Compare
A complete rewrite with all the GZDoom bells and whistles would be the coolest thing, but since it's probably something that's not going to happen any time soon... Would It be OK (the second coolest thing) if I bring to this branch some of the changes you have done in 'std_string_313_refactor'? From that spot we could rework some of this and finish it. As it stands now, far from complete and unpolished, it's OK for my needs with a couple more adjustments, but leaving this to rot being so close to something release worthy would be a shame. |
Hmm, I'd say wait until I add it in master, to avoid a merge conflict mess :P I am currently in the process of working on the MapEditor source files cleanup - I'll do the MapSector/Surface stuff along with it so it shouldn't be too much longer to wait. |
Preparation for supporting 3D floors.
Lots of features are missing, there are no walls yet, sometimes the alpha doesn't work right, and 2D mode is broken. But it does work!
Now each renderer just remembers its own VBO offsets per sector/flat, which makes more sense anyway since they have their own VBOs.
- VBOs are no longer corrupted when making 3D edits! This had haunted 3D floor rendering since the beginning, but the problem turned out to not be in the renderer at all -- rather, MapSpecials kept re-adding the same 3D floors to the target sectors on every update, without clearing the originals. The renderer would then dutifully create some flat structs, but because the geometry hadn't actually changed, the code that reassigns all the VBO offsets never ran, and the new structs had garbage offsets which wrote junk to who knows where. Now MapSpecials just nukes all the 3D floors on every update pass. A more robust solution will involve incremental updates, but this is good enough for now. It may still be possible for corruption to occur if a tag or special is changed in such a way that the total number of 3D floors changes, but currently you can only make such a change in 2D mode, and I believe VBOs are recreated from scratch when switching into 3D mode. - The "flat plane at ceiling height" flag is now supported. - Floor and ceiling panning, rotation, and scale are now correct when switching to 3D mode. They'd been unreliable for some time, and the culprit was just that the code that first creates VBOs doesn't check for those properties, but the code that updates existing VBOs does. - The 3D renderer's cached flats remember their control sector, so 3D floors now correctly check floor/ceiling properties on the control sector rather than the target sector. - Cleaned up VBO code a bit in general. updateSector no longer has a silly argument for whether to skip half its effort; Polygon2D's updateVBOData was removed, as it's now identical to writeToVBO; we no longer reserve twice as much VBO space as necessary.
The camera gravity is updated on a timer, so it could be called before the sector flats were calculated. The easy fix was to use the original extra_floors instead of the sector flats, which turned out to be easier anyway. As an added bonus, now gravity only checks for solid 3D floors.
This is necessary for 3D mode to know to update the floors when the control sector's height changes.
- The 3D info overlay is now aware when it's looking at the top or bottom plane of a 3D floor, and (mostly) correctly checks for the properties on the control sector. - Changing the height of a 3D floor's floor or ceiling with the mouse wheel now works correctly.
This was causing duplicated 3D floors and leading to more VBO corruption. It's no longer necessary, since we now recompute all specials for the entire map every time something changes.
By default, MapSector::getColour returns the sector color modified by the light level, so effectively the light level was being squared. Requesting the "fullbright" color fixes this.
(cherry picked from commit 6400c46dff4df41fe669954f378ee79657fb6935)
… flags like upper/lower texture for side) (cherry picked from commit e05a9b7b131a8974f446d5c355f79e6be77e9f24)
(cherry picked from commit c0f85ee4c6c800df7642e495755bf705e7182b22)
(cherry picked from commit fd6768e5ded0e177159d7e6c4675ba984ca13af9)
(cherry picked from commit c0a517efe1d886a1826fb328982a9e1f66032f4d)
(cherry picked from commit 8adbf4c9e0347d89dd565d71779ff492f77d8db6)
(cherry picked from commit 13bf9ffa99db807fbc5bef321bef5a19851f24dd)
…estination sectors. Fixes #1 (cherry picked from commit 4edf93ccd0b38e16d95e989a59fceefe6af220fb)
f4f0390
to
02a129a
Compare
So when's this going to get picked up again? |
@OrdinaryMagician after refactoring of Slade. |
I've finally adapted this one to the latest codebase in #1358, so I'll close this PR to be continued there |
@sirjuddington I'm putting this up here to better asses what has to be done.
It's far from ready. The more feedback everyone can provide about this the better.