TGC Codebase Backup



Shadow Volumes by Erick G

31st Oct 2004 20:18
Summary

Shadow volumes in Dark Basic Professional by Erick



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    sync on
autocam off

rem Floor
make object cube 100,10
color object 100,rgb(255,255,255)
position object 100,0,-3,5
scale object 100,300,50,300
set ambient light 10
set point light 0,0,20,0

rem Shadow Caster
make object cube 101,5
position object 101,0,5,5

rem Light object
make object cube 102,1
position object 102,0,20,5

set normalization on
set shadow shading on 101
set object light 102, 1

rem Position Variables
xpos#=0
zpos#=0
rotx#=0

rem Camera
make camera 1000
position camera 1000,0,30,30
point camera 1000,0,0,0

do
   if leftkey()=1 then  xpos# = xpos# + .1
   if rightkey()=1 then xpos# = xpos# - .1
   if upkey()=1 then  zpos# = zpos# - .1
   if downkey()=1 then zpos# = zpos# + .1
   if spacekey()=1 then rotx# = rotx#+1
   position object 102,xpos#,20,zpos#
   position light 0,xpos#,20,zpos#
   rotate object 101,0,rotx#,0
   sync
loop