I have this code.
My FPS count is always half of the sync rate. It's unnatural.
Also, my poly count is always 2. (Probably from the plain object shown for shader rendering).
How can I get clear statistic results?
Rem Project: AdvTerrWShdr
Rem Created: Tuesday, March 08, 2011
Rem ***** Main Source File *****
sync on
sync rate 60
autocam off
disable escapekey
//vars
camheight# = 0.0
keypressed = 0
//make camera for fullscreen render shader
make camera 1
color backdrop 1, rgb(0, 0, 128)
load camera effect "bloom.fx", 1, 0
set camera effect 1, 1, 2
//make fullscreen render plane
make object plain 2, 2, 2, 1
load effect "quad.fx", 2, 0
set object effect 2, 2
texture object 2, 0, 2
load image "TerrainAssets/terr_tex.jpg", 1
load image "TerrainAssets/terr_det.tga", 2
make object terrain 1
set terrain heightmap 1, "TerrainAssets/terr_hgt.jpg"
set terrain scale 1, 1, 0.6, 1
set terrain split 1, 16
set terrain tiling 1, 4
set terrain light 1, 1, -0.25, 0, 1, 1, 0.78, 0.5
set terrain texture 1, 1, 2
build terrain 1
position camera 385,23,100
camheight# = get terrain ground height(1, camera position x(), camera position z())
camheight# = camheight# + 3
position camera 385, camheight#, 100
//position shader camera
position camera 1, camera position x(), camera position y(), camera position z()
position object 2, camera position x(1), camera position y(1), camera position z(1)
do
q# = get terrain ground height(1, camera position x(), camera position z())
if keystate(17) = 1 then move camera 2 //w - move forward
if keystate(31) = 1 then move camera -2 //s - move backward
if keystate(30) = 1
turn camera left 2 //a - turn camera left
turn camera left 1, 2 //sync shader camera
endif
if keystate(32) = 1
turn camera right 2 //d - turn camera right
turn camera right 1, 2 //sync shader camera
endif
if keystate(16) = 1 //user presses q - camera floats up
inc camheight#, 2.0
position camera camera position x(), camheight#, camera position z()
endif
if keystate(18) = 1 //user presses e - camera floats down
dec camheight#, 2.0
if camheight# >= q# + 3
position camera camera position x(), camheight#, camera position z()
else
position camera camera position x(), q# + 3, camera position z()
camheight# = q# + 3
endif
endif
if keystate(19) = 1 //if user presses r - reset to ground level
camheight# = get terrain ground height(1, camera position x(), camera position z())
camheight# = camheight# + 3
position camera camera position x(), camheight#, camera position z()
endif
position camera 1, camera position x(), camera position y(), camera position z()
position object 2, camera position x(1), camera position y(1), camera position z(1)
update terrain
if keystate(45) = 1
destroy terrain 1
delete camera 1
end
endif
//render shader camera
show object 1
hide object 2
sync camera 1
show object 2
hide object 1
//render main camera
sync mask %001
sync
//hide fullscreen plane
hide object 2
//diagnose hud
set cursor 0,0
print "fps = " + str$ ( screen fps ( ) )
print ""
print ""
print "x = " + str$ ( camera position x ( ) )
print "y = " + str$ ( camera position y ( ) )
print "z = " + str$ ( camera position z ( ) )
print ""
print "polygon count = " + str$ ( statistic ( 1 ) )
print ""
print ""
print "q# = " + str$(q#)
print "camheight# = " + str$(camheight#)
loop