I will check tomorrow, because i don't manage all the dispatch case g Object001 in file is not manage is do that tomorow fast. On Jul 21, 2012, at 9:44 AM, Luc Fabresse wrote:
Hi JB,
Excellent! I tried to give it a try for the fun. I couldn't make it work.
I updated some stuff (find it attached): - ConfigurationOfObjModel-LucFabresse.2.mcz added repository for package OBJModel in baseline - OBJModel-LucFabresse.7 add support for empty lines and "g" lines in wavefront format parser (ObjImporter>>dispach:)
Here the snippet I tried:
filename := 'teapot.obj'. response := ZnEasy get: 'http://people.sc.fsu.edu/~jburkardt/data/obj/',filename. (FileSystem disk workingDirectory / filename) writeStreamDo: [ :stream | stream nextPutAll: response contents].
s := ObjImporter importFrom: filename. s parse. object := s objects.
w := GLWorldTest new. object do: [:e | w addElement: e]. w openInWorld.
Parsing seems to be ok. But, creating the GL context failed: invalid pixel format. On a mac OSX 10.6.8.
I am eager to play deeper with that ;-)
#Luc
2012/7/18 Stéphane Ducasse <stephane.ducasse@inria.fr>
On Jul 17, 2012, at 2:21 PM, Jean Baptiste Arnaud wrote:
Hi, Under the pressure of Camillo i publish the code.
Thanks camillo :)
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.
you relax from PhD writing :).
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).
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
<OBJModel-LucFabresse.7.mcz><ConfigurationOfObjModel-LucFabresse.2.mcz>
Best Regards Jean Baptiste Arnaud jbaptiste.arnaud@gmail.com