Re: Final attempt regarding core data / opengl...
Re: Final attempt regarding core data / opengl...
- Subject: Re: Final attempt regarding core data / opengl...
- From: Guy English <email@hidden>
- Date: Mon, 12 Sep 2005 22:58:34 -0400
On 9/12/05, goessly <email@hidden> wrote:
> I'm looking for a way to create an interface, that tells my drawing
> routine, what kind of primitive to display; based on data from the
> current document. It's entries are tagged scene-graph style, i.e.: '
> "document entry #12" is the root-element of the scene, has the n
> child-nodes and is to be displayed as a cube at the following
> coordinates...'
Ok ... well it's not really Cocoa specific then. If you already have a
document format then it isn't a CoreData app. That said and with
appologies to mmalc (who'd *super* hate it if he knew I knew it was
off topic :) ) ...
You need a node class for your scene graph. You may be able to get
away with a standard NSDictionary. Write the code to parse the entries
in your file and set the values of your node. When you encounter a
child node recursively read it and add it to the parent node.
Each node needs a transformation matrix. You need to know if the nodes
locations are in world space or node space - ie do the coordinates
specify a postion relative to the origin or a position relative to the
parent. Create your base transform matrix for the root node, then a
new matrix for each child node recursively. To render simply walk the
tree from root node visiting all the children and concatenating their
transform matricies with their parents. At each node set puch the
current transform matrix, concat the nodes matrix, draw the primitive,
and pop the transform matrix. Thats the basic idea. If you're confused
by this explanation you should checkout www.opengl.org and track down
the NeHe OpenGL tutorials.
Now, Cocoa can't really help you with this beyond the basic collection
classes, easing the setup of the OpenGL view, and providing some nice
stuff like super easy image loading. NeXT at one point had a 3DKit and
it'd be nice to see that come back. Microsoft looks like they're
building something high-level and easy for 3D in Longhorn and it'd be
great if Leopard had a Cocoa solution for 3D model loading, basic
scene graph and camera management. Model file formats have settled
enough that there's a small-ish set that it would be great to have
build in support for.
Anyway, beyond basically saying what Cocoa can't do for you out of the
box you'll need to look elsewhere for more in depth help.
Take care,
Guy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden