Ahh, gotta remember that 'My Threads' list, made finding the skygrabber nice and easy
, here's that code:
`Skygrabber, by Van-B
`This will render a skysphere at the camera location at any resolution - SLOW though
if image exist("skysphere.bmp")=0
rendersky("skysphere.bmp",1024)
else
load image "skysphere.bmp",6,1
`create_skysphere(objectno,texture,radius#)
create_skysphere(200,6,5000.0)
position object 200,camera position x(),camera position y(),camera position z()
do
rotate camera mousey(),mousex(),0
sync
loop
endif
function create_skysphere(o,t,r#)
make object sphere o,r#/2.0
texture object o,t
set object light o, 0
set object texture o, 3, 0
set object fog o,0
set object cull o,0
set camera range 10,r#+50.0
endfunction
function rendersky(fn$,res)
file=2
if file exist(fn$)=1 then delete file fn$
img_res1=res/256
img_res2=res-(img_res1*256)
open to write file,fn$
write byte file,66
write byte file,77
write byte file,54
write byte file,48
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,54
write byte file,0
write byte file,0
write byte file,0
write byte file,40
write byte file,0
write byte file,0
write byte file,0
write byte file,img_res2
write byte file,img_res1
write byte file,0
write byte file,0
write byte file,img_res2
write byte file,img_res1
write byte file,0
write byte file,0
write byte file,1
write byte file,0
write byte file,24
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,48
write byte file,0
write byte file,0
write byte file,67
write byte file,12
write byte file,0
write byte file,0
write byte file,67
write byte file,12
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,0
`This will mess up your view
px=screen width()/2
py=screen height()/2
set camera fov 2
set camera view px-8,py-8,px+8,py+8
for dy=res-1 to 0 step -1
for dx=0 to res-1
ya#=(((dx*1.0)/(res*1.0))*360.0)
xa#=(((dy*1.0)/(res*1.0))*180.0)-90.0
rotate camera xa#,ya#,0
text 0,0,str$(int(dy/(res/100.0)))+"% Complete"
`You'll need this if your using terrain
`update terrain
sync
col=point(px,py)
r=rgbr(col)
g=rgbg(col)
b=rgbb(col)
write byte file,b
write byte file,g
write byte file,r
next dx
next dy
close file file
`This will need changing no doubt
set camera fov 60
set camera view 0,0,screen width(),screen height()
endfunction
This code contains the viewer and the renderer. Run it once and it'll render the sphere from the camera location, run it again and it'll load it up and display it 3D screenshot style. Really you just need to nab the grabber function and add it to your own code - then just call it on a keypress or something when the cameras in position.
Van-B
Quote: "How could I condescend you?, you don't even know what it means!"
Van-B's mom.