|
Bart De Lathouwer pisze:
Howdy Bart.
Never heard about "calibration meshes" but maybe you are talking about "Dummies". "Dummy" is a node with attached empty mesh, it is used as camera target or part of nodes hierarchy (bone in skeleton) used in animation. If so, then you may easily detect dummy (from "player.c"): if (node->type==LIB3DS_OBJECT_NODE) {
if (strcmp(node->name,"$$$DUMMY")==0) {
/* do something */
}
Then just skip it and don't render. I greatly discourage you to delete
such meshes, they may be necessary to proper animation of other objects.
Node is base for transformation in 3DS. There is always at least a "Root" node in the scene. Other nodes are attached to Root. Each node may have children nodes, so we can build hierarchy of nodes. Node_Base -> Node_Middle -> Node_Top Most important thing in node is it's transformation matrix, such matrix describes node's transformations relative to it's parent node: "node->matrix" is actually it's "local_to_parent" transformation, when we want to get "local_to_world" we should do something like this: /// this is pseudo-code, it may not compile, just explaining concept! void CalculateNodesLocalToWorldMatrix( Lib3dsNode* node, Lib3dsMatrix& result ) { if( !node->parent ) { memcpy( result, node->matrix, sizeof( Lib3dsMatrix ) ); } else { Lib3dsMatrix parentToWorldMatrix; CalculateNodesLocalToWorldMatrix( node->parent, parentToWorldMatrix ); MultiplyMatrices( node->matrix, parentToWorldMatrix, result ); } } So if we have following hierarchy: Node_Base -> Node_Middle -> Node_Top when we move Node_Base's position X by 5 units "Node_Base->matrix[3][0] += 5;", then we will see that all nodes are moved by 5 units in X. but when we translate Node_Middle by 5 "Node_Middle->matrix[3][0] += 5", then only Node_Middle and Node_Top will be affected but Node_Base will stay in position. Each node may have an object attached. Such object may be light, mesh, dummy or camera. So in short: nodes give transformation to objects to let the objects keep interface clean and care only about lighting or being a mesh or camera or dummy. That's very sketchy and brief description. Look at "3DSMax SDK" for further details. Rendering transparent objects is always a pain. There is no simple and at the same time correct method. For start you may take two pass method: -first draw all your opaque objects with depth writing enabled; -then disable depth write and render transparent objects sorted from farest to nearest to camera; this method may fail with not convex meshes or with special cases of obstructions and intersections, but many games use such approach with success. For example of loading and drawing a 3ds file see "player.c" http://www.lib3ds.org/lib3ds-1.2.0/examples/player.c Greetings Rafal |
------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________ lib3ds-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/lib3ds-devel
