Wa la. On average I'm getting about 600 more fps than Blitz3D with the 200 cubes. I'm impressed.
'BMax MiniB3D MouseLook
'by Chroma
Strict
Import "MiniB3D.bmx"
Local width:Int = 1024, height:Int = 768
Graphics3D width,height,32,1,85
Global camera:TCamera = createcamera()
CameraRange camera,1,5000
Local light:TLight = CreateLight()
' FPS Init
Local old_ms=MilliSecs()
Local renders
Local fps
' Delta Time Init
Global dt:Float,NewTime:Int,OldTime:Int,TotalTime:Float=0
NewTime = MilliSecs()
OldTime = NewTime
' cubes
For Local n:Int = 1 To 200
Local hhh:TMesh = CreateCube()
EntityColor hhh,Rand(0,255),Rand(0,255),Rand(0,255)
ScaleEntity hhh, Rand(1,50),Rand(1,50),Rand(1,50)
PositionEntity hhh, Rand(-1000,1000),Rand(-1000,1000),Rand(-1000,1000)
Next
' MouseLook Init
Local yaw:Float, pit:Float, yaw2:Float, pit2:Float
HideMouse
MoveMouse width/2,height/2
TBlitz2D.MouseXSpeed()
TBlitz2D.MouseYSpeed()
Local mspd:Float = 14.0
Local msmo:Float = 22.0
' *** MAIN LOOP ***
While Not KeyHit(KEY_ESCAPE)
Cls
'Update Delta Time
Delta_Time()
'MouseLook BMax
Local mxs:Float = TBlitz2D.MouseXSpeed() / mspd
Local mys:Float = TBlitz2D.MouseYSpeed() / mspd
If mxs <> 0 Or mys <> 0
MoveMouse width/2,height/2
TBlitz2D.MouseXSpeed()
TBlitz2D.MouseYSpeed()
EndIf
yaw :- mxs
pit :+ mys
yaw2 :+ ((yaw - yaw2) * msmo) * dt
pit2 :+ ((pit - pit2) * msmo) * dt
RotateEntity camera,pit2,yaw2,0
' ** Update 3D **
RenderWorld
' FPS
renders :+ 1
If MilliSecs()-old_ms>=1000
old_ms=MilliSecs()
fps=renders
renders=0
EndIf
Text 0,0,"FPS: "+String(fps)
Flip 0
Wend
EndGraphics
End
Function Delta_Time()
NewTime = MilliSecs()
dt = Float (NewTime - OldTime)/1000.0
OldTime = NewTime
TotalTime = TotalTime + dt
End Function