V-Gears 0
Free Final Fantasy VII engine.
VGearsHRCFile.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 <OgreResource.h>
19#include <OgreMesh.h>
20#include <OgreSkeleton.h>
21#include "common/TypeDefine.h"
22
23namespace VGears{
24
25 class HRCMeshLoader;
26
27 class HRCSkeletonLoader;
28
34 class HRCFile : public Ogre::Resource{
35
36 public:
37
41 static const float DOWN_SCALER;
42
61 HRCFile(
62 Ogre::ResourceManager *creator, const String &name,
63 Ogre::ResourceHandle handle, const String &group,
64 bool is_manual = false, Ogre::ManualResourceLoader *loader = NULL
65 );
66
70 virtual ~HRCFile();
71
72 typedef std::vector<String> RSDNameList;
73
77 struct Bone{
78
83
88
94 Ogre::Real length;
95
102 };
103
104 typedef std::vector<Bone> BoneList;
105
111 virtual void SetSkeletonName(const String& name);
112
118 virtual const String& GetSkeletonName() const{
119 return skeleton_name_;
120 }
121
127 virtual String GetSkeletonFileName() const;
128
134 virtual String GetMeshFileName() const;
135
141 virtual BoneList& GetBones(){return bones_;}
142
148 virtual const BoneList& GetBones() const{return bones_;}
149
155 virtual Ogre::SkeletonPtr GetSkeleton() const;
156
160 static const String RESOURCE_TYPE;
161
162 protected:
163
167 virtual void loadImpl() override final;
168
172 virtual void unloadImpl() override final;
173
180 virtual size_t CalculateSize() const;
181
189 virtual size_t CalculateSize(const Bone &bone) const;
190
191 private:
192
197
202
207
212
216 Ogre::SkeletonPtr skeleton_;
217
221 Ogre::MeshPtr mesh_;
222 };
223
224 typedef Ogre::SharedPtr<HRCFile> HRCFilePtr;
225}
Handles HRC files.
Definition: VGearsHRCFile.h:34
Ogre::SkeletonPtr skeleton_
The skeleton.
Definition: VGearsHRCFile.h:216
virtual void SetSkeletonName(const String &name)
Sets a name for the skelenton.
Definition: VGearsHRCFile.cpp:129
Ogre::MeshPtr mesh_
The mesh assigned to the skeleton.
Definition: VGearsHRCFile.h:221
HRCMeshLoader * mesh_loader_
The mesh loader.
Definition: VGearsHRCFile.h:206
HRCSkeletonLoader * skeleton_loader_
The skeleton loader.
Definition: VGearsHRCFile.h:211
std::vector< Bone > BoneList
Definition: VGearsHRCFile.h:104
virtual ~HRCFile()
Destructor.
Definition: VGearsHRCFile.cpp:44
virtual BoneList & GetBones()
Retrieves the list of bones in the skeleton.
Definition: VGearsHRCFile.h:141
BoneList bones_
The bones in the skeleton.
Definition: VGearsHRCFile.h:201
virtual String GetSkeletonFileName() const
Retrieves the skeleton file name.
Definition: VGearsHRCFile.cpp:131
virtual void loadImpl() override final
Loads the file.
Definition: VGearsHRCFile.cpp:63
HRCFile(Ogre::ResourceManager *creator, const String &name, Ogre::ResourceHandle handle, const String &group, bool is_manual=false, Ogre::ManualResourceLoader *loader=NULL)
Constructor.
Definition: VGearsHRCFile.cpp:35
String skeleton_name_
The skeleton name.
Definition: VGearsHRCFile.h:196
virtual size_t CalculateSize() const
Calculates the size of the skeleton.
Definition: VGearsHRCFile.cpp:117
virtual const String & GetSkeletonName() const
Retrieves the skeleton name.
Definition: VGearsHRCFile.h:118
virtual void unloadImpl() override final
Unloads the file.
Definition: VGearsHRCFile.cpp:97
static const float DOWN_SCALER
Scale down constant.
Definition: VGearsHRCFile.h:41
virtual Ogre::SkeletonPtr GetSkeleton() const
Retrieves the skeleton.
Definition: VGearsHRCFile.cpp:143
virtual String GetMeshFileName() const
Retrieves the file name of the mesh assigned to the skeleton.
Definition: VGearsHRCFile.cpp:137
virtual const BoneList & GetBones() const
Retrieves the list of bones in the skeleton.
Definition: VGearsHRCFile.h:148
std::vector< String > RSDNameList
Definition: VGearsHRCFile.h:72
static const String RESOURCE_TYPE
The type of resource.
Definition: VGearsHRCFile.h:160
A loader for skeleton meshes.
Definition: VGearsHRCMeshLoader.h:26
A loader for skeletons.
Definition: VGearsHRCSkeletonLoader.h:27
Definition: FF7NameLookup.h:24
Ogre::String String
Definition: TypeDefine.h:37
Ogre::SharedPtr< HRCFile > HRCFilePtr
Definition: VGearsHRCFile.h:224
A bone in a skeleton.
Definition: VGearsHRCFile.h:77
String name
Bone name.
Definition: VGearsHRCFile.h:82
RSDNameList rsd_names
List of RDS file assigned to the bone.
Definition: VGearsHRCFile.h:101
String parent
Parent bone name.
Definition: VGearsHRCFile.h:87
Ogre::Real length
Bone length.
Definition: VGearsHRCFile.h:94