OpenGL Terrain editor#59
Conversation
|
I'm wondering if I should remove the VBOs. GPU cached terrain triangles. Just re-draw them every frame there's not a huge amount of them even when zoomed out fully and diff might be a bit smaller/closer to original. |
| // BEGIN: /GFX/TEXTURES/TEX5.LBM | ||
| TILESET_GREENLAND_8BPP, | ||
| TILESET_GREENLAND_32BPP, | ||
| TILESET_GREENLAND, |
There was a problem hiding this comment.
Doesn't this break stuff? IIRC those were used as indices somewhere
There was a problem hiding this comment.
s25edit has P button to toggle 8bit/32bit terrain rendering marked experimental in F1 help window text.
Doesn't really make sense, maybe it was to add shadows. With OpenGL textures always being 32bit it really doesn't make sense to keep.
Also CFile had a pre-existing bug it would intermittently use the wrong colorkey and not have transparency on terrain edges.
Seems to make sense to use them given the map is mostly static. Do the VBOs still handle animated textures correctly? That would be a reason to not use them. Or limit to positions only, but I guess that wouldn't save much work
What do you mean by that? |
|
I mean relative to modern games a settlers2 map doesn't have many triangles. Biggest gain will be getting rid of 4K penalty ~33MB/frame ~2GB/second@60fps. yeah VBO is useful, but increases diff a lot and makes review harder for probably not too much benefit. Might be better to do as follow up. Also I just struggled to get nice diff that correctly aligns functions with all the the VBO code inserted above existing code. |
|
Also this PR still draws triangles to pixel positions and recalculates them on zoom. Would be better to use glScale(). But I think doesn't matter here can do in later PR, there's a lot more that could be done that would make PR bigger. |
21f26dd to
8aa535c
Compare
|
|
Maybe should have kept the flat ids, but with libsiedler2 there is a Archiv per file and they're no longer loaded into an array. I guess it doesn't matter tho. But could've used offsets or modulo to forward ranges to different Archiv objects. Nah. I'm glad I reverted the VBO and I'll be happy to do that in a follow up PR, also reworking zooming using glScale and using glDrawElements to repeat the vertice array for the wrapping. This PR retains wrapping bugs. Probably need to inline DrawTriangle and diff won't show changes side by side. And need to load map texture files based on GDL and remove hadcoded files, positions etc. Also was a bit unsure about switching to libsiedler2 but actually worked out nice, rather than adding palette animations to CFile. And will allow using filenames from GDL to load textures not using fixed positions in global::bobBMP. |
|
It's of course possible to use CFile which would make this PR a lot smaller. But CFile doesn't yet support palette animations and creates SDL_Surface directly for tetxtures so this seems like a good PR to switch. The libsiedler2 changes kinda buried the actual OpenGL changes in CSurface.cpp which is the main part of this PR. Also the Texture picker window uses hardcoded list of textures so maybe not possible to fully use GDL. |
fcdd815 to
7e8b8ab
Compare
97bf8a4 to
0730780
Compare
0730780 to
b13d98f
Compare
Removes Surf_Map and renders terrain editor with OpenGL
It actaully works great as parallel branch & PR, only depends on some CFont and Texture changes from gl2-ui which have been pulled into this branch. If they are identical they shouldn't even conflict. Could extract to shared parent commit, but prob easiest to deal with any conflicts when the other/this PR is merged. There's minimal overlap.
Still working a bit on this one I didn't expect to submit it so early, but all feedback welcome even if quick and inaccurate.