Import WRL or VRML files to purebasic

Everything related to 3D programming
User avatar
Michael Vogel
Addict
Addict
Posts: 2666
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Import WRL or VRML files to purebasic

Post by Michael Vogel »

I have some wrl files which are obviously using the VRML 2.0 file format. It would be nice, if the objects could be displayed using PureBasic but I have no idea how to do this...

...anyone else?
User avatar
falsam
Enthusiast
Enthusiast
Posts: 630
Joined: Wed Sep 21, 2011 9:11 am
Location: France
Contact:

Re: Import WRL or VRML files to purebasic

Post by falsam »

Try this ....

Code: Select all

File$ = OpenFileRequester("Selectionner le fichier wrml", "","",0)

If File$
  MeshImport = RunProgram("meshconv", "-c obj "+File$, "", #PB_Program_Open | #PB_Program_Read | #PB_Program_Hide)
  
  If MeshImport
    While ProgramRunning(MeshImport)
      If AvailableProgramOutput(MeshImport)
        Log$ + ReadProgramString(MeshImport) + Chr(13)
      EndIf
    Wend
    Debug log$
  EndIf
EndIf
Meshconv.zip

:arrow: http://www.patrickmin.com/meshconv/

You should have an obj file

And Finally http://www.purebasic.com/download/OgreA ... verter.zip

➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti

Sorry for my bad english and the Dunning–Kruger effect.
User avatar
Michael Vogel
Addict
Addict
Posts: 2666
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: Import WRL or VRML files to purebasic

Post by Michael Vogel »

Thanks for your hints.
Anyhow MeshConv shows tons of errors when I try to convert the wrl files which have been created by using the program Room Arranger. I tried to modify the wrl source, but then the MeshConv crashed.
User avatar
Michael Vogel
Addict
Addict
Posts: 2666
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: Import WRL or VRML files to purebasic

Post by Michael Vogel »

Played around from time to time to convert a VRML file to be viewed with PureBasic, but with no success (until now) ;)

Code: Select all

#VRML V2.0 utf8
WorldInfo {
  title "Room Arranger 3D scene"
  info ["Author: Room Arranger, www.roomarranger.com"]
}
Background { skyColor [0.78 0.85 0.94, 0.91 0.97 0.98, 1 1 1] skyAngle [1.5, 1.57]
  groundColor [0.18 0.14 0.09, 0.78 0.85 0.94] groundAngle [1.57]
}
Transform {translation 0 -.02 0
 children Shape {appearance DEF RX_WRLAPP_1 Appearance {material Material {diffuseColor 0.00 0.00 0.00 emissiveColor 0.78 0.85 0.94 transparency 0.00 specularColor 0.00 0.00 0.00 shininess 0.200} }
  geometry IndexedFaceSet {
    coord Coordinate {point [-5.600 0.00 8.600, 10.600 0.00 8.600, 10.600 0.00 -5.600, -5.600 0.00 -5.600, -5.600 0.00 8.600, -0.100 0.00 3.100, -0.100 0.00 -0.100, 5.100 0.00 -0.100, 5.100 0.00 3.100, -0.100 0.00 3.100, ]}
    coordIndex [0 1 2 3 4 5 6 7 8 9 -1, ]
    ccw TRUE solid TRUE convex FALSE}}}
DEF USER_VIEW1 Viewpoint {description "Start" jump FALSE position 1.48 0.85 2.43 orientation 0.000 1.000 0.000 -0.698 fieldOfView 0.873}
DEF FLY_NAV1 NavigationInfo { headlight FALSE avatarSize [.05, 0.60, .60]  type ["FLY", "ANY"]}
ROUTE USER_VIEW1.isBound TO FLY_NAV1.set_bind
 : 
DEF USER_VIEW8 Viewpoint {description "6" jump FALSE position 4.80 1.10 2.92 orientation 0.000 1.000 0.000 -5.620 fieldOfView 0.873}
DEF FLY_NAV8 NavigationInfo { headlight FALSE avatarSize [.05, 0.60, .60]  type ["FLY", "ANY"]}
ROUTE USER_VIEW8.isBound TO FLY_NAV8.set_bind
DEF RA_VIEW2 Viewpoint {description "Ansicht von vorne" jump FALSE position 2.50 6.35 5.00 orientation 1 0 0 -1 fieldOfView 0.873}
 : 
DEF FLY_NAV_STD6 NavigationInfo { headlight FALSE avatarSize [.05, 0.60, .60] type ["FLY", "ANY"]}
ROUTE RA_VIEW6.isBound TO FLY_NAV_STD6.set_bind
PointLight {radius 500 intensity .29 location -2.00 4.40 -2.00 ambientIntensity .64}
PointLight {radius 500 intensity .19 location -2.00 4.40 6.20}
PointLight {radius 500 intensity .24 location 8.20 4.40 6.20}
PointLight {radius 500 intensity .26 location 8.20 4.40 -2.00}
PointLight {radius 500 intensity .20 location 3.10 -1.00 -2.00}
PointLight {radius 500 intensity .18 location -2.00 -1.00 2.10}
PointLight {radius 500 intensity .15 location 3.10 -1.00 6.20}
PointLight {radius 500 intensity .23 location 8.20 -1.00 2.10}
EXTERNPROTO Rectangle [field SFNode appearance] "library.wrl#Rectangle"
EXTERNPROTO Circle [field SFNode appearance] "library.wrl#Circle"
EXTERNPROTO Ellipse [field SFNode appearance] "library.wrl#Ellipse"
EXTERNPROTO Triangle [field SFNode appearance] "library.wrl#Triangle"
 : 
EXTERNPROTO UserPicLibraryObject171 [field SFColor color field MFString urlTexture] "library.wrl#UserPicLibraryObject171"
:
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Import WRL or VRML files to purebasic

Post by infratec »

Post Reply