Skylicht Engine
Loading...
Searching...
No Matches
CAnimationController.h
1/*
2!@
3MIT License
4
5Copyright (c) 2019 Skylicht Technology CO., LTD
6
7Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
8(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
9merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20This file is part of the "Skylicht Engine".
21https://github.com/skylicht-lab/skylicht-engine
22!#
23*/
24
25#pragma once
26
27#include "Skeleton/CSkeleton.h"
28#include "Components/CComponentSystem.h"
29
30namespace Skylicht
31{
58 class SKYLICHT_API CAnimationController : public CComponentSystem
59 {
60 protected:
62 std::vector<CSkeleton*> m_skeletons;
63
66
68 std::string m_animFile;
69
71 bool m_loop;
72
73 public:
74 CAnimationController();
75
76 virtual ~CAnimationController();
77
78 virtual void initComponent();
79
80 virtual void updateComponent();
81
82 virtual CObjectSerializable* createSerializable();
83
84 virtual void loadSerializable(CObjectSerializable* object);
85
86 DECLARE_GETTYPENAME(CAnimationController)
87
88 public:
89
95
102
108 {
109 return (int)m_skeletons.size();
110 }
111
118 {
119 return m_skeletons[id];
120 }
121
126
131 inline void setOutput(CSkeleton* skeleton)
132 {
133 m_output = skeleton;
134 }
135 };
136}
CSkeleton * createSkeleton()
Creates a new skeleton managed by this controller, using the GameObject's entities.
CSkeleton * getSkeleton(int id)
Gets a skeleton by index.
Definition CAnimationController.h:117
int getNumSkeleton()
Gets the number of skeletons managed by this controller.
Definition CAnimationController.h:107
CSkeleton * m_output
The output skeleton which transforms are applied from.
Definition CAnimationController.h:65
CSkeleton * createSkeleton(core::array< CEntity * > &entities)
Creates a new skeleton managed by this controller, using the provided entities.
bool m_loop
Whether the default animation should loop.
Definition CAnimationController.h:71
std::string m_animFile
Path to the primary animation file.
Definition CAnimationController.h:68
void releaseAllSkeleton()
Releases all skeletons and clears the controller.
void setOutput(CSkeleton *skeleton)
Sets the skeleton that will be used for final transform application.
Definition CAnimationController.h:131
std::vector< CSkeleton * > m_skeletons
List of skeletons managed by this controller.
Definition CAnimationController.h:62
Definition CObjectSerializable.h:36
Manages a hierarchy of animated entities, handling keyframe updates and animation blending.
Definition CSkeleton.h:50
Self reallocating template array (like stl vector) with additional features.
Definition irrArray.h:23
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29