|
Atari coding BBS
Gouraud-shaded Texturemapper |
Posted by: ray
|
Jan,05.2014-20:16
|
Hi everyone,
digging through some of my old TT030 code archives I rediscovered this:
Arbitrary size Gouraud-Shaded Texturemapping innerloop in 7 instructions (256 colors)
move.l d0,d1 ; UUuuVVvv
lsr.w #8,d1 ; UUuu--VV
rol.l #x,d1 ; uu--VVUU
move.b (a0,d1.w),d2 ; Load texel
move.b (a1,d2.l),(a2)+ ; Shade texel and store to screen buffer
add.l d3,d0 ; UUuuVVvv += dUUuuVVvv
adda.l a3,a1 ; Increment shade
The trick is to setup the shading table (a1). In my case it has 1024 * 256 entries and gives the closest color match for a given color (256) scaled by the apropriate shade (1024) given as 10 bits fraction.
The texture-size can be any combination of powers of two (<256) and is controlled by the rol size (#x).
Hope this makes sense.
Feel free to use this in your own prods.
Best,
Ray
|
[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.
|