Skylicht Engine
Loading...
Searching...
No Matches
CColladaAnimLoader.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 "Importer/IAnimationImporter.h"
28
29namespace Collada
30{
31 struct SNodeParam;
32}
33
34using namespace Collada;
35
36namespace Skylicht
37{
38 class CAnimationClip;
39 struct SEntityAnim;
40
41 class SKYLICHT_API CColladaAnimLoader : public IAnimationImporter
42 {
43 protected:
44 bool m_zUp;
45 bool m_flipOx;
46
47 std::string m_unit;
48 float m_unitScale;
49 core::matrix4 m_unitScaleMatrix;
50
51 std::vector<CAnimationClip*> m_clips;
52 std::map<std::string, SEntityAnim*> m_nodeAnim;
53
54 SNodeParam* m_colladaRoot;
55 std::vector<SNodeParam*> m_listNode;
56
57 public:
58 CColladaAnimLoader();
59
60 virtual ~CColladaAnimLoader();
61
62 bool loadAnimation(const char* resource, CAnimationClip* output);
63
64 protected:
65 void constructAnimation(const char* fileName, CAnimationClip* output);
66
67 void clearData();
68
69 void parseUnit(io::IXMLReader* xmlRead);
70
71 void parseAnimationNode(io::IXMLReader* xmlRead);
72
73 void parseAnimationSourceNode(io::IXMLReader* xmlRead);
74
75 void parseDefaultValuePosition(io::IXMLReader* xmlRead, float* x, float* y, float* z);
76
77 void parseDefaultValueRotate(io::IXMLReader* xmlRead, float* x, float* y, float* z, float* angle);
78
79 void parseSceneNode(io::IXMLReader* xmlRead);
80
81 SNodeParam* parseNode(io::IXMLReader* xmlRead, SNodeParam* parent);
82
83 SNodeParam* getNode(const std::string& nodeName);
84 };
85}
Represents an animation clip containing multiple animation tracks for different entities.
Definition CAnimationClip.h:41
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29
Definition CColladaLoader.h:194
Definition CAnimationClip.h:33