Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

vpmeshobject.h

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 // ChangeLog is at the implementation file.
00006 
00007 #ifndef __VPMESHOBJECT_H
00008 #define __VPMESHOBJECT_H
00009 
00010 #include "vpmesh.h"
00011 #include "vppoint4d.h"
00012 #include "vpgraphicobj.h"
00013 #include "vptransform.h"
00014 #include <vector>
00015 #include <list>
00016 #include <map>
00017 
00026 class VPMeshObject : public VPGraphicObj {
00027     public:
00028     // PUBLIC METHODS
00029         VPMeshObject();
00030         VPMeshObject(const VPMeshObject& obj);
00031         VPMeshObject& operator=(const VPMeshObject& obj);
00033 
00035         void SetMaterial(const VPMaterial& mat);
00036 
00038         void MakeBox(double minX, double maxX, double minY, double maxY, double minZ, double maxZ);
00039     
00045         void GetYProjection(std::list<VPPoint4D>* resultPtr, double height=0) const;
00046 
00051         void Optimize();
00052 
00054 
00057         void Clear();
00058 
00061 
00065         void SetVertices(const std::vector<VPPoint4D>& vertexVec);
00066 
00070 
00076         void SetVertices(const char* vertexStr);
00077 
00082 
00086         void AddFace(const char* indexStr);
00087 
00089         virtual void ComputeBoundingBox();
00090 
00091         virtual TypeID GetID() const { return MESH_OBJECT; }
00092 
00094 
00096         void MergeWith(const VPMeshObject& obj);
00097 
00099         void Transform(const VPTransform& trans);
00100 
00101         //~ /// \brief Splits the object along some plane parallel to XZ.
00102         //~ /// \param y [in] Position of the cutting plane.
00103         //~ /// \param ptObjAbove [out] Parts that lie below the cutting plane.
00104         //~ /// \param ptObjBelow [out] Parts that lie above the cutting plane.
00105         //~ ///
00106         //~ /// Splits an object into two, along a cutting plane. The two resulting objects
00107         //~ /// are returned by filling the objects pointed by ptObjAbove and ptObjBelow, which
00108         //~ /// must not contain previous geometry (use Clear()). If the cutting plane does not
00109         //~ /// intersect the object, one of the resulting objects will be empty (check with
00110         //~ /// IsEmpty()).
00111         //~ void YSplit(double y, VPMeshObject* ptObjBelow, VPMeshObject* ptObjAbove) const;
00112 
00117         bool IsEmpty() { return meshList.empty(); }
00118 
00119     // STATIC PUBLIC METHODS
00125 
00127         static void ComputeTriangleNormal(const VPPoint4D& v1, const VPPoint4D& v2,
00128                                           const VPPoint4D& v3, VPPoint4D* resultPtr);
00129 
00131 
00135         static void ReadFromOBJ(const std::string& filename, std::list<VPMeshObject*>* resultPtr);
00136     protected:
00137     // Protected Methods
00138         virtual bool DrawInstanceOGL() const;
00139         static void ReadMaterialTable(const std::string& filename,
00140                                       std::map<std::string,VPMaterial>* matMapPtr);
00141     // Protected Attributes
00143 
00146         std::vector<VPPoint4D> vertVec;
00147 
00149 
00153         std::vector<double> vertCoordVec;
00154 
00156 
00159         std::vector<VPPoint4D> normVec;
00160 
00162 
00165         std::vector<double> normCoordVec;
00166 
00168 
00171         std::vector<float> textCoordVec;
00172 
00174         std::list<VPMesh> meshList;
00175 };
00176 
00177 #endif

Generated on Tue Sep 6 10:00:04 2005 for VPAT by  doxygen 1.4.4