DarkBasic 1.13 version
remstart
Rotating plasma cube (DarkBasic 1.13 version)
(C) Deckard, AtD, 2004
remend
sync on:sync rate 50:dim sit(255):set display mode 1024,768,32:hide mouse
for i=0 to 255:sit(i)=int(127.0*(1.0+sin(i*360.0/256.0))):next i
create bitmap 1,32,32:make memblock from bitmap 1,1:set current bitmap 0
mode=1:k=0:m=0:a=0:autocam off:make object cube 1,1:color backdrop 0
do:k=(k+1)&255:m=(m+3)&255:p=12:for j=0 to 31:for i=0 to 31
` plasma RGB value calculation
r=sit(sit(sit((sit(i)+sit((j+m)&255)-sit(k))&255))):g=sit(sit((sit(3*i)+sit((4*j+k)&255)+sit(m))&255)):b=sit(sit((sit(2*i)+sit(3*j)+sit(k))&255))
write memblock byte 1,p,r:p=p+1:write memblock byte 1,p,g:p=p+1:write memblock byte 1,p,b:p=p+2
next i:next j:make image from memblock 1,1:obj=1:if object exist(obj)>0 then delete object obj
make object cube obj,50:set object obj,1,1,0,mode,0,0,0:ghost object on obj:texture object obj,1
a=wrapvalue(a+1):if a=0:mode=1-mode:endif:position camera 10*sin(a),11*sin(a),8*cos(a):point camera 0,0,0:sync:loop
DB Pro version
remstart
Rotating plasma cube (DBPro version)
(C) Deckard, AtD, 2004
remend
sync on:sync rate 50:dim sit(255):set display mode 1024,768,32:hide mouse
for i=0 to 255:sit(i)=int(127.0*(1.0+sin(i*360.0/256.0))):next i
create bitmap 1,32,32:make memblock from bitmap 1,1:set current bitmap 0
mode=1:k=0:m=0:a=0:autocam off:make object cube 1,50:color backdrop 0
do
k=(k+1) and 255:m=(m+3) and 255:p=12
for j=0 to 31:for i=0 to 31
` plasma RGB value calculation
r=sit(sit(sit((sit(i)+sit((j+m) and 255)-sit(k)) and 255)))
g=sit(sit((sit(3*i)+sit((4*j+k) and 255)+sit(m)) and 255))
b=sit(sit((sit(2*i)+sit(3*j)+sit(k)) and 255))
write memblock byte 1,p,r:p=p+1:write memblock byte 1,p,g:p=p+1:write memblock byte 1,p,b:p=p+2
next i:next j
make image from memblock 1,1
texture object 1,1
a=wrapvalue(a+1)
position camera 100*sin(a),110*sin(a),80*cos(a):point camera 0,0,0
sync
loop