DarkBASIC Professional Help Wiki
Register
Advertisement


This command will switch on the rendering of the static universe as a wireframe visual, great for inspecting the geometry for overuse of polygons or problem meshes, and could even be a cool feature of your application

Syntax
SET STATIC OBJECTS WIREFRAME ON
Returns

This command does not return a value.

Example Code
cls 0 : ink rgb(255,255,255),0 : circle 16,16,14

scorchimage=1 : get image scorchimage,0,0,32,32

set static universe 40*100,21*100,40*100

tfile$="universe.dbo"

if file exist(tfile$)=1

 dividetexturesize=0 : load static objects tfile$,dividetexturesize : omax=1

else

 collision=2 : Arbitraryvalue=0 : shadow=1 : portal=1 : o=1

 for x=0 to 10 : for z=0 to 10

  make object box o,100,5,100 : position object o,x*100,2.5,z*100

  make static object o,collision,Arbitraryvalue,shadow,portal : inc o

  if x=6 and z=6

   make object cube o,25 : make mesh from object 1,o : position object o,x*100,-10,z*100

   for l=1 to 15 : add limb o,l,1 : offset limb o,l,0,l*28,0 : make static limb o,l,collision,Arbitraryvalue,shadow,portal : next l : inc o

  endif

 next z : next x

 for w=1 to 4

  if w=1 then sx=1000 : sz=50 : px=500 : pz=0

  if w=2 then sx=1000 : sz=50 : px=500 : pz=1000

  if w=3 then sx=50 : sz=1000 : px=0 : pz=500

  if w=4 then sx=50 : sz=1000 : px=1000 : pz=500

  make object box o,sx,200,sz : position object o,px,100,pz

  make static object o,collision,Arbitraryvalue,shadow,portal : inc o

 next w

 for er=12 to 33 : delete static object er : next er

 build static portals : delete light map lights : add static objects to light map pool

 make object cube o,100 : position object o,600,75,400 : add object to light map pool o

 make mesh from object 3,o : add limb o,1,3 : offset limb o,1,0,0,-125

 add limb to light map pool o,1 : inc o

 add light map light 400,90,800,500,255,0,0,50,1

 add light map light 200,90,400,500,0,255,0,50,1

 add light map light 800,90,200,500,0,0,255,50,1

 texturesize=16 : texturequality=1 : lightmapsavepath$="lightmaps"

 if path exist(lightmapsavepath$)=0 then make directory lightmapsavepath$

 create light maps texturesize,texturequality,lightmapsavepath$

 if file exist(tfile$)=1 then delete file tfile$

 save static objects tfile$ : omax=o

 for i=1 to omax-1 : delete object i : next i

endif

set static scorch scorchimage,1,1

d=omax : make object cone d,100 : make mesh from object 2,d : add limb d,1,2 : rotate limb d,1,90,0,0

offset limb d,1,0,0,50 : scale limb d,1,30,100,30

position object d,500,150,600 : color object d,rgb(255,255,0) : yrotate object d,0 : attach object to static d

make object cube d+1,50 : position object d+1,700,200,500 : make object box d+2,100,100,20 : make object box d+3,80,80,40

perform csg difference d+2,d+3 : position object d+3,100,150,925 : position object d+2,100,50,925

make object box d+4,100,100,20 : make object box d+5,80,80,40 : perform csg union d+4,d+5 : position object d+5,300,150,925 : position object d+4,300,50,925

make object box d+6,100,100,20 : make object box d+7,80,80,40 : perform csg intersection d+6,d+7 : position object d+7,500,150,925 : position object d+6,500,50,925

make object box d+8,100,100,20 : make object box d+9,80,80,40 : perform csg clip d+8,d+9 : position object d+9,700,150,925 : position object d+8,700,50,925

make object sphere d+11,75,30,30 : make mesh from object d+11,d+11 : reduce mesh d+11,0,0,10,5,10

delete object d+11 : make object d+11,d+11,0 : position object d+11,900,150,925

make object box d+10,100,100,20 : make mesh from object d+10,d+10

lock vertexdata for mesh d+10

perform csg difference on vertexdata d+11 : perform csg union on vertexdata d+11 : perform csg intersection on vertexdata d+11

unlock vertexdata

delete object d+10 : make object d+10,d+10,0 : position object d+10,900,50,925

set global shadows on : set global shadow shades 1 : set global shadow color 0,0,0,64

set shadow light 1,300,500,700,2000 : set shadow position -1,300,500,700

for i=0 to 11 : set shadow shading on d+i : next i

position camera 300,50,300 : point camera 500,50,500

set point light 0,500,300,500 : set ambient light 20

set normalization on : sync on : sync rate 60

while mouseclick()=0

 if inkey$()="-" then set static portals on

 if inkey$()="=" then set static portals off

 if inkey$()="[" then set static objects wireframe on

 if inkey$()="]" then set static objects wireframe off

 control camera using arrowkeys 0,2,4

 x#=object position x(d) : y#=object position y(d) : z#=object position z(d)

 nx#=newxvalue(x#,object angle y(d),75.0) : nz#=newzvalue(z#,object angle y(d),75.0)

 if static raycast(x#,y#,z#,nx#,y#,nz#)=0

  yrotate object d,object angle y(d)+rnd(10)/100.0 : move object d,1

 else

  yrotate object d,object angle y(d)+1 : add static scorch 25,0

 endif

 if static volume(x#,y#,z#,x#,y#-5,z#,10)=0 then position object d,x#,y#-5,z#

 if createdinvisiblefloor=0

  make static collision box -100,-200,-100,1100,0,1100 : createdinvisiblefloor=1

 else

  x#=object position x(d+1) : y#=object position y(d+1) : z#=object position z(d+1)

  if get static collision hit(x#-25,y#-25,z#-25,x#+25,y#+25,z#+25,x#-25,y#-30,z#-25,x#+25,y#+20,z#+25)=0

   y#=y#-grav# : inc grav#,0.5

  else

   colArbitraryvalue=get static collision value() : colcount=get static collision count() : colfloor=get static collision floor()

   x#=x#+get static collision x() : y#=y#+get static collision y() : z#=z#+get static collision z()

  endif

  position object d+1,x#,y#,z#

  if static line of sight(x#,y#,z#,x#,y#-5,z#-1,0.1,0.1)=1 then grav#=grav#*-0.95

 endif

 sync

endwhile

set global shadows off : detach object from static d : delete static objects

end
Advertisement