|
Atari coding BBS
Texture U/V misunderstanding |
Posted by: Orion_
|
Jan,24.2015-17:41
|
I saw this page about texture mapping and I'm trying to implement the last routine in my 3D Engine:
http://s390174849.online.de/ray.tscc.de/fatmap.htm
In theory I understand it, but I can't make it work for a simple reason
If we have "UUuuVVvv" in a register (8.8 fixed point)
we do this tiny loop:
.loop:
move.l d3,d0 ; UUuuVVvv
lsr.w #8,d0 ; UUuu--VV
rol.l #8,d0 ; uu--VVUU
move.b (a1,d0.w),(a0)+ ; *screen++ = tex[U/V];
add.l d4,d3 ; tx += mtx; ty += mty;
dbra d1,.loop
The problem is that the add.l isn't working, here is what I get in steam debugger:
move.l #$00010001,d0 ; U = 1 V = 1
moveq #0,d1
add.l d0,d1 ; $00010001 ok
add.l d0,d1 ; $00020002 ok
add.l d0,d1 ; $00030003 ok
move.l #$0001FFFF,d0 ; U = 1 V = -1
moveq #0,d1
add.l d0,d1 ; $0001FFFF ok
add.l d0,d1 ; $0003FFFE wrong, should be $0002FFFE
add.l d0,d1 ; $0005FFFD wrong, should be $0003FFFD
so, what did I misunderstand ?
|
[All messages in this thread] [Start new thread]
What's the anti-troll code? That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
|