Also be sure to see the Project Status Chart.
This release includes a bug fix in M3DBonedObj that was causing unsmooth motion,
and several changes to the character demo: the dojo model has been substantially
improved, and our heroine now walks! Her feet are still slipping a bit,
but it's a good start. (Remember to use the space bar to turn her around, or else
she'll walk right through the walls and disappear.) I also adjusted the balance of the default lighting a bit.
Two bugs have been fixed in M3DBonedObj. One was a memory violation that was causing mysterious crashes (thank goodness for Spotlight!). The other was a failure to prepare the TriMeshes before mucking with them, which sometimes caused Tara's feet to disappear.
With these fixes, the bone-based character animation appears pretty stable. I'm satisfied with my animation macros for the arms, and am now working on the legs. She's not walking yet, but she is doing leg exercises. She'll be running and jumping before we know it!
The big news in this update is that object rotation is now handled (internally) entirely with
quaternions. You can still use the old Euler angle methods for rotating objects, or you can use quaternions. In addition, there is a new YawPitchRoll method which works properly for arbitrary object-relative rotations! All this was inspired by
Exobattle, a 3D space-combat network game written by
Matt Burch using Magdef. Great work, Matt!
Goodness, it's been a long time since the last update! I've been busy on related projects such as Meshwork and GUNK, but now I'm finally returning to work on Magdef. I've added a note on standard bones for humanoid characters, and clarified the system requirements in the About Magdef file. Also, the mailing list has moved; if you were on the old list, you should have gotten a notice. To view or subscribe to the new list, go to http://www.eGroups.com/list/magdef/. No changes to the code or documentation today, but expect some in the near future.
Several improvements have been made to the Anim Compiler: the "Range" and "Include" keywords have been implemented; a comment character ("#") is now supported; and several memory leaks have been fixed. The M3DPose class has been extended such that if you specify a position for the same bone twice within a pose, the positions are combined -- very handy for joints with multiple degrees of freedom, for example.
The animation compiler is up and running! You can now specify an animation in a plaintext format known as a "Magdef animation source file" (.masf). Drop it on Anim Compiler, and it will be converted into a "Magdef animation binary file" (.mabf), which can be very quickly read by Magdef. (One could also copy the .mabf data into a resource and read it from there.) The Character Demo has been updated to make use of this new animation capability. The Anim Compiler is still rather basic, and doesn't recognize the "Range" or "Include" keywords yet. But it's a good start.
This is an interim release, meaning that it doesn't include a lot of new stuff that's immediately obvious, but it does contain a lot of great new and improved code that will prove important later on. I've completely changed the way KeysUtils works, for much better reliability (especially while debugging). In a real app, you'd probably use InputSprockets anyway, but in the meantime the new UpdateKeys() works like a charm. I've also added a lot of good clean code to the character animation system. This system is all worked out, and only waiting on an animation file compiler that can convert a descriptive animation source file to a binary form that can be efficiently read by Magdef. That will come soon, and we'll then have a complete and powerful animation system. In addition, I've started including descriptions of Magdef file formats in a "notes" folder in the distribution.
A bug was fixed in MDSpApp.cpp, thanks to Pete Hopkins (email@example.com).
Also, M3DBonedObj has been changed to support up to two bone attachments
per vertex, with a relative weight, according the bones file format of
the latest version of Meshwork. Two bones are definitely better than one,
and can go a long way to eliminating creases at the joints.
We have character animation! A new class, M3DBonedObj, extends the basic M3DObject by adding a skeleton and a method to set the pose. This UpdatePose method is currently hard-coded to wave the character's arms, but it works! See the character demo to see it in action.
This is just at the proof-of-concept level, though most of the code and concepts are good and will probably endure. But we still need to add support for multiple bone attachments, and a decent posing/animation system. Also, the model and skeleton were generated with
probably want to also import model and bone data from other modelers.
I'm back from my workshop, and back to work on Magdef.
Frederick Reitberger (Fredc@reitberger.org> has kindly written some DrawSprocket
code for us, which I've integrated (with only minor changes) in the form of
a "MDSpApp" class derived from MAPApp. The Tank demo can now be compiled with
or without use of DrawSprocket, simply by changing one link it TankApp.h.
(The compiled demo in the distribution package is currently using DSp.) It's
a little light on error-checking at this point, but it definitely works.
We've now done at least a proof-of-concept of all the major M3D parts,
except for one: character animation. I'm very eager to bring the character demo
to life, so I'll be focussing on that for the next several weeks. This requires
making or adapting some basic design tools, since working with 3D deformable
meshes is a tricky business, but I expect we'll have something moving within a
few weeks at most.
This is a busy week for me, and I don't have much time to work on the project. But I've put together proof-of-concept collision detection code, demonstrated in the Tank app. It's crude, but it works, and I think with some polish it will be a nice collision system for many purposes.
I've finished documenting M3DObject, and have more or less finished its API and internals. I'll probably address collision detection next.
A few internal changes were made to the
TriMesh class, so that an object can be scaled or rotated without resetting its vector normals. (This is important if you have an object made of several materials, and want a smoothly-shaded join between them.) I've also started documenting the
M3DObject class, though it's
still quite incomplete. And I've added methods to this class for
managing a "collision radius" -- this will be used to implement first-pass collision detection.
Code to add a background picture has been added to M3DScene, though this is still at the Phase 1 (proof of concept) stage. MakeShaderFromPict.cpp has been cleaned up a bit. M3DObject has been further cleaned and improved. A bug in TriMesh was squashed, and the import from 3DMF procedure was improved to keep the vertex normals given in the file (if any). A little work was done on the Character demo, but don't get excited; there's no actual character animation yet!
The TriMesh class has been cleaned and documented. It now catches all relevant errors, cleans up properly, and throws an appropriate OSErr exception (memFullErr, or -1 in the case of a generic QD3D error). I've also developed a documentation procedure which will be used to develop the
MagDef Class Reference. Finally, I've
begun clean-up work on M3DObject, which is the most important object
in the M3D module. The files "M3DMF.h" and "M3DMF.cpp" have been eliminated, and their code incorporated (with proper error checking) into M3DObject. This resulted in minor changes to the Tank demo.
Today I'm working on cleaning up and documenting the TriMesh class; I want to get this class finalized in the near future. I've also received an update to MAPApp which uses DrawSprockets from Frederick Reitberger; I'll be integrating this into Magdef as soon as I'm done with TriMesh.
The M3DObject::Clone() method has been implemented, and applied in the Tank demo. Both the enemy tank and the player tank can now fire shells, though since we don't have collision detection yet, the shells don't do much. The object-culling code has been changed slightly so that the visibility calculation is only done when the camera or the object has changed.
I've added a "Gotchas" page to list some of the system-level quirks and problems I've run into. Browsing this list may save you a headache later. Also rearranged arguments to M3DObject::Turn for greater convenience, implemented the MoveForward method of the same class, and added camera zoom methods to M3DScene. Finally, I've added a couple of tanks to the Tank demo -- one for the player, one enemy. The enemy tank simply makes donuts in the (still non-existent) terrain, but the player tank can be driven around. You can also zoom in and out with the left two keys on the bottom row of the main keyboard ('z' and 'x' on a Qwerty keyboard).
Automatic object culling has been added based on an object's x/z position; for games where the camera has substantial vertical movement, we'll need to consider y position as well. Still, the proof of concept is successful. A new Project Status Chart has been created, to let you see at a glance where the project is and where it's going. I'll expand and update this chart as we go.
Numerous small improvements have been made to the code: some cosmetic, others for safety reasons. Many of these improvements are thanks to thorough comments by Jesse Jones. Also, a full rewrite of the M3DGeom.h class, eliminating a lot of ugly legacy code and making it transparently compatible with Apple's TQ3Vec3D datatype. Also added Meshwork to the 3D Tools page. Finally, updated TriMesh.cpp such that it can now import 3DMF with full color and texture (yay!) -- try Brian Greenstone's T-Rex for example.
The mailing list now has 30 members. Magdef is developing fast!
We can now read 3DMF files! M3DMF.h and M3DMF.cpp have been added to the M3D folder, and provide a function to create an M3DObject from a 3DMF file. It does not yet support color or textures, but it does import the shape -- I was able to load a T-Rex from Nanosaur into the Tank demo!
Yesterday I set up this web page and a mailing list. To subscribe to the mailing list, send email to
firstname.lastname@example.org with "subscribe magdef" in the body of the message. I also posted the current source pack: it can be downloaded here:
Things are still very rough, but we have 6 people on the mailing list, and hopefully we'll get things cleaned up in the near future.
. . . . . .