Torque3D Documentation / _generateds / assimpShapeLoader.h

assimpShapeLoader.h

Engine/source/ts/assimp/assimpShapeLoader.h

More...

Classes:

Detailed Description

 1
 2//-----------------------------------------------------------------------------
 3// Copyright (c) 2012 GarageGames, LLC
 4//
 5// Permission is hereby granted, free of charge, to any person obtaining a copy
 6// of this software and associated documentation files (the "Software"), to
 7// deal in the Software without restriction, including without limitation the
 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 9// sell copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21// IN THE SOFTWARE.
22//-----------------------------------------------------------------------------
23
24#ifndef _ASSIMP_SHAPELOADER_H_
25#define _ASSIMP_SHAPELOADER_H_
26
27#ifndef _TSSHAPELOADER_H_
28#include "ts/loader/tsShapeLoader.h"
29#endif
30#include <assimp/texture.h>
31
32class GuiTreeViewCtrl;
33struct aiNode;
34struct aiMetadata;
35//-----------------------------------------------------------------------------
36class AssimpShapeLoader : public TSShapeLoader
37{
38   friend TSShape* assimpLoadShape(const Torque::Path &path);
39
40protected:
41   const struct aiScene* mScene;
42
43   virtual bool ignoreNode(const String& name);
44   virtual bool ignoreMesh(const String& name);
45   void detectDetails();
46   void extractTexture(U32 index, aiTexture* pTex);
47
48private:
49   void addNodeToTree(S32 parentItem, aiNode* node, GuiTreeViewCtrl* tree, U32& nodeCount);
50   void addMetaDataToTree(const aiMetadata* metaData, GuiTreeViewCtrl* tree);
51   bool getMetabool(const char* key, bool& boolVal);
52   bool getMetaInt(const char* key, S32& intVal);
53   bool getMetaFloat(const char* key, F32& floatVal);
54   bool getMetaDouble(const char* key, F64& doubleVal);
55   bool getMetaString(const char* key, String& stringVal);
56
57public:
58   AssimpShapeLoader();
59   ~AssimpShapeLoader();
60
61   void releaseImport();
62   void enumerateScene();
63   void updateMaterialsScript(const Torque::Path &path);
64   void processAnimations();
65
66   void computeBounds(Box3F& bounds);
67
68   bool fillGuiTreeView(const char* shapePath, GuiTreeViewCtrl* tree);
69
70   static bool canLoadCachedDTS(const Torque::Path& path);
71   static void assimpLogCallback(const char* message, char* user);
72};
73
74#endif // _ASSIMP_SHAPELOADER_H_
75