00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #if !defined(__INCLUDE_Meshh_INCLUDE__)
00022 #define __INCLUDE_Meshh_INCLUDE__
00023
00024 #include <common/DefinesAssert.h>
00025 #include <common/Vector4.h>
00026 #include <3dsparse/Face.h>
00027 #include <3dsparse/Vertex.h>
00028 #include <vector>
00029 #include <string>
00030
00031 class Mesh
00032 {
00033 public:
00034 Mesh(const char *name);
00035 virtual ~Mesh();
00036
00037
00038 const char *getName() { return name_.c_str(); }
00039 bool getSphereMap() { return sphereMap_; }
00040 Vector &getMin() { return min_; }
00041 Vector &getMax() { return max_; }
00042 Vector4 &getAmbientColor() { return ambientColor_; }
00043 Vector4 &getDiffuseColor() { return diffuseColor_; }
00044 Vector4 &getSpecularColor() { return specularColor_; }
00045 Vector4 &getEmissiveColor() { return emissiveColor_; }
00046 Vector4 &getAmbientNoTexColor() { return ambientNoTexColor_; }
00047 Vector4 &getDiffuseNoTexColor() { return diffuseNoTexColor_; }
00048 Vector4 &getSpecularNoTexColor() { return specularNoTexColor_; }
00049 Vector4 &getEmissiveNoTexColor() { return emissiveNoTexColor_; }
00050 float &getShininessColor() { return shininessColor_; }
00051 const char *getTextureName()
00052 { return textureName_.c_str(); }
00053 const char *getATextureName()
00054 { return aTextureName_.c_str(); }
00055
00056 std::vector<int> &getCollapseMap()
00057 { return collapseMap_; }
00058 std::vector<Face *> &getFaces()
00059 { return faces_; }
00060 Face *getFace(int faceIndex)
00061 { DIALOG_ASSERT(faceIndex < (int) faces_.size());
00062 return faces_[faceIndex]; }
00063 std::vector<Vertex *> &getVertexes()
00064 { return vertexes_; }
00065 Vertex *getVertex(int vertexIndex)
00066 { DIALOG_ASSERT(vertexIndex < (int) vertexes_.size());
00067 return vertexes_[vertexIndex]; }
00068 bool &getReferencesBones() { return referencesBones_; }
00069
00070
00071 void move(Vector &movement);
00072
00073
00074 void setupCollapse();
00075 void insertFace(Face &face)
00076 { faces_.push_back(new Face(face)); }
00077 void insertVertex(Vertex &vertex);
00078 void setTextureName(const char *t);
00079 void setATextureName(const char *t) { aTextureName_ = t; }
00080 void setFaceNormal(Vector &normal, int faceIndex, int normalIndex)
00081 { DIALOG_ASSERT(faceIndex < (int) faces_.size());
00082 faces_[faceIndex]->normal[normalIndex] = normal; }
00083 void setFaceTCoord(Vector &coord, int faceIndex, int coordIndex)
00084 { DIALOG_ASSERT(faceIndex < (int) faces_.size());
00085 faces_[faceIndex]->tcoord[coordIndex] = coord; }
00086
00087 protected:
00088 std::string name_;
00089 std::string textureName_, aTextureName_;
00090 std::vector<Face *> faces_;
00091 std::vector<Vertex *> vertexes_;
00092 std::vector<int> collapseMap_;
00093 bool referencesBones_;
00094 bool sphereMap_;
00095 float shininessColor_;
00096 Vector4 diffuseColor_, specularColor_;
00097 Vector4 ambientColor_, emissiveColor_;
00098 Vector4 diffuseNoTexColor_, specularNoTexColor_;
00099 Vector4 ambientNoTexColor_, emissiveNoTexColor_;
00100 Vector min_, max_;
00101 };
00102
00103 #endif // __INCLUDE_Meshh_INCLUDE__