lunedì 29 novembre 2010

Drawing the map...

With the new dynamic map system i am facing some troubles in the old map paiting code...

I managed to make the code work... Its just a preliminary attempt to be refined... but it works.

The problem was this:
QRectF visible_area( translation_offset, scaled_size );
this rect has top/bottom inverted after applying the transformation matrix which mirrors the Y axe up/down...

Rebuilding the rect corner-by-corner fixes this. The point is, why do i have to do this? Shouldn't the way i create rectangles on the logical reference system be indipendent of the transformation mapping? When dealing with these things i always have the feeling something is missing... like now.

Update: Fixed for good. Now its clear my error! I was using one single point to identify both the translation offset and the screen starting corner! But since i am flipping the Y ax, actually those are two different points:
- screen starting corder: as usual, its the top-left corner
- offset: its the BOTTOM-left corner, due to the ax-flipping!

Fixed that, now to the map caching stuff!

First of all, i need to fix the chunk loading alghoritm, then i need to implement the caching stuff.

Nessun commento:

Posta un commento