Moving where the camera looks?

Blitz3D Forums/Blitz3D Programming/Moving where the camera looks?

Hmm this a bit faster...rough and ready code.

Change part# to alter how big the division between the camera and panel is.

Graphics3D 800,600,32


;FPS
Global FPS_Timer
Global FPS_FrameCount
Global FPS_FPS


Global gw=GraphicsWidth()
Global gh=GraphicsHeight()
Global part#=0.75
Global part1#=1/part

SetBuffer BackBuffer()
Global image=CreateImage(gw,gh*part#)

camera=CreateCamera()

cube=CreateCube()
light=CreateLight(2,camera)
LightRange light,10
PositionEntity camera,0,0,-10
PointEntity camera,cube
ScaleEntity camera,1,part#,1

ClsColor 0,0,255



While Not KeyHit(1)

TurnEntity cube,1,0.8,0.7
RenderWorld()
blit()
;Draw buttons now
Text 0,0,"Mode"+" "+gw+" "+gh+" "+GetFPS()
Flip False

Wend



Function blit()

i=ImageBuffer(image)
b=BackBuffer()

y#=0

Repeat
CopyRect 0,y#,gw,1,0,y#*part#,b,i
y#=y#+part1#
Until y#=>gh

Cls 
CopyRect 0,0,gw,gh*part#,0,0,i,b

End Function



Function GetFPS()
FPS_FrameCount = FPS_FrameCount + 1
If MilliSecs() >= FPS_Timer
FPS_FPS        = FPS_FrameCount
FPS_FrameCount = 0  
FPS_Timer      = MilliSecs() + 1000
EndIf
Return FPS_FPS
End Function