> Thanks, ill look at this. But fade it to black... how do
> I fade it to another skybox texture, like from a noon sky
> to a sunset type thing? I know about RGB values, but I've
> never really used memblocks, adressing memory.
Luckily for you, I wanted some functional image transition code so I made up a demo. Notice the frame rate! A make image each loop is bad for speed. Ideally, you should do something like update one row each frame and only do make image from memblock every 256 frames.
The 'sky' textures are simple 256x256 bitmaps.
load image "sky1.bmp", 1, 1
load image "sky2.bmp", 2, 1
skySource = 1
skyDestination = 2
skyTransition = 3
make memblock from image skySource, 1
make memblock from image skyDestination, 2
make memblock from image skyTransition, 1
width as dword
height as dword
depth as dword
global width
width = memblock dword(1,0)
height = memblock dword(1,4)
depth = memblock dword(1,8)
size = get memblock size(1)
sync on
autocam off
backdrop on
position camera 0,0,0
make object plain 1, 100,100
position object 1, -50,0,400
texture object 1, 1
make image from memblock 3, 3
make object plain 2, 100,100
position object 2, 100,0,400
texture object 2, 3
a = 0
do
a = a + 1
` this is a demo and does 200 transitions and does not farm it out over time
` it does one complete transition per frame
if a <= 200
for b = 1 to 256
for c = 1 to 256
location = getLocation(b, c)* 4 + 12
color1 = memblock dword(1, location)
color2 = memblock dword(2, location)
r1 = rgbr(color1)
g1 = rgbg(color1)
b1 = rgbb(color1)
r2 = rgbr(color2)
g2 = rgbg(color2)
b2 = rgbb(color2)
r3 = int(((r1/200.0) * (200.0-a)) + ((r2/200.0) * a))
g3 = int(((g1/200.0) * (200.0-a)) + ((g2/200.0) * a))
b3 = int(((b1/200.0) * (200.0-a)) + ((b2/200.0) * a))
color3 = rgb(r3,g3,b3)
write memblock dword 3, location, color3
next c
next b
make image from memblock 3, 3
else
` just to stop a run away counter
if a > 200 then a = 201
endif
set cursor 0,0
print "width - ",width
print "height - ",height
print "depth - ",depth
print "size - ",size
print
print screen fps()
print
print "hit space to reset"
print "step - ", a
if spacekey() then a = 0
sync
loop
function getLocation(x as integer, y as integer)
offset = (y-1)*width + x - 1
endfunction offset
Parts of this code was borrowed from another code snippet, but I forgot the author's name. My bad, but thanks for posting it!
--
TAZ
[edit, it seems the code tag is case sensitive]
"Do you think it is wise to provoke him?" "It's what I do." -- Stargate SG-1