|
Atari coding BBS
Re: Flow map |
Posted by: evil
|
May,02.2013-14:32
|
The offsets are usually stored byte per x and y. So create a "flat" offset map of 256x256 (or other resolution depending on your texture size) as a 24 bit TGA, use two of the three channels in the TGA for that. The easiest way is probably to make a blank 256*256 24-bit TGA in a graphics program, include it in your program, fill the buffer with the flat offset map (header is 18 bytes) and dump it out as a new TGA.
Load the TGA to Photoshop or whatever program for mapping/distorting. Save as TGA again after the distortion is done, then extract the two channels with offset data, voila you now have an offset map that will deform the texture.
The code for flat offset map generation would be something like:
moveq #0,d1 ;y
lea tga+18,a0
move.w #256-1,d7
.y:
moveq #0,d0 ;x
move.w #256-1,d6
.x:
move.b d0,(a0)+
move.b d1,(a0)+
addq.l #1,a0 ;skip unused channel in the TGA
addq.b #1,d0
dbra d6,x
addq.b #1,d1
dbra d7,.y
Minus all the errors that I didn't spot now :)
--
Anders Eriksson
ae@dhs.nu
|
[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.
|