Menu

Welcome, Guest. Please login or register.
Did you miss your activation email?
April 21, 2019, 10:34:36 pm

Login with username, password and session length

Author Topic: [ADT] Map reversed  (Read 52 times)

Unbreakables

  • Registred Member
  • GM Isle Explorer
  • *****
  • Posts: 19
    • View Profile
[ADT] Map reversed
« on: April 07, 2019, 03:01:00 pm »
Hi everyone !

I need some precisions on the chunk and tiles pattern. I followed these structure on the wiki :



And all tiles are rotated by 90° :


Something is wrong in the order... The MCNK position is the corner north-east of the tile ?
And if it is, it's the corner north-east on the MCVT ?




And the second mcnk is at the south or the west of the first ?

The wiki isn't really clear on these points.
« Last Edit: April 07, 2019, 03:18:26 pm by Unbreakables »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2960
    • View Profile
Re: [ADT] Map reversed
« Reply #1 on: April 07, 2019, 11:51:55 pm »
in map coordinates, the top left of an adt tile is on the north-west.

Unbreakables

  • Registred Member
  • GM Isle Explorer
  • *****
  • Posts: 19
    • View Profile
Re: [ADT] Map reversed
« Reply #2 on: April 08, 2019, 01:21:17 pm »
Okay, so the algorithm is wrong ? Because if you start from the top-left and draw the tile to the bottom-right, you must increase x and decrease y... Or the opengl axis are inversed ?

The wiki algorithm give map flipped on y (vertical) axis and tile rotated.
Code: [Select]
    gl.glVertex3f( y, x, nL1);
    gl.glVertex3f( y+1, x, nL2);
    gl.glVertex3f(y+0.5f, x+0.5f, L);


If you decrease x and y, tiles aren't rotated, but map still flipped on y.
Code: [Select]
gl.glVertex3f( y, x, nL1);
    gl.glVertex3f( y-1, x, nL2);
    gl.glVertex3f(y-0.5f, x-0.5f, L);




If you don't inverse y and x, and decrease both, map aren't flipped on y, but tiles are rotated...
Code: [Select]
    gl.glVertex3f( x, y, nL1);
    gl.glVertex3f( x, y+1, nL2);
    gl.glVertex3f(x+0.5f, y+0.5f, L);




I don't understand... If the position is the top-left, and the tile's height are stored like on the wiki (left to right, top to bottom), we should just draw it left to right (positive x) and top to bottom (negative y) no ?

I tried like this and tiles are rotated by 90° and the position isn't on the top-left but in the bottom-left... Like if the y axis was reversed...

I will become crazy.

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2960
    • View Profile
Re: [ADT] Map reversed
« Reply #3 on: April 08, 2019, 09:17:57 pm »
Yeah, wow coordinate systems are a bitch. The ADT article has some ramblings on top that might help. Otherwise I suggest looking at existing software, a lot.

In this case i mostly suggest mirroring not on a per chunk drawing basis but one pushmatrix above. That way, not every single chunk is wrong but the entire terrain should be transformed ;)