V-Gears 0
Free Final Fantasy VII engine.
VGearsAFile.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 The V-Gears Team
3 *
4 * This file is part of V-Gears
5 *
6 * V-Gears is free software: you can redistribute it and/or modify it under
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, version 3.0 (GPLv3) of the License.
9 *
10 * V-Gears is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#pragma once
17
18#include <OgreSkeleton.h>
19#include <Ogre.h>
20#include "common/TypeDefine.h"
22
23namespace VGears{
24
30 class AFile : public Resource{
31
32 public:
33
52 AFile(
53 Ogre::ResourceManager *creator, const String &name, Ogre::ResourceHandle handle,
54 const String &group, bool is_manual = false, Ogre::ManualResourceLoader *loader = NULL
55 );
56
60 virtual ~AFile();
61
65 static const Ogre::Real FRAME_DURATION;
66
70 static const String RESOURCE_TYPE;
71
78 void AddTo(Ogre::SkeletonPtr skeleton, const String &name) const;
79
80 typedef std::vector<Ogre::Vector3> BoneRotationList;
81
85 struct Frame{
86
90 Ogre::Vector3 root_rotation;
91
95 Ogre::Vector3 root_translation;
96
101 };
102
103 typedef std::vector<Frame> FrameList;
104
111
117 void SetBoneCount(const uint32 bone_count);
118
119 protected:
120
124 virtual void loadImpl() override final;
125
129 virtual void unloadImpl() override final;
130
137 size_t CalculateSize() const;
138
145 void SetFrameRotation(
146 Ogre::TransformKeyFrame *key_frame,
147 const Ogre::Vector3 &rotation
148 ) const;
149
150 private:
151
156
161 };
162
163 typedef Ogre::SharedPtr<AFile> AFilePtr;
164}
165
Handles A files.
Definition: VGearsAFile.h:30
uint32 bone_count_
The number of bones.
Definition: VGearsAFile.h:155
static const Ogre::Real FRAME_DURATION
Duration of a frame.
Definition: VGearsAFile.h:65
void SetFrameRotation(Ogre::TransformKeyFrame *key_frame, const Ogre::Vector3 &rotation) const
Sets the rotation for a frame.
Definition: VGearsAFile.cpp:67
static const String RESOURCE_TYPE
The type of resource.
Definition: VGearsAFile.h:70
std::vector< Frame > FrameList
Definition: VGearsAFile.h:103
AFile(Ogre::ResourceManager *creator, const String &name, Ogre::ResourceHandle handle, const String &group, bool is_manual=false, Ogre::ManualResourceLoader *loader=NULL)
Constructor.
Definition: VGearsAFile.cpp:30
virtual void loadImpl() override final
Loads the file.
Definition: VGearsAFile.cpp:42
size_t CalculateSize() const
Calculates the size of the file.
Definition: VGearsAFile.cpp:53
void AddTo(Ogre::SkeletonPtr skeleton, const String &name) const
Adds an animation to an skeleton.
Definition: VGearsAFile.cpp:80
std::vector< Ogre::Vector3 > BoneRotationList
Definition: VGearsAFile.h:80
void SetBoneCount(const uint32 bone_count)
Sets the number of bones.
Definition: VGearsAFile.cpp:40
virtual ~AFile()
Destructor.
Definition: VGearsAFile.cpp:38
FrameList frames_
The list of frames.
Definition: VGearsAFile.h:160
FrameList & GetFrames()
Retrieves the list of frames in the file.
Definition: VGearsAFile.h:110
virtual void unloadImpl() override final
Unloads the file.
Definition: VGearsAFile.cpp:48
A resource.
Definition: VGearsResource.h:29
Definition: FF7NameLookup.h:24
Ogre::String String
Definition: TypeDefine.h:37
Ogre::uint32 uint32
Definition: TypeDefine.h:33
Ogre::SharedPtr< AFile > AFilePtr
Definition: VGearsAFile.h:163
A frame in an animation.
Definition: VGearsAFile.h:85
Ogre::Vector3 root_rotation
The rotation of the whole skeleton in the frame.
Definition: VGearsAFile.h:90
BoneRotationList bone_rotations
The list of individual bone rotations in the frame.
Definition: VGearsAFile.h:100
Ogre::Vector3 root_translation
The translation of the whole skeleton in the frame.
Definition: VGearsAFile.h:95