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

imeshbuilder.h

Go to the documentation of this file.
00001 /*
00002     Sheep - A Rigid Body Dynamics Engine
00003     Copyright (C) 2001-2004 Francois Beaune
00004     Contact: http://toxicengine.sourceforge.net/
00005 
00006     This file is part of Sheep.
00007 
00008     Sheep is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012 
00013     Sheep 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 Sheep; if not, write to the Free Software
00020     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 */
00022 
00023 #ifndef SHEEP_MESHIO_IMESHBUILDER_H
00024 #define SHEEP_MESHIO_IMESHBUILDER_H
00025 
00026 #include "common/math/vector2.h"
00027 #include "common/math/vector3.h"
00028 
00029 #include <string>
00030 
00031 namespace sheep {
00032 
00033     class IMeshBuilder {
00034     public:
00035         typedef int FeatureId;
00036 
00037         class IGeometryBuilder {
00038         public:
00039             //!\todo Ideally, the destructor should be pure virtual with empty body.
00040             virtual ~IGeometryBuilder() {}
00041 
00042             virtual void BeginSubMesh(const std::string &name) {}
00043             virtual void EndSubMesh() {}
00044 
00045             virtual FeatureId AppendVertex(const Vector3 &v) { return 0; }
00046             virtual FeatureId AppendNormal(const Vector3 &vn) { return 0; }
00047             virtual FeatureId AppendTexCoord(const Vector2 &vt) { return 0; }
00048             virtual FeatureId AppendFace(int n, const FeatureId *v) { return 0; }
00049 
00050             virtual void SetFaceNormals(FeatureId face, int n, const FeatureId *vn) {}
00051             virtual void SetFaceTexCoords(FeatureId face, int n, const FeatureId *vt) {}
00052 
00053             virtual void SetMaterial(FeatureId material) {}
00054         };
00055 
00056         class IMaterialBuilder {
00057         public:
00058             //!\todo Ideally, the destructor should be pure virtual with empty body.
00059             virtual ~IMaterialBuilder() {}
00060 
00061             virtual FeatureId BeginMaterial(const std::string &name) { return 0; }
00062             virtual void EndMaterial() {}
00063 
00064             virtual void SetAmbientColor(Real r, Real g, Real b) {}
00065             virtual void SetDiffuseColor(Real r, Real g, Real b) {}
00066             virtual void SetSpecularColor(Real r, Real g, Real b) {}
00067 
00068             //! 'texels' points to a temporary location containing texel data.
00069             virtual void SetTexture(int w, int h, const unsigned char *texels) {}   //!< 24-bit RGB format.
00070         };
00071 
00072         virtual ~IMeshBuilder() {}
00073 
00074         virtual IGeometryBuilder *GeometryBuilder() = 0;
00075         virtual IMaterialBuilder *MaterialBuilder() = 0;
00076     };
00077 
00078 }
00079 
00080 #endif  // !SHEEP_MESHIO_IMESHBUILDER_H

Generated on Tue May 11 01:31:50 2004 for toxic by doxygen 1.3.6