Very nice! Doru On 17 Jul 2012, at 14:21, Jean Baptiste Arnaud wrote:
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 <Screen Shot 2012-07-17 at 1.59.22 PM.png>
With normal and color but not texture :
<Screen Shot 2012-07-17 at 1.58.18 PM.png>
Enjoy
Best Regards Jean Baptiste Arnaud jbaptiste.arnaud@gmail.com
-- www.tudorgirba.com "To utilize feedback, you first have to acquire it."