Inertia's picture

Interface for 3D Models?

Hello again,

i've been wondering if there are any plans for an Interface for 3D Models in OpenTK? I've written a .MS3D Parser (www.milkshape3d.com) that can read meshes/materials/joints from the file and i'd like to make it available to other Tao/OpenTK users, but i'm currently a bit uncertain what to ditch of the parsed data, because the possible uses for a mesh loader can range from an editor application (that wants as much data and comments as possible) to an application that needs nothing besides the vertex positions.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

But what is the advantage of object over float[] in this case? Wouldn't it be a more alien concept to new user (how do I use this?)

As I see it, the loading itself is orthogonal to the representation itself. The loader should be able to load any valid vertex data defined by the user - the problem is how to represent this data in memory.

Inertia's picture

my bad, i've mistaken this with irc. This is more of a "maybe this approach is better" note, than suggestion v1.0 final. The idea is that the object could contain whatever information you have about the model, which does not directly affect the VBO/IBO.
This could be BeginMode, IBO Type, Comments from modelling app, bone colors, skeleton, frames etc.

Edit: directly using VBO/IBO is probably a bad idea, because it complicates the use of the models with immediate mode and display lists alot. It also wouldn't serve the purpose of a middleware to import data from a modelling application, and save that out into your renderers custom format.
The older approach with the abstract Vertex struct is way more flexible.

the Fiddler's picture

I wouldn't say it complicates it too much, it would look something like:

if (indexed)
    foreach (short i in Indices)
    {
        GL.Color4(Vertices[i].Color);
        GL.Vertex3(Vertices[i].Position);
    }
else
    foreach (Vertex v in Vertices)
    {
        GL.Color4(v.Color);
        GL.Vertex3(v.Position);
    }

But I see what you mean. Custom vertex formats, like the ones in XNA or MDX, are probably more flexible.

LikeTK's picture

This is an old topic. I wonder by now has anyone incorporated a DirectX file (file.x) import into OpenGL c# (Tao or OpenTK) or any pointer/reference.

Icefox's picture

DirectX file support is planned for Meshomatic, a mesh loading library I am (very slowly) writing: http://www.opentk.com/project/Meshomatic . However, unfortunately, it is not there yet.