X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=include%2Fvmd.h;h=0385d6e6ff421b85bc2666dd11f064c4e2456c25;hb=4b7b856e70fe8047f985e2598020032d0d87a672;hp=cd317a6ba44adb02dbb516a5bdd1e453e4ffa296;hpb=4460f4f5016bb7251215eed3eea2bf67a231fdba;p=meshio%2Fmeshio.git diff --git a/include/vmd.h b/include/vmd.h index cd317a6..0385d6e 100644 --- a/include/vmd.h +++ b/include/vmd.h @@ -22,10 +22,10 @@ namespace meshio { namespace vmd { -typedef la::Vector2 Vector2; -typedef la::Vector3 Vector3; -typedef la::Quaternion Quaternion; -typedef color::fRGB fRGB; +typedef ::meshio::la::Vector2 Vector2; +typedef ::meshio::la::Vector3 Vector3; +typedef ::meshio::la::Quaternion Quaternion; +typedef ::meshio::color::fRGB fRGB; //////////////////////////////////////////////////////////// //! ƒ‚[ƒVƒ‡ƒ“ @@ -112,61 +112,83 @@ struct SelfShadowKey }; //////////////////////////////////////////////////////////// +//! KeyFrame +//////////////////////////////////////////////////////////// +template +struct KeyFrame +{ + typedef T VALUE_TYPE; + + //! ƒtƒŒ[ƒ€”ԍ† + unsigned int frame; + //! ƒL[ + T key; + + //! ƒtƒŒ[ƒ€”ԍ†‚ŃL[‚ðƒ\[ƒg‚·‚é + bool operator<(const KeyFrame &rhs)const{ return frame struct KeyFrameList { - struct KeyFrame - { - //! ƒtƒŒ[ƒ€”ԍ† - unsigned int frame; - //! ƒL[ - T key; - - //! ƒtƒŒ[ƒ€”ԍ†‚ŃL[‚ðƒ\[ƒg‚·‚é - bool operator<(const KeyFrame &rhs)const{ return frame list; + typedef T KEYFRAME_TYPE; + + std::vector list; void sort(){ std::sort(list.begin(), list.end()); } - KeyFrame& push(unsigned int frame) + KEYFRAME_TYPE& push(unsigned int frame) { - list.push_back(KeyFrame()); - KeyFrame &keyFrame=list.back(); + list.push_back(KEYFRAME_TYPE()); + KEYFRAME_TYPE &keyFrame=list.back(); keyFrame.frame=frame; return keyFrame; } + unsigned int getFrame(int index) + { + return list[index].frame; + } + typename KEYFRAME_TYPE::VALUE_TYPE* getKey(int index) + { + return &list[index].key; + } }; //////////////////////////////////////////////////////////// //! IO //////////////////////////////////////////////////////////// +typedef KeyFrame BoneKeyFrame; +typedef KeyFrameList BoneKeyFrameList; + +typedef KeyFrame MorphKeyFrame; +typedef KeyFrameList MorphKeyFrameList; + struct IO { std::string version; char name[20]; //! ƒ‚[ƒVƒ‡ƒ“ - typedef std::map > BoneMap; + typedef std::map BoneMap; BoneMap boneMap; + std::vector boneKeys; + //! •\î - typedef std::map > MorphMap; + typedef std::map MorphMap; MorphMap morphMap; - //! ƒJƒƒ‰ƒ‚[ƒVƒ‡ƒ“ - typedef std::map > CameraMap; - CameraMap cameraKey; - //! Æ–¾ - typedef std::map > LightMap; - LightMap lightMap; - //! ƒZƒ‹ƒtƒVƒƒƒh[ - typedef std::map > SelfShadowMap; - SelfShadowMap selfShadowMap; + std::vector morphKeys; IO(); + ~IO(); bool read(binary::IReader &reader); + bool read(const wchar_t *path); bool read(const char *path); bool write(std::ostream &os); + + BoneKeyFrameList* getBoneKeyFrameList(const std::wstring &name); + MorphKeyFrameList* getMorphKeyFrameList(const std::wstring &name); }; inline std::ostream& operator<<(std::ostream &os, const IO &rhs) {