Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

trimesh.h

Go to the documentation of this file.
00001 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
00002 
00003    this file is part of rcssserver3D
00004    Fri May 9 2003
00005    Copyright (C) 2002,2003 Koblenz University
00006    Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group
00007    $Id: trimesh.h,v 1.2 2004/04/22 17:57:13 rollmark Exp $
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; version 2 of the License.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00021 */
00022 #ifndef OXYGEN_TRIMESH
00023 #define OXYGEN_TRIMESH
00024 
00025 #include "indexbuffer.h"
00026 #include <list>
00027 #include <boost/shared_array.hpp>
00028 #include <boost/shared_ptr.hpp>
00029 #include <string>
00030 
00031 namespace oxygen
00032 {
00033 
00044 class TriMesh
00045 {
00046 public:
00047     struct Face
00048     {
00049     public:
00050         boost::shared_ptr<IndexBuffer> indeces;
00051         std::string material;
00052 
00053     public:
00054         Face(boost::shared_ptr<IndexBuffer> i, std::string m)
00055             : indeces(i), material(m) {};
00056     };
00057 
00058     typedef std::list<Face> TFaces;
00059 
00060 public:
00061     TriMesh();
00062     ~TriMesh();
00063 
00065     void SetPos(boost::shared_array<float> pos, int vertexCount);
00066 
00068     const boost::shared_array<float> GetPos() const;
00069 
00071     int GetVertexCount() const;
00072 
00074     void SetTexCoords(boost::shared_array<float> texCoords);
00075 
00077     const boost::shared_array<float> GetTexCoords() const;
00078 
00080     void SetNormals(boost::shared_array<float> normal);
00081 
00083     const boost::shared_array<float> GetNormals() const;
00084 
00087     void AddFace(boost::shared_ptr<IndexBuffer> indeces,
00088                   const std::string& material = "default");
00089 
00092     void AddFace(const Face& face);
00093 
00095     const TFaces& GetFaces() const;
00096 
00098     const std::string& GetName() const;
00099 
00101     void SetName(const std::string& name);
00102 
00103 protected:
00105     std::string mName;
00106 
00108     int mVertexCount;
00109 
00111     boost::shared_array<float> mPos;
00112 
00114     boost::shared_array<float> mTexCoords;
00115 
00117     boost::shared_array<float> mNormal;
00118 
00120     TFaces mFaces;
00121 };
00122 
00123 } // namespace oxygen
00124 
00125 #endif // OXYGEN_TRIMESH

Generated on Thu Apr 6 15:25:40 2006 for rcssserver3d by  doxygen 1.4.4