(not aligning automatically skin to Identity Matrix, a bit confusing code connected with lot of design work-arounds, some algos suboptimal, not ideal way to use animation from other models, and problematic way to implement HWSkinning in future).
So a made a fork of CSkinMesh called CJointMesh with iterface - IJointMesh. (yes they can be there together so loader writer may choose which of them to use)
It employ:
- much better algorithms - clearly understandable, well commented & faster
- improved interface (something that was planned to be done with skinmesh interface in future) - accessible only what is necessary for loader, foolproof, not dependent on actual implementation - (SkinMesh could use this interface too)
- Different approach for using animation from other models - it is possible to use animations from more that one model and combine them all together
- Conversion to StaticMesh - make StaticMesh from models without animation or in the middle of animation.
- Preparation for HW skinning - skinning is independent of animation (all data necessary to do it are stored inside MeshBuffer so it can be done outside JointMesh) and it is possible to change storage of weights without changing interface
It sould not be so hard to add HW skinning now...
(there is necessary to do some changes in meshbuffers and drivers and I'd prefer if some irrlicht developers whould do it in close future (as it's necessary to add weights and matrix indices to vertex I guess)
Scene node should support transitions (with JointMesh as it do with SkinMesh) and there is CJointSceneNode that makes it possible to attach other nodes to a joint of JointMesh (through new interface method getJointNode(const core::stringc& jointName) - this one works for bouth skinmesh and jointmesh ).
Code "is as it is"..
I hope irrlicht woud use parts of this code in future to improve (update) SkinMesh or... use IJointMesh interface and change (or not change) JointMesh and use this new approach for model animation and skinning
(Its expected to work with trunk 1.8+ code and should work with 1.7 too was not checking older versions)
Oki so files that you can actually download:
JointMesh.patch:
Diff against current trunk (1.8.SVN-rev 4054) - Contains ONLY diff for changed files in trunk. (all new files are few lines down)
http://www.mediafire.com/?oqk61dh5b16byew or direct http://www.mediafire.com/file/oqk61dh5b ... .patch.zip
(it's minimal set of chages - may need manual patching as I can't make a patch for every revision - I'll do final patch once 1.8.x is out)
JointMesh Files + loaders - Contains all new files + B3D and X loader that loads to JointMesh
http://www.mediafire.com/?9k4424nyeyjq1cf or direct http://www.mediafire.com/file/9k4424nye ... Joints.zip
This is all you need - note - loaders may not work well coz I did not design them and it was necessary to do some changes in them without complete understanding how they work..
This is version actual to 27.1.2012 (should be latest).
Limitations & Changes:
- Added one more experimental (may be changed in near future) method loader_addMeshBuffer() that allow adding external (allocated) buffers [for example from other meshes etc..].
- Bugfix around memory leaks while multimple setMesh is done.
- Bugfix around animation counting on finalize when animation mapping is used.
- Some minor bugfixes including transition that was not working well (now it works well and it's tested!!).
- Fix to enable context in CAnimatedMesh (was not enabled be4).
- Current implementation support max 4 weights per vertex! (if there is more weights -theese with lowest strength gonna be discarded).
- Updating BoundingBox for skinned meshes acording actual vertex position was disabled (initial state bounding box is used).
- Fixed some bugs around AddAnimation reference counting - it should grab and drop them well now.
- Buffers use only pointer to Matrix to update only pointer not full matrices -> lesser CPU usage.
- GlobalAnimatedMatrices are now stored inside mesh (joints) to help doing animation without context.
Code is currently in testing stage there may be some more methods added and some more bugfixes