Mesh.h

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2009
00003 //
00004 //    This file is part of Scorched3D.
00005 //
00006 //    Scorched3D is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    Scorched3D is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with Scorched3D; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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         // Accessors
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         // Modification
00071         void move(Vector &movement);
00072 
00073         // Creation
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__

Generated on Mon Feb 16 15:14:48 2009 for Scorched3D by  doxygen 1.5.3