[Pharo-users] WaveFront File importer on Pharo

Jean Baptiste Arnaud jbaptiste.arnaud at gmail.com
Tue Jul 17 08:21:28 EDT 2012


Hi, 
Under the pressure of Camillo i publish the code.
I beginning to do a Wavefront (human readable standard for 3d Obj Model ) importer on Pharo.

So i made a importer.
Not all the case are manage, only the case I need to import the current Obj model.

And a drawer which is in Alpha version.
face and normal vector are manage.
Missing color (in progress), and texturing.

You need .obj file and all the .mtl related (open you blender and make it nice).

If you are not running on Mac os comment this code in GLWorldTest>>#render, the 

	display makeCurrent.

else if you running on mac os implement it in 
NBMSAAOffscreenDisplay>>#makeCurrent 
	^driver makeCurrent.

My code can be find on JBARepo on squeaksource 
ObjModel Package but you need NBOpenGL (i do a configuration in same place i just need to be motivated for keep it up to date).

So 
put on same folder of the .image your .obj and .mtl file (i am lazy) (maybe it is VM folder i do not know).
open a workspace and do

"s := ObjImporter importFrom: 'xwing-map.obj'.
s parse.
object := s objects.

w := GLWorldTest new.
object do: [:e | w addElement: e].
w openInWorld."

3d result with normal 



With normal and color but not texture : 



Enjoy




Best Regards
Jean Baptiste Arnaud
jbaptiste.arnaud at gmail.com







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20120717/64d12742/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2012-07-17 at 1.59.22 PM.png
Type: image/png
Size: 55093 bytes
Desc: not available
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20120717/64d12742/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2012-07-17 at 1.58.18 PM.png
Type: image/png
Size: 141455 bytes
Desc: not available
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20120717/64d12742/attachment-0001.png>


More information about the Pharo-users mailing list