stwe / MDCII

An unofficial project making from scratch to create an editable Anno 1602 world.
GNU General Public License v2.0
7 stars 2 forks source link

Add zoom (GFX, MGFX, SGFX) #7

Closed stwe closed 2 years ago

stwe commented 2 years ago

So far only GFX graphics are used. Add MGFX and SGFX.

siredmar commented 2 years ago

i guess using the whole OpenGL universe, it would not take too much effort implementing a continuous zoom switching sgfx, mgfx and sgfx in it's useful range, right? zooming could be done using the mousewheel. what do you think?

stwe commented 2 years ago

continuous zoom : Yes and No.

I wanted to try this, since it is the most obvious and easiest solution. It only requires changing the scaling of the tile and I always give the scaling to the GPU anyway.

No, because I will get a problem with mouse picking. Take a look at the texture corner.png in resources/textures. We currently need such a graphic for each scaling, so that it can be calculated which tile is currently clicked. So there will be three such graphics soon.

There is another possibility. For this, each tile gets a unique color, so that the color can be used as ID. Then the map is rendered twice. Once only with the color and then with the normal texture. If the mouse is clicked now, the tile can be determined by the color. This also works with a stepless scaling, but is slow and needs some optimization.

I will implement variant A for now, but variant B is not out of the race yet.