Page 1 of 1
have a way to import .fbx , .x , .b3d , .3ds in pb ?
Posted: Fri Mar 18, 2016 5:43 pm
by skinkairewalker
hi , how can i import to pb , another formats 3D ?
like fbx , x , b3d , 3ds and others in PureBasic ?
Re: have a way to import .fbx , .x , .b3d , .3ds in pb ?
Posted: Fri Mar 18, 2016 6:17 pm
by box_80
Pure Basic's Ogre3D Library use only ogre format, so other formats need a converter.
MPZ's MP3D Library use X, B3D, 3DS
There outdated wrappers for other 3D engines for Pure Basic.
Re: have a way to import .fbx , .x , .b3d , .3ds in pb ?
Posted: Fri Mar 18, 2016 6:44 pm
by skinkairewalker
how i use this library with PureBasic ?
can you send a example code ?
Re: have a way to import .fbx , .x , .b3d , .3ds in pb ?
Posted: Fri Mar 18, 2016 7:52 pm
by box_80
Run any of the files in the 3D folder of your Purebasic directory, like Mesh.pb, Light.pb, etc. Many examples in there. Below is the Mesh example.
Code: Select all
;
; ------------------------------------------------------------
;
; PureBasic - Entity
;
; (c) Fantaisie Software
;
; ------------------------------------------------------------
;
#CameraSpeed = 1
IncludeFile #PB_Compiler_Home + "examples/3d/Screen3DRequester.pb"
Define.f KeyX, KeyY, MouseX, MouseY, RollZ
If InitEngine3D()
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Models", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Packs/skybox.zip", #PB_3DArchive_Zip)
InitSprite()
InitKeyboard()
InitMouse()
If Screen3DRequester()
LoadMesh(0, "robot.mesh")
CreateMaterial(0, LoadTexture(0, "clouds.jpg"))
CopyMaterial(0, 1)
CreateMaterial(2, LoadTexture(2, "r2skin.jpg"))
MaterialShadingMode(0, #PB_Material_Wireframe)
CreateEntity(0, MeshID(0), MaterialID(0))
CreateEntity(1, MeshID(0), MaterialID(1), -60, 0, 0)
CreateEntity(2, MeshID(0), MaterialID(2), 60, 0, 0)
StartEntityAnimation(0, "Walk")
EntityRenderMode(0, #PB_Entity_DisplaySkeleton)
SkyBox("stevecube.jpg")
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 40, 150, #PB_Absolute)
Repeat
Screen3DEvents()
If ExamineMouse()
MouseX = -MouseDeltaX() * #CameraSpeed * 0.05
MouseY = -MouseDeltaY() * #CameraSpeed * 0.05
EndIf
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
KeyX = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Right)
KeyX = #CameraSpeed
Else
KeyX = 0
EndIf
If KeyboardPushed(#PB_Key_Up)
KeyY = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Down)
KeyY = #CameraSpeed
Else
KeyY = 0
EndIf
EndIf
RotateEntity(1, 0, 1, 0, #PB_Relative)
RotateEntity(2, 0, 1, 0, #PB_Relative)
RotateCamera(0, MouseY, MouseX, 0, #PB_Relative)
MoveCamera (0, KeyX, 0, KeyY)
RenderWorld()
Screen3DStats()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
EndIf
Else
MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
End
Re: have a way to import .fbx , .x , .b3d , .3ds in pb ?
Posted: Sun Mar 20, 2016 8:58 pm
by skinkairewalker
Alexi wrote:Which modelling software do you use? 3DS, C4D, Blender all support a format to export to OGRE, last one is free.
i donwload blender but i dont see where i export in . mesh xD , how i export . mesh in blender ?
Re: have a way to import .fbx , .x , .b3d , .3ds in pb ?
Posted: Sun Mar 20, 2016 9:22 pm
by applePi
skinkairewalker writes: how i export . mesh in blender ?
it is easier to export as obj file, then convert it to mesh with a tool OgreAssimpConverter:
download the file OgreAssimpConverter.zip from here (requiers the VC++2010 runtime):
http://www.purebasic.fr/english/viewtop ... 22#p401729
and any obj, 3ds, may be other formats, suppose cat.obj
write from command prompt
OgreAssimpConverter "cat.obj"
and it will produce
cat.mesh
as a successful example look this thread
http://purebasic.fr/english/viewtopic.p ... =cathedral
the cathedral
sibenik.obj converted to
sibenik.mesh with suitable mapping of textures to the mesh.
here is the converted file instead of the 2shared.com link there:
http://wikisend.com/download/341904/sibenik3.rar