assimpAppMesh.h
Engine/source/ts/assimp/assimpAppMesh.h
Classes:
class
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_APPMESH_H_ 25#define _ASSIMP_APPMESH_H_ 26 27#ifndef _APPMESH_H_ 28#include "ts/loader/appMesh.h" 29#endif 30#ifndef _TSSHAPELOADER_H_ 31#include "ts/loader/tsShapeLoader.h" 32#endif 33#ifndef _ASSIMP_APPNODE_H_ 34#include "ts/assimp/assimpAppNode.h" 35#endif 36 37class AssimpAppMesh : public AppMesh 38{ 39 typedef AppMesh Parent; 40 41protected: 42 class AssimpAppNode* appNode; ///< Pointer to the node that owns this mesh 43 const struct aiMesh* mMeshData; 44 bool mIsSkinMesh; 45 46 static bool fixedSizeEnabled; ///< Set to true to fix the detail size to a particular value for all geometry 47 static S32 fixedSize; ///< The fixed detail size value for all geometry 48 49public: 50 51 AssimpAppMesh(const struct aiMesh* mesh, AssimpAppNode* node); 52 ~AssimpAppMesh() 53 { 54 //delete geomExt; 55 } 56 57 void lookupSkinData(); 58 59 static void fixDetailSize(bool fixed, S32 size=2) 60 { 61 fixedSizeEnabled = fixed; 62 fixedSize = size; 63 } 64 65 /// Get the name of this mesh 66 /// 67 /// @return A string containing the name of this mesh 68 const char *getName(bool allowFixed=true); 69 70 //----------------------------------------------------------------------- 71 72 /// Get a floating point property value 73 /// 74 /// @param propName Name of the property to get 75 /// @param defaultVal Reference to variable to hold return value 76 /// 77 /// @return True if a value was set, false if not 78 bool getFloat(const char *propName, F32 &defaultVal) 79 { 80 return appNode->getFloat(propName,defaultVal); 81 } 82 83 /// Get an integer property value 84 /// 85 /// @param propName Name of the property to get 86 /// @param defaultVal Reference to variable to hold return value 87 /// 88 /// @return True if a value was set, false if not 89 bool getInt(const char *propName, S32 &defaultVal) 90 { 91 return appNode->getInt(propName,defaultVal); 92 } 93 94 /// Get a boolean property value 95 /// 96 /// @param propName Name of the property to get 97 /// @param defaultVal Reference to variable to hold return value 98 /// 99 /// @return True if a value was set, false if not 100 bool getBool(const char *propName, bool &defaultVal) 101 { 102 return appNode->getBool(propName,defaultVal); 103 } 104 105 /// Return true if this mesh is a skin 106 bool isSkin() 107 { 108 return mIsSkinMesh; 109 } 110 111 /// Generate the vertex, normal and triangle data for the mesh. 112 /// 113 /// @param time Time at which to generate the mesh data 114 /// @param objectOffset Transform to apply to the generated data (bounds transform) 115 void lockMesh(F32 time, const MatrixF& objOffset); 116 117 /// Get the transform of this mesh at a certain time 118 /// 119 /// @param time Time at which to get the transform 120 /// 121 /// @return The mesh transform at the specified time 122 MatrixF getMeshTransform(F32 time); 123 F32 getVisValue(F32 t); 124}; 125 126#endif // _COLLADA_APPMESH_H_ 127