Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
SkeletonAnimManager.h
Go to the documentation of this file.
1/* Copyright (C) 2022 Wildfire Games.
2 * This file is part of 0 A.D.
3 *
4 * 0 A.D. is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * 0 A.D. is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/*
19 * Owner of all skeleton animations
20 */
21
22#ifndef INCLUDED_SKELETONANIMMANAGER
23#define INCLUDED_SKELETONANIMMANAGER
24
26
27#include <memory>
28#include <unordered_map>
29
30class CColladaManager;
32class CSkeletonAnim;
33class CStr8;
34
35///////////////////////////////////////////////////////////////////////////////
36// CSkeletonAnimManager : owner class of all skeleton anims - manages creation,
37// loading and destruction of animation data
39{
41public:
42 // constructor, destructor
45
46 // return a given animation by filename; return null if filename doesn't
47 // refer to valid animation file
48 CSkeletonAnimDef* GetAnimation(const VfsPath& pathname);
49
50 /**
51 * Load raw animation frame animation from given file, and build an
52 * animation specific to this model.
53 * @param pathname animation file to load
54 * @param name animation name (e.g. "idle")
55 * @param ID specific ID of the animation, to sync with props
56 * @param frequency influences the random choices
57 * @param speed animation speed as a factor of the default animation speed
58 * @param actionpos offset of 'action' event, in range [0, 1]
59 * @param actionpos2 offset of 'action2' event, in range [0, 1]
60 * @param sound offset of 'sound' event, in range [0, 1]
61 * @return new animation, or NULL on error
62 */
63 std::unique_ptr<CSkeletonAnim> BuildAnimation(const VfsPath& pathname, const CStr8& name, const CStr8& ID, int frequency, float speed, float actionpos, float actionpos2, float soundpos);
64
65private:
66 // map of all known animations. Value is NULL if it failed to load.
67 std::unordered_map<VfsPath, std::unique_ptr<CSkeletonAnimDef>> m_Animations;
68
70};
71
72#endif
Definition: ColladaManager.h:26
Definition: SkeletonAnimDef.h:48
Definition: SkeletonAnimManager.h:39
~CSkeletonAnimManager()
Definition: SkeletonAnimManager.cpp:43
CColladaManager & m_ColladaManager
Definition: SkeletonAnimManager.h:69
CSkeletonAnimManager(CColladaManager &colladaManager)
Definition: SkeletonAnimManager.cpp:36
CSkeletonAnimDef * GetAnimation(const VfsPath &pathname)
Definition: SkeletonAnimManager.cpp:50
NONCOPYABLE(CSkeletonAnimManager)
std::unique_ptr< CSkeletonAnim > BuildAnimation(const VfsPath &pathname, const CStr8 &name, const CStr8 &ID, int frequency, float speed, float actionpos, float actionpos2, float soundpos)
Load raw animation frame animation from given file, and build an animation specific to this model.
Definition: SkeletonAnimManager.cpp:89
std::unordered_map< VfsPath, std::unique_ptr< CSkeletonAnimDef > > m_Animations
Definition: SkeletonAnimManager.h:67
Definition: SkeletonAnim.h:33
Definition: path.h:80