$12256 / $11500

Thursday, March 24, 2022 - 11:13

Hi,

I would like to understand the rationally behind the calculatePriosIso() and calculatePriosOrtho() methods in MapRenderer.cpp

I do get the general idea of calculate a priority number to sort the objects, but the math here doesn't make sense for me , how this guarantee the correct order?

From where those numbers used on the shift operation come from? 37 ? this doesn't make sense for me.

Regards,

joined 10 years 8 months agoStefan Beller, the original author of that code, wrote an explanation at one point. But it seems to have gotten lost for some reason (probably due to the Github organization migration). Luckily, I saved the email, so here's what he wrote: https://gist.githubusercontent.com/dorkster/ddd19a0c91400ffd1c31c8ba18df...

I'll also attach the graphic he made, since I think it does an even better job of showing how the information is laid out. Granted, the description is a bit out of date since we don't have the 256x256 map size restriction anymore. Which is why the shift amounts are different in the current version.

The TL;DR explanation is that there are 4 critera for sorting. In descending order of importance:

f7e9b0ac-633c-11e3-8f98-8f79101823b6.png 14.4 Kb [1 download(s)]