TGC Codebase Backup



Sphere Mapping by Virtual X

10th May 2007 8:11
Summary

Basic Teapot Sphere Mapping



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    REM TeaPot Sphere Mapping Example

sync on
sync rate 0
hide mouse

load object "teapot.x",1
set object cull 1,1

load image "spheremap.bmp",1

set sphere mapping on 1,1

do
 set cursor 0,0
 print "TeaPot Sphere Mapping Example"
 print "-----------------------------"
 print "FPS: "+str$(screen fps())

 inc mouse_x#,wrapvalue(mousemovex())
 inc mouse_y#,wrapvalue(mousemovey())

 rotate camera mouse_y#,mouse_x#,0.0

 if upkey()=1 then inc x#,1.5
 if downkey()=1 then dec x#,1.5
 if leftkey()=1 then inc y#,1.5
 if rightkey()=1 then dec y#,1.5

 rotate object 1,x#,y#,0.0

 sync
loop