Here is another interesting issue - I have used CameraLocate to provide a means of zooming in/out.
The following chopped-down code shows that this appears to work well:
Code: Select all
#Camera1 = 1
#Window = 2
#MeshModel = 3
#MeshEntity = 4
#Light1 = 5
#BtnBrowse = 6
iFileSelected = 0
iLoadOK.i = 0
iZoomChange.i = 0
iZoom.i = 1000
If OpenWindow(#Window, 0, 0, 800, 600, "Esc to Quit", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(#BtnBrowse, 20, 12, 200, 24, "Browse for Ogre Mesh File")
InitEngine3D()
InitSprite()
InitKeyboard()
InitMouse()
If OpenWindowedScreen(WindowID(#Window), 100, 100, 600, 400, 0, 0, 0, #PB_Screen_NoSynchronization)
CreateCamera(#Camera1, 0, 0, 100, 100)
CameraLocate(#Camera1, 0, 0, iZoom)
CameraLookAt(#Camera1, 0, 0, 0)
CameraBackColor(#Camera1, 7615787)
;########### CameraProjectionMode ###############
CameraProjectionMode(#Camera1, #PB_Camera_Perspective)
;CameraProjectionMode(#Camera1, #PB_Camera_Orthographic)
CreateLight(#Light1, RGB(51, 51, 51), 20.0, -20.0, 20.0)
LightSpecularColor(#Light1, RGB(250, 250, 250))
Repeat
iEvent = WaitWindowEvent(1)
iGadgetID = EventGadget()
If (iEvent = #PB_Event_Gadget)
If iGadgetID = #BtnBrowse
sDir.s = GetHomeDirectory()
sPat.s = "Ogre Mesh (*.MESH *.mesh)|*.MESH;*.mesh"
iPatPosn = 0
sFileFullPath.s = OpenFileRequester("Pick an Ogre Mesh File", sDir, sPat, iPatPosn)
iFileSelected = Len(sFileFullPath)
If (iFileSelected > 1)
sPath.s = GetPathPart(sFileFullPath)
Add3DArchive(sPath, #PB_3DArchive_FileSystem)
EndIf
EndIf
ElseIf (iEvent = #PB_Event_CloseWindow)
CloseScreen()
End
EndIf
Until iFileSelected > 1
iLoadOK = LoadMesh(#MeshModel, sFileFullPath)
If (iLoadOK > 0)
CreateEntity(#MeshEntity, MeshID(#MeshModel), #PB_Material_None)
Else
MessageRequester("Problem","Mesh load failure",#PB_MessageRequester_Ok)
End
EndIf
Repeat
; ### WindowedScreen
ExamineMouse()
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Escape) : CloseScreen() : End : EndIf
iZoomChange = MouseWheel()
iZoom = iZoom + (iZoomChange * 50)
CameraLocate(#Camera1, 0, 0, iZoom)
RenderWorld()
FlipBuffers()
Delay(1)
Until KeyboardPushed(#PB_Key_Escape)
EndIf
EndIf
CloseScreen()
End
However, the view is in perspective. Try changing CameraProjectionMode(#Camera1, #PB_Camera_Perspective) to CameraProjectionMode(#Camera1, #PB_Camera_Orthographic). If you load the same Mesh file again, the zoom now has no effect. Anyone hit this problem before? Is it a problem or am I simply going about it the wrong way?



