Kromster80 / kam_remake

"KaM Remake" is an RTS game remake written in Delphi from scratch.
http://www.kamremake.com
GNU Affero General Public License v3.0
355 stars 88 forks source link

Draw tiles with VBO, if possible #416

Closed reyandme closed 7 years ago

reyandme commented 7 years ago

Use VBO when render tiles, if possible. It could be imposible, if only 512 textures are supported or if we will add many tiles in future, and then even 1024 will be not enought. Now we still have 131 free place for new tiles. Ehh...one day somebody will draw new tiles :)

So basically it will be always VBO, and it is good .

Can significantly improve performance - on my PC for some big map, from 20FPS (after previous improvements, before them it was 15 FPS) up to 26-29FPS.

To use VBO for every tile I set 4 vertices, because each vertex can have different UV coordinates for surrounding textures. That is why we have to duplicate X,Y,Z and even Light,Shadow,FOW info.

Another option is to use separate arrays for tiles and for Light,Shadow,FOW. It will save some memory, but on the other hand it will require another indices array which probably will use same amount of memory. Also our application is not much video memory consuming, I believe, so its not a big deal IMHO.

This PR includes #415, so you can approve that one first and then this one, or just this one

There is a question about water animation. All water animation are also in 1 atlas now. But probably its not possible, because animation is from tile to tile, and I do not know any way to skip data from array, when there is no animation. Am I right?