Actually, I'm going to state this AS IS, but I want to release something before Christmas, but need Mike to answer my culling question first.
Here's some code for people who have DBPro to tinker with to see my problem:
` set up display and camera
sync on : sync rate 0 : sync : sync
`backdrop on
autocam off
set camera range 0.5, 30000
global DisplayType$
global UniverseName$
DisplayType$ = "SOLID"
` movement
g_fSpeed# = 10.05
g_fTurn# = 0.3
LoadObjectData:
sync
set cursor 0,0
input "please enter universe name (usually universe.dbo): ", UniverseName$
if FILE EXIST(UniverseName$) = 0
sync
print "File does not exist, try again!"
sync
wait key
cls
goto LoadObjectData
endif
if FILE EXIST(UniverseName$) <> 0
sync : print "Loading universe" : sync
load object UniverseName$,1
cls
endif
position object 1, 0, 0, 0
position camera 0, 0, 0
` main program loop
do
` handle user input and show some stats
gosub userInput
gosub information
` final screen update
sync
loop
userInput:
` simple mouse and keyboard movement
` move around with arrow keys
control camera using arrowkeys 0, g_fSpeed#, g_fTurn#
` store old camera angle
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
` store new camera angle
CameraAngleY# = wrapvalue ( CameraAngleY# + mousemovex ( ) * 0.4 )
CameraAngleX# = wrapvalue ( CameraAngleX# + mousemovey ( ) * 0.4 )
` rotate camera
yrotate camera curveangle ( CameraAngleY#, OldCamAngleY#, 24 )
xrotate camera curveangle ( CameraAngleX#, OldCamAngleX#, 24 )
` speed up movement
if inkey$ ( ) = "+"
if g_fSpeed# < 1000
g_fSpeed# = g_fSpeed# + 0.01
endif
endif
` slow down movement
if inkey$ ( ) = "-"
if g_fSpeed# > 0.002
g_fSpeed# = g_fSpeed# - 0.001
endif
endif
if inkey$ () = "1"
SET OBJECT WIREFRAME 1, 1
DisplayType$ = "WIREFRAME"
endif
if inkey$ () = "2"
SET OBJECT WIREFRAME 1, 0
DisplayType$ = "SOLID"
endif
if inkey$ () = "3"
SET OBJECT CULL 1, 0
DisplayType$ = "CULL ON"
endif
if inkey$ () = "4"
SET OBJECT CULL 1, 1
DisplayType$ = "CULL OFF"
endif
return
information:
` show some information
` start printing at top of screen
set cursor 0, 0
` show frame rate
print "Riker 9 - FPS Test"
print "fps = " + str$ ( screen fps ( ) )
print "Display Type = " + DisplayType$
` current camera position
print ""
print "x = " + str$ ( camera position x ( ) )
print "y = " + str$ ( camera position y ( ) )
print "z = " + str$ ( camera position z ( ) )
print ""
print "1 = wireframe"
print "2 = solid"
print "3 = Culling on"
print "4 = Culling off"
print ""
print "Use arrow keys to move, mouse to look."
` finally the polygon count
print "polygon count = " + str$ ( statistic ( 1 ) )
print ""
return
First, it doesn't "seem" to be culling correctly with the universe.dbo file that is created.
Second, it seems to be "all or nothing" like it needs to show "all the polygons" even those that are not in the field of view. Obviously if this is true, the bigger your map, the more polygons it needs to render "even if they are not on the screen, like behind you". I classify this as a small (ha!) performance bug.
-This...is my boomstick!