On Feb 17, 2008 11:15 PM, Richard Jones <[EMAIL PROTECTED]> wrote:

> On Feb 18, 2008 2:32 PM, Nathan <[EMAIL PROTECTED]> wrote:
>
> > Does anyone have any pointers for the best way to get models from
> > blender to pyglet?
> >
>
> There's some old code in pyglet's SVN under contrib/model for OBJ format
> models that you're welcome to look at, use, extend (hint :)
>


Yes ... very old.  As in "Doesn't work anymore."  Anyhow, I wrote my own
.OBJ parser before I even knew it existed:
http://hg.enterthefoo.com/Miru/file/6de2b2e10543/miru/tools/obj.py

I discovered the contrib/model one afterwords and wasn't very impressed, so
I kept my own.

There are some caveats/limitations to my implementation:

1. If want a triangle mesh then you'll have to triangulate you model in
blender first (easy)
2. Your texture image contained in an .mtl file must be of power-of-2
dimensions with w==h (ex. 2x2, 4x4 ... 512x512)
3. You'll have to convert the objects returned by parse to something
meaningful in your view implementation - your Mesh object, likely.
4. It doesn't fully implement the Wavefront specification - the old contrib
one didn't either

To see how (3) works in miru, see miru.mesh.loadObj function:
http://hg.enterthefoo.com/Miru/file/91b9e3184232/miru/mesh.py

If the above caveats/limitations are acceptable to folks, I'd be happy to
add my implementation to contrib.

-- 
\\\\\/\"/\\\\\\\\\\\
\\\\/ // //\/\\\\\\\
\\\/  \\// /\ \/\\\\
\\/ /\/ / /\/ /\ \\\
\/ / /\/ /\  /\\\ \\
/ /\\\  /\\\ \\\\\/\
\/\\\\\/\\\\\/\\\\\\
              d.p.s

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to