LoadMesh() fails
Posted: Mon Apr 21, 2014 1:43 pm
Heyho,
I have a Problem with my new program. Could you please try this code? I think Comodo blocks it again...
Or do I have a real Problem in my code?
I have a Problem with my new program. Could you please try this code? I think Comodo blocks it again...
Or do I have a real Problem in my code?
Code: Select all
EnableExplicit
Define.f KeyX, KeyY, MouseX, MouseY
Define nx.f, nz.f, Boost.f = 1, Yaw.f, Pitch.f
Define.i Quit, boden, mesh
Define.s path, pathTile
#kam_0 = 0
#window = 0
#plane = 0
#planent = 0
If InitEngine3D()
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Scripts", #PB_3DArchive_FileSystem)
Parse3DScripts()
InitSprite()
InitKeyboard()
InitMouse()
OpenWindow(#window, 0, 0, 1800, 1000, "3D-Template", #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(#window), 10, 10, 2000, 2000, 0, 10, 10, #PB_Screen_SmartSynchronization)
WorldShadows(#PB_Shadow_TextureAdditive, 200, RGB(255 * 0.2, 255 * 0.2, 255 * 0.2), 4096)
AmbientColor(RGB(255 * 0.2, 255 * 0.2, 255 * 0.2))
CreatePlane(#plane, 100, 100, 100, 100, 100, 100)
boden = GetScriptMaterial(#PB_Any, "Scene/GroundBlend")
CreateEntity(#planent, MeshID(#plane), MaterialID(boden), 0, 0, 0)
;-Camera
CreateCamera(#kam_0, 0, 0, 100, 100)
MoveCamera(#kam_0, 0, 20, 0, #PB_Absolute)
CameraLookAt(#kam_0, 20, 0, 20)
CameraRange (#kam_0, 2, 5000)
CameraFOV (#kam_0, 90)
CameraBackColor(#kam_0, RGB(0, 0, 0))
path = OpenFileRequester("Choose file to load", "", "OGRE-Mesh (*.mesh)|*.mesh", 0, 0)
pathTile = GetPathPart(path)
If Not Add3DArchive(Left(pathTile, Len(pathTile) - 1), #PB_3DArchive_FileSystem)
MessageRequester("Error", "Path can´t be solved!" + Chr(10) + Left(pathTile, Len(pathTile) - 1))
EndIf
Parse3DScripts()
mesh = LoadMesh(#PB_Any, GetFilePart(path))
;mesh = LoadMesh(#PB_Any, path)
If Not mesh
MessageRequester("Error", "This file isn´t a mesh!" + Chr(10) + GetFilePart(path))
EndIf
Repeat
If ExamineMouse()
Yaw = -MouseDeltaX() * 0.05
Pitch = -MouseDeltaY() * 0.05
EndIf
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Up)
MoveCamera(0, 0, 0, -2 * Boost)
ElseIf KeyboardPushed(#PB_Key_Down)
MoveCamera(0, 0, 0, 2 * Boost)
EndIf
If KeyboardPushed(#PB_Key_Left)
MoveCamera(0, -2 * Boost, 0, 0)
ElseIf KeyboardPushed(#PB_Key_Right)
MoveCamera(0, 2 * Boost, 0, 0)
EndIf
EndIf
RotateCamera(0, Pitch, Yaw, 0, #PB_Relative)
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
Else
MessageRequester("Error", "The 3D Engine can't be initialized", 0)
EndIf
End