Code: Select all
#include "openb3d.bi"
function torus cdecl(a as single, b as single, c as single) as single
dim q as single
q=sqr(a*a+b*b)-2*abs(sin(timer))
return 1-(q*q+c*c)
end function
screen 18, 32, , &h10002
Graphics3d 640,480,32,1,1
var camera=createcamera(0)
var fluid=createfluid
entitycolor fluid,128,255,128
fluidfunction fluid, @torus
moveentity camera,0,0,-5
'entityfx fluid,4
var light=createlight()
positionentity light,5,5,-5
dim key as string, w as integer
do
key=inkey
if key=chr(255)+"H" then turnentity camera,1,0,0,0
if key=chr(255)+"P" then turnentity camera,-1,0,0,0
if key=chr(255)+"M" then turnentity camera,0,-1,0,0
if key=chr(255)+"K" then turnentity camera,0,1,0,0
if key="a" then moveentity camera,0,0,1
if key="z" then moveentity camera,0,0,-1
if key=" " then w=1-w: wireframe w
updateworld
renderworld
sleep 1
flip
loop until key=chr(27)