I´ve got an Problem. In old Versions of PB (before 5.31) I was able to add 3DArchives with the path "/" and so I have placed my meshes in one Folder with the executable. Now I can use Add3DArchive("/", #PB_3DArchive_FileSystem) without Problems, but I can´t load meshes. Every time I get a 0. If I don´t use relative paths it works and my program loads the mesh correct.
Even my older codes aren´t work if they use Add3DArchive("/", #PB_3DArchive_FileSystem).
What am I doing wrong? Is it a fault by me or just a new bug?
Could you please test the code above? Perhaps this issue is related to my PC...
You have to put a meshfile next to your compilated exe, so use "Create temporary exe in sourcecode Directory" (I don´t know how this is called in the english Version) if you want it simple. Rename the LoadMesh() and there you go:
Code: Select all
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;>> >>
;>> Name: /-Test >>
;>> >>
;>> Author: Bananenfreak >>
;>> >>
;>> Date: 04.07.2015 >>
;>> >>
;>> OS: Windows >>
;>> >>
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
EnableExplicit
Define.f KeyX, KeyY, MouseX, MouseY
Define nx.f, nz.f, Boost.f = 1, Yaw.f, Pitch.f
Define.i Quit, boden
#kam_0 = 3
#window = 2
#plane = 4
#planent = 5
If InitEngine3D(#PB_Engine3D_EnableCG)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Scripts", #PB_3DArchive_FileSystem)
;Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Models", #PB_3DArchive_FileSystem)
Debug "Current Directory:" + GetCurrentDirectory()
Debug "3D_Archive:" + Add3DArchive("/", #PB_3DArchive_FileSystem)
Parse3DScripts()
InitSprite()
InitKeyboard()
InitMouse()
OpenWindow(#window, 0, 0, 1800, 1000, "/-Test", #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(#window), 10, 10, 2000, 2000, 1, 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))
Debug "Mesh"+LoadMesh(#PB_Any, "AKM.mesh") ;-<----- Rename here
;CreateEntity(#PB_Any, MeshID(LoadMesh(#PB_Any, "Linde_0_3_Ast_0.mesh")), #PB_Material_None, 0, 5, 0)
Repeat
Repeat
Until WindowEvent() = 0
If ExamineMouse()
Yaw = -MouseDeltaX() * 0.05
Pitch = -MouseDeltaY() * 0.05
EndIf
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Up)
MoveCamera(#kam_0, 0, 0, -Boost)
ElseIf KeyboardPushed(#PB_Key_Down)
MoveCamera(#kam_0, 0, 0, 1 * Boost)
EndIf
If KeyboardPushed(#PB_Key_Left)
MoveCamera(#kam_0, -1 * Boost, 0, 0)
ElseIf KeyboardPushed(#PB_Key_Right)
MoveCamera(#kam_0, 1 * Boost, 0, 0)
EndIf
EndIf
RotateCamera(#kam_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
