appMesh.h
Engine/source/ts/loader/appMesh.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 _APPMESH_H_ 25#define _APPMESH_H_ 26 27#ifndef _MMATH_H_ 28#include "math/mMath.h" 29#endif 30#ifndef _TVECTOR_H_ 31#include "core/util/tVector.h" 32#endif 33#ifndef _APPMATERIAL_H_ 34#include "ts/loader/appMaterial.h" 35#endif 36#ifndef _APPSEQUENCE_H_ 37#include "ts/loader/appSequence.h" 38#endif 39 40class AppNode; 41 42class AppMesh 43{ 44public: 45 // Mesh and skin elements 46 Vector<Point3F> points; 47 Vector<Point3F> normals; 48 Vector<Point2F> uvs; 49 Vector<Point2F> uv2s; 50 Vector<ColorI> colors; 51 Vector<TSDrawPrimitive> primitives; 52 Vector<U32> indices; 53 54 // Skin elements 55 Vector<F32> weight; 56 Vector<S32> boneIndex; 57 Vector<S32> vertexIndex; 58 Vector<S32> nodeIndex; 59 Vector<MatrixF> initialTransforms; 60 Vector<Point3F> initialVerts; 61 Vector<Point3F> initialNorms; 62 63 U32 flags; 64 U32 vertsPerFrame; 65 S32 numFrames; 66 S32 numMatFrames; 67 68 // Loader elements (can be discarded after loading) 69 S32 detailSize; 70 MatrixF objectOffset; 71 Vector<AppNode*> bones; 72 static Vector<AppMaterial*> appMaterials; 73 74public: 75 AppMesh(); 76 virtual ~AppMesh(); 77 78 void computeBounds(Box3F& bounds); 79 void computeNormals(); 80 81 // Create a TSMesh object 82 TSMesh* constructTSMesh(); 83 84 virtual const char * getName(bool allowFixed=true) = 0; 85 86 virtual MatrixF getMeshTransform(F32 time) = 0; 87 virtual F32 getVisValue(F32 time) = 0; 88 89 virtual bool getFloat(const char* propName, F32& defaultVal) = 0; 90 virtual bool getInt(const char* propName, S32& defaultVal) = 0; 91 virtual bool getBool(const char* propName, bool& defaultVal) = 0; 92 93 virtual bool animatesVis(const AppSequence* appSeq) { return false; } 94 virtual bool animatesMatFrame(const AppSequence* appSeq) { return false; } 95 virtual bool animatesFrame(const AppSequence* appSeq) { return false; } 96 97 virtual bool isBillboard(); 98 virtual bool isBillboardZAxis(); 99 100 virtual bool isSkin() { return false; } 101 virtual void lookupSkinData() = 0; 102 103 virtual void lockMesh(F32 t, const MatrixF& objOffset) { } 104}; 105 106#endif // _APPMESH_H_ 107