RavEngine
Loading...
Searching...
No Matches
fbx.h
1
//----------------------------------------------------------------------------//
2
// //
3
// ozz-animation is hosted at http://github.com/guillaumeblanc/ozz-animation //
4
// and distributed under the MIT License (MIT). //
5
// //
6
// Copyright (c) Guillaume Blanc //
7
// //
8
// Permission is hereby granted, free of charge, to any person obtaining a //
9
// copy of this software and associated documentation files (the "Software"), //
10
// to deal in the Software without restriction, including without limitation //
11
// the rights to use, copy, modify, merge, publish, distribute, sublicense, //
12
// and/or sell copies of the Software, and to permit persons to whom the //
13
// Software is furnished to do so, subject to the following conditions: //
14
// //
15
// The above copyright notice and this permission notice shall be included in //
16
// all copies or substantial portions of the Software. //
17
// //
18
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR //
19
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, //
20
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL //
21
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER //
22
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING //
23
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER //
24
// DEALINGS IN THE SOFTWARE. //
25
// //
26
//----------------------------------------------------------------------------//
27
28
#ifndef OZZ_OZZ_ANIMATION_OFFLINE_FBX_FBX_H_
29
#define OZZ_OZZ_ANIMATION_OFFLINE_FBX_FBX_H_
30
31
#include <fbxsdk.h>
32
33
#include "ozz/animation/offline/fbx/export.h"
34
#include "ozz/base/maths/simd_math.h"
35
#include "ozz/base/maths/transform.h"
36
37
namespace
ozz {
38
namespace
math {
39
struct
Transform;
40
}
// namespace math
41
namespace
animation {
42
namespace
offline {
43
namespace
fbx {
44
45
// Manages FbxManager instance.
46
class
OZZ_ANIMFBX_DLL
FbxManagerInstance
{
47
public
:
48
// Instantiates FbxManager.
49
FbxManagerInstance
();
50
51
// Destroys FbxManager.
52
~FbxManagerInstance
();
53
54
// Cast operator to get internal FbxManager instance.
55
operator
FbxManager*()
const
{
return
fbx_manager_; }
56
57
private
:
58
FbxManager* fbx_manager_;
59
};
60
61
// Default io settings used to import a scene.
62
class
OZZ_ANIMFBX_DLL
FbxDefaultIOSettings
{
63
public
:
64
// Instantiates default settings.
65
explicit
FbxDefaultIOSettings
(
const
FbxManagerInstance
& _manager);
66
67
// De-instantiates default settings.
68
virtual
~FbxDefaultIOSettings
();
69
70
// Get FbxIOSettings instance.
71
FbxIOSettings* settings()
const
{
return
io_settings_; }
72
73
// Cast operator to get internal FbxIOSettings instance.
74
operator
FbxIOSettings*()
const
{
return
io_settings_; }
75
76
private
:
77
FbxIOSettings* io_settings_;
78
};
79
80
// Io settings used to import an animation from a scene.
81
class
OZZ_ANIMFBX_DLL
FbxAnimationIOSettings
:
public
FbxDefaultIOSettings
{
82
public
:
83
FbxAnimationIOSettings
(
const
FbxManagerInstance
& _manager);
84
};
85
86
// Io settings used to import a skeleton from a scene.
87
class
OZZ_ANIMFBX_DLL
FbxSkeletonIOSettings
:
public
FbxDefaultIOSettings
{
88
public
:
89
FbxSkeletonIOSettings
(
const
FbxManagerInstance
& _manager);
90
};
91
92
// Implements axis system and unit system conversion helper, from any Fbx system
93
// to ozz system (FbxAxisSystem::eYAxis, FbxAxisSystem::eParityOdd,
94
// FbxAxisSystem::eRightHanded, meter).
95
// While Fbx sdk FbxAxisSystem::ConvertScene and FbxSystem::ConvertScene only
96
// affect scene root, this class functions can be used to bake nodes, vertices,
97
// animations transformations...
98
class
OZZ_ANIMFBX_DLL
FbxSystemConverter
{
99
public
:
100
// Initialize converter with fbx scene systems.
101
FbxSystemConverter
(
const
FbxAxisSystem& _from_axis,
102
const
FbxSystemUnit& _from_unit);
103
104
// Converts a fbx matrix to an ozz Float4x4 matrix, in ozz axis and unit
105
// systems, using _m' = C * _m * (C-1) operation.
106
math::Float4x4
ConvertMatrix(
const
FbxAMatrix& _m)
const
;
107
108
// Converts fbx matrix to an ozz transform, in ozz axis and unit systems,
109
// using _m' = C * _m * (C-1) operation.
110
// Can return false if matrix isn't affine.
111
bool
ConvertTransform(
const
FbxAMatrix& _m,
112
math::Transform
* _transform)
const
;
113
114
// Converts fbx FbxVector4 point to an ozz Float3, in ozz axis and unit
115
// systems, using _p' = C * _p operation.
116
math::Float3
ConvertPoint(
const
FbxVector4& _p)
const
;
117
118
// Converts fbx FbxVector4 vector to an ozz Float3, in ozz axis and unit
119
// systems, using _p' = ((C-1)-T) * _p operation. Normals are converted
120
// using the inverse transpose matrix to support non-uniform scale
121
// transformations.
122
math::Float3
ConvertVector(
const
FbxVector4& _p)
const
;
123
124
private
:
125
// The matrix used to convert from "from" axis/unit to ozz coordinate system
126
// base.
127
math::Float4x4
convert_;
128
129
// The inverse of convert_ matrix.
130
math::Float4x4
inverse_convert_;
131
132
// The transpose inverse of convert_ matrix.
133
math::Float4x4
inverse_transpose_convert_;
134
};
135
136
// Loads a scene from a Fbx file.
137
class
OZZ_ANIMFBX_DLL
FbxSceneLoader
{
138
public
:
139
// Loads the scene that can then be obtained with scene() function.
140
FbxSceneLoader
(
const
char
* _filename,
const
char
* _password,
141
const
FbxManagerInstance
& _manager,
142
const
FbxDefaultIOSettings
& _io_settings);
143
144
FbxSceneLoader
(FbxStream* _stream,
const
char
* _password,
145
const
FbxManagerInstance
& _manager,
146
const
FbxDefaultIOSettings
& _io_settings);
147
148
~FbxSceneLoader
();
149
150
// Returns a valid scene if fbx import was successful, nullptr otherwise.
151
FbxScene* scene()
const
{
return
scene_; }
152
153
// Returns a valid converter if fbx import was successful, nullptr otherwise.
154
FbxSystemConverter
* converter() {
return
converter_; }
155
156
private
:
157
void
ImportScene(FbxImporter* _importer,
const
bool
_initialized,
158
const
char
* _password,
const
FbxManagerInstance
& _manager,
159
const
FbxDefaultIOSettings
& _io_settings);
160
161
// Scene instance that was loaded from the file.
162
FbxScene* scene_;
163
164
// Axis and unit conversion helper.
165
FbxSystemConverter
* converter_;
166
};
167
}
// namespace fbx
168
}
// namespace offline
169
}
// namespace animation
170
}
// namespace ozz
171
#endif
// OZZ_OZZ_ANIMATION_OFFLINE_FBX_FBX_H_
ozz::animation::offline::fbx::FbxAnimationIOSettings
Definition
fbx.h:81
ozz::animation::offline::fbx::FbxDefaultIOSettings
Definition
fbx.h:62
ozz::animation::offline::fbx::FbxManagerInstance
Definition
fbx.h:46
ozz::animation::offline::fbx::FbxSceneLoader
Definition
fbx.h:137
ozz::animation::offline::fbx::FbxSkeletonIOSettings
Definition
fbx.h:87
ozz::animation::offline::fbx::FbxSystemConverter
Definition
fbx.h:98
ozz::math::Float3
Definition
vec_float.h:67
ozz::math::Float4x4
Definition
simd_math.h:1066
ozz::math::Transform
Definition
transform.h:40
RavEngine
deps
ozz-animation
include
ozz
animation
offline
fbx
fbx.h
Generated by
1.9.8