Dead Hackers Society
Other BBSes »
 
 
Demoscene  Coding  CT60  Buy/sell

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]

Topic Posted by  Date 
Gouraud-shaded Texturemapper ray Jan,05.2014-20:16
  Re: Gouraud-shaded Texturemapper mOdder Jan,05.2014-22:44
  WWW Cyprian Jan,06.2014-15:24
    Re: WWW gwEm/PHF Jan,07.2014-12:47
      Re: WWW ray Jan,09.2014-09:54
        Re: WWW lotek style/tscc^ymr Jan,09.2014-14:01
          Re: WWW ray Jan,16.2014-18:04
            Re: WWW gwEm/PHF Jan,20.2014-12:35
              Re: WWW Cyprian Jan,27.2014-16:21


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

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.
© 1994-2024 Dead Hackers Society Contact: Anders Eriksson