FXGLTriangleMesh.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *             O p e n G L   T r i a n g l e   M e s h   O b j e c t             *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1999,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library 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 GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXGLTriangleMesh.h,v 1.15 2006/01/22 17:58:04 fox Exp $                  *
00023 ********************************************************************************/
00024 #ifndef FX_DISABLEGL
00025 
00026 #if FX_GRAPHINGMODULE
00027 
00028 #ifndef FXGLTRIANGLEMESH_H
00029 #define FXGLTRIANGLEMESH_H
00030 
00031 #ifndef FXGLSHAPE_H
00032 #include "FXGLShape.h"
00033 #endif
00034 
00035 namespace FX {
00036 
00037 
00038 /*
00039  * Arrays Formats
00040  *
00041  * vertex: x,y,z
00042  * normal: x,y,z
00043  * Color: r,g.b,a
00044  * texture: u,v
00045  */
00046 
00047 
00049 class FXGRAPHINGMODULEAPI FXGLTriangleMesh : public FXGLShape {
00050   FXDECLARE(FXGLTriangleMesh)
00051 private:
00052   FXfloat   *vertexBuffer;
00053   FXfloat   *colorBuffer;
00054   FXfloat   *normalBuffer;
00055   FXfloat   *textureBuffer;
00056   FXint      vertexNumber;
00057 protected:
00058   FXGLTriangleMesh();
00059   virtual void drawshape(FXGLViewer* viewer);
00060   virtual void recomputerange();
00061   virtual void generatenormals();
00062 public:
00063 
00065   FXGLTriangleMesh(FXfloat x,FXfloat y,FXfloat z,FXint nv,FXfloat *v,FXfloat *n=NULL,FXfloat *c=NULL,FXfloat *t=NULL);
00066 
00068   FXGLTriangleMesh(FXfloat x,FXfloat y,FXfloat z,FXint nv,FXfloat *v,FXfloat *n,FXfloat *c,FXfloat *t,const FXMaterial& mtl);
00069 
00071   FXGLTriangleMesh(const FXGLTriangleMesh& orig);
00072 
00074   virtual FXGLObject* copy();
00075 
00077   void setVertexNumber(FXint nvertices){ vertexNumber=nvertices; }
00078 
00080   FXint getVertexNumber() const { return vertexNumber; }
00081 
00083   void setVertexBuffer(FXfloat *vertices);
00084 
00086   FXfloat* getVertexBuffer() const { return vertexBuffer; }
00087 
00089   void setColorBuffer(FXfloat *colors){ colorBuffer=colors; }
00090 
00092   FXfloat* getColorBuffer() const { return colorBuffer; }
00093 
00095   void setNormalBuffer(FXfloat *normals){ normalBuffer=normals; }
00096 
00098   FXfloat* getNormalBuffer() const { return normalBuffer; }
00099 
00101   void setTextureCoordBuffer(FXfloat *textures){ textureBuffer=textures; }
00102 
00104   FXfloat* getTextureCoordBuffer() const { return textureBuffer; }
00105 
00107   virtual void save(FXStream& store) const;
00108 
00110   virtual void load(FXStream& store);
00111 
00113   virtual ~FXGLTriangleMesh();
00114   };
00115 
00116 }
00117 
00118 #endif
00119 #endif
00120 #endif

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:22 2009 for TnFOX by doxygen v1.4.7