| 1 | /* |
|---|
| 2 | ----------------------------------------------------------------------------- |
|---|
| 3 | This source file is part of OGRE |
|---|
| 4 | (Object-oriented Graphics Rendering Engine) |
|---|
| 5 | For the latest info, see http://www.ogre3d.org/ |
|---|
| 6 | |
|---|
| 7 | Copyright (c) 2000-2013 Torus Knot Software Ltd |
|---|
| 8 | |
|---|
| 9 | Permission is hereby granted, free of charge, to any person obtaining a copy |
|---|
| 10 | of this software and associated documentation files (the "Software"), to deal |
|---|
| 11 | in the Software without restriction, including without limitation the rights |
|---|
| 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|---|
| 13 | copies of the Software, and to permit persons to whom the Software is |
|---|
| 14 | furnished to do so, subject to the following conditions: |
|---|
| 15 | |
|---|
| 16 | The above copyright notice and this permission notice shall be included in |
|---|
| 17 | all copies or substantial portions of the Software. |
|---|
| 18 | |
|---|
| 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|---|
| 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|---|
| 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|---|
| 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|---|
| 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|---|
| 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|---|
| 25 | THE SOFTWARE. |
|---|
| 26 | ----------------------------------------------------------------------------- |
|---|
| 27 | */ |
|---|
| 28 | #ifndef __SkeletonFileFormat_H__ |
|---|
| 29 | #define __SkeletonFileFormat_H__ |
|---|
| 30 | |
|---|
| 31 | #include "OgrePrerequisites.h" |
|---|
| 32 | |
|---|
| 33 | namespace Ogre { |
|---|
| 34 | |
|---|
| 35 | /** \addtogroup Core |
|---|
| 36 | * @{ |
|---|
| 37 | */ |
|---|
| 38 | /** \addtogroup Animation |
|---|
| 39 | * @{ |
|---|
| 40 | */ |
|---|
| 41 | /** Definition of the OGRE .skeleton file format |
|---|
| 42 | |
|---|
| 43 | .skeleton files are binary files (for read efficiency at runtime) and are arranged into chunks |
|---|
| 44 | of data, very like 3D Studio's format. |
|---|
| 45 | A chunk always consists of: |
|---|
| 46 | unsigned short CHUNK_ID : one of the following chunk ids identifying the chunk |
|---|
| 47 | unsigned long LENGTH : length of the chunk in bytes, including this header |
|---|
| 48 | void* DATA : the data, which may contain other sub-chunks (various data types) |
|---|
| 49 | |
|---|
| 50 | A .skeleton file contains both the definition of the Skeleton object and the animations it contains. It |
|---|
| 51 | contains only a single skeleton but can contain multiple animations. |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | */ |
|---|
| 55 | enum SkeletonChunkID { |
|---|
| 56 | SKELETON_HEADER = 0x1000, |
|---|
| 57 | // char* version : Version number check |
|---|
| 58 | SKELETON_BLENDMODE = 0x1010, // optional |
|---|
| 59 | // unsigned short blendmode : SkeletonAnimationBlendMode |
|---|
| 60 | |
|---|
| 61 | SKELETON_BONE = 0x2000, |
|---|
| 62 | // Repeating section defining each bone in the system. |
|---|
| 63 | // Bones are assigned indexes automatically based on their order of declaration |
|---|
| 64 | // starting with 0. |
|---|
| 65 | |
|---|
| 66 | // char* name : name of the bone |
|---|
| 67 | // unsigned short handle : handle of the bone, should be contiguous & start at 0 |
|---|
| 68 | // Vector3 position : position of this bone relative to parent |
|---|
| 69 | // Quaternion orientation : orientation of this bone relative to parent |
|---|
| 70 | // Vector3 scale : scale of this bone relative to parent |
|---|
| 71 | |
|---|
| 72 | SKELETON_BONE_PARENT = 0x3000, |
|---|
| 73 | // Record of the parent of a single bone, used to build the node tree |
|---|
| 74 | // Repeating section, listed in Bone Index order, one per Bone |
|---|
| 75 | |
|---|
| 76 | // unsigned short handle : child bone |
|---|
| 77 | // unsigned short parentHandle : parent bone |
|---|
| 78 | |
|---|
| 79 | SKELETON_ANIMATION = 0x4000, |
|---|
| 80 | // A single animation for this skeleton |
|---|
| 81 | |
|---|
| 82 | // char* name : Name of the animation |
|---|
| 83 | // float length : Length of the animation in seconds |
|---|
| 84 | |
|---|
| 85 | SKELETON_ANIMATION_BASEINFO = 0x4010, |
|---|
| 86 | // [Optional] base keyframe information |
|---|
| 87 | // char* baseAnimationName (blank for self) |
|---|
| 88 | // float baseKeyFrameTime |
|---|
| 89 | |
|---|
| 90 | SKELETON_ANIMATION_TRACK = 0x4100, |
|---|
| 91 | // A single animation track (relates to a single bone) |
|---|
| 92 | // Repeating section (within SKELETON_ANIMATION) |
|---|
| 93 | |
|---|
| 94 | // unsigned short boneIndex : Index of bone to apply to |
|---|
| 95 | |
|---|
| 96 | SKELETON_ANIMATION_TRACK_KEYFRAME = 0x4110, |
|---|
| 97 | // A single keyframe within the track |
|---|
| 98 | // Repeating section |
|---|
| 99 | |
|---|
| 100 | // float time : The time position (seconds) |
|---|
| 101 | // Quaternion rotate : Rotation to apply at this keyframe |
|---|
| 102 | // Vector3 translate : Translation to apply at this keyframe |
|---|
| 103 | // Vector3 scale : Scale to apply at this keyframe |
|---|
| 104 | SKELETON_ANIMATION_LINK = 0x5000 |
|---|
| 105 | // Link to another skeleton, to re-use its animations |
|---|
| 106 | |
|---|
| 107 | // char* skeletonName : name of skeleton to get animations from |
|---|
| 108 | // float scale : scale to apply to trans/scale keys |
|---|
| 109 | |
|---|
| 110 | }; |
|---|
| 111 | /** @} */ |
|---|
| 112 | /** @} */ |
|---|
| 113 | |
|---|
| 114 | } // namespace |
|---|
| 115 | |
|---|
| 116 | |
|---|
| 117 | #endif |
|---|