TDME2 1.9.121
FBXReader.h
Go to the documentation of this file.
1#pragma once
2
3#define FBXSDK_SHARED
4
5#include <fbxsdk.h>
6
7#include <tdme/tdme.h>
11
14
22
23/**
24 * FBX model reader
25 * @author Andreas Drewke
26 * @version $Id$
27 */
29{
30public:
31
32 /**
33 * Reads FBX file
34 * @param pathName path name
35 * @param fileName file name
36 * @throws tdme::engine::fileio::models::ModelFileIOException
37 * @throws tdme::os::filesystem::FileSystemException
38 * @return model instance
39 */
40 static Model* read(const string& pathName, const string& fileName);
41
42private:
44 static constexpr float BLENDER_AMBIENT_FROM_DIFFUSE_SCALE { 0.7f };
45 static constexpr float BLENDER_DIFFUSE_SCALE { 0.8f };
46
47 /**
48 * Get scene up vector
49 * @param fbxScene fbx scene
50 * @throws tdme::engine::fileio::models::ModelFileIOException
51 */
52 static UpVector* getSceneUpVector(FbxScene* fbxScene);
53
54 /**
55 * Get scene rotation order
56 * @param fbxScene fbx scene
57 * @throws tdme::engine::fileio::models::ModelFileIOException
58 */
59 static RotationOrder* getSceneRotationOrder(FbxScene* fbxScene);
60
61 /**
62 * Set up model import rotation maxtrix
63 * @param model model
64 */
65 static void setupModelImportRotationMatrix(Model* model);
66
67 /**
68 * Set up model import scale maxtrix
69 * @param fbxScene fbx scene
70 * @param model model
71 */
72 static void setupModelScaleRotationMatrix(FbxScene* fbxScene, Model* model);
73
74 /**
75 * Process FBX scene
76 * @param fbxScene FBX scene
77 * @param model model
78 * @param pathName path name
79 */
80 static void processScene(FbxScene* fbxScene, Model* model, const string& pathName);
81
82 /**
83 * Process FBX node
84 * @param fbxNode FBX scene
85 * @param model model
86 * @param parentNode parent node
87 * @param pathName path name
88 */
89 static void processNode(FbxNode* fbxNode, Model* model, Node* parentNode, const string& pathName);
90
91 /**
92 * Process FBX mesh node
93 * @param fbxNode FBX node
94 * @param model model
95 * @param parentNode parent node
96 * @param pathName path name
97 */
98 static Node* processMeshNode(FbxNode* fbxNode, Model* model, Node* parentNode, const string& pathName);
99
100 /**
101 * Process FBX skeleton node
102 * @param fbxNode FBX node
103 * @param model model
104 * @param parentNode parent node
105 * @param pathName path name
106 */
107 static Node* processSkeletonNode(FbxNode* fbxNode, Model* model, Node* parentNode, const string& pathName);
108
109 /**
110 * Process animation
111 * @param fbxNode FBX node
112 * @param fbxStartFrame FBX start frame
113 * @param fbxEndFrame FBX end frame
114 * @param model model
115 * @param frameOffset frame offset
116 */
117 static void processAnimation(FbxNode* fbxNode, const FbxTime& fbxStartFrame, const FbxTime& fbxEndFrame, Model* model, int frameOffset);
118};
static constexpr float BLENDER_AMBIENT_FROM_DIFFUSE_SCALE
Definition: FBXReader.h:44
static Model * read(const string &pathName, const string &fileName)
Reads FBX file.
Definition: FBXReader.cpp:66
static UpVector * getSceneUpVector(FbxScene *fbxScene)
Get scene up vector.
Definition: FBXReader.cpp:234
static Node * processSkeletonNode(FbxNode *fbxNode, Model *model, Node *parentNode, const string &pathName)
Process FBX skeleton node.
Definition: FBXReader.cpp:908
static constexpr float BLENDER_DIFFUSE_SCALE
Definition: FBXReader.h:45
static Node * processMeshNode(FbxNode *fbxNode, Model *model, Node *parentNode, const string &pathName)
Process FBX mesh node.
Definition: FBXReader.cpp:330
static STATIC_DLL_IMPEXT const Color4 BLENDER_AMBIENT_NONE
Definition: FBXReader.h:43
static void processNode(FbxNode *fbxNode, Model *model, Node *parentNode, const string &pathName)
Process FBX node.
Definition: FBXReader.cpp:272
static void setupModelScaleRotationMatrix(FbxScene *fbxScene, Model *model)
Set up model import scale maxtrix.
Definition: FBXReader.cpp:259
static void setupModelImportRotationMatrix(Model *model)
Set up model import rotation maxtrix.
Definition: FBXReader.cpp:250
static RotationOrder * getSceneRotationOrder(FbxScene *fbxScene)
Get scene rotation order.
Definition: FBXReader.cpp:213
static void processAnimation(FbxNode *fbxNode, const FbxTime &fbxStartFrame, const FbxTime &fbxEndFrame, Model *model, int frameOffset)
Process animation.
Definition: FBXReader.cpp:913
static void processScene(FbxScene *fbxScene, Model *model, const string &pathName)
Process FBX scene.
Definition: FBXReader.cpp:264
Color 4 definition.
Definition: Color4.h:20
Representation of a 3d model.
Definition: Model.h:32
Model node.
Definition: Node.h:31
Represents rotation orders of a model.
Definition: RotationOrder.h:23
Model up vector.
Definition: UpVector.h:20
#define STATIC_DLL_IMPEXT
Definition: tdme.h:11