Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

/home/jeroen/FOX/fox/fox-1.7.33/include/FXGLTriangleMesh.h
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,2012 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (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                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 ********************************************************************************/
00021 #ifndef FXGLTRIANGLEMESH_H
00022 #define FXGLTRIANGLEMESH_H
00023 
00024 #ifndef FXGLSHAPE_H
00025 #include "FXGLShape.h"
00026 #endif
00027 
00028 namespace FX {
00029 
00030 
00031 /*
00032  * Arrays Formats
00033  *
00034  * vertex: x,y,z
00035  * normal: x,y,z
00036  * Color: r,g.b,a
00037  * texture: u,v
00038  */
00039 
00040 
00042 class FXAPI FXGLTriangleMesh : public FXGLShape {
00043   FXDECLARE(FXGLTriangleMesh)
00044 private:
00045   FXfloat   *vertexBuffer;
00046   FXfloat   *colorBuffer;
00047   FXfloat   *normalBuffer;
00048   FXfloat   *textureBuffer;
00049   FXint      vertexNumber;
00050 protected:
00051   FXGLTriangleMesh();
00052   virtual void drawshape(FXGLViewer* viewer);
00053   virtual void recomputerange();
00054   virtual void generatenormals();
00055 public:
00056 
00058   FXGLTriangleMesh(FXfloat x,FXfloat y,FXfloat z,FXint nv,FXfloat *v,FXfloat *n=NULL,FXfloat *c=NULL,FXfloat *t=NULL);
00059 
00061   FXGLTriangleMesh(FXfloat x,FXfloat y,FXfloat z,FXint nv,FXfloat *v,FXfloat *n,FXfloat *c,FXfloat *t,const FXMaterial& mtl);
00062 
00064   FXGLTriangleMesh(const FXGLTriangleMesh& orig);
00065 
00067   virtual FXGLObject* copy();
00068 
00070   void setVertexNumber(FXint nvertices){ vertexNumber=nvertices; }
00071 
00073   FXint getVertexNumber() const { return vertexNumber; }
00074 
00076   void setVertexBuffer(FXfloat *vertices);
00077 
00079   FXfloat* getVertexBuffer() const { return vertexBuffer; }
00080 
00082   void setColorBuffer(FXfloat *colors){ colorBuffer=colors; }
00083 
00085   FXfloat* getColorBuffer() const { return colorBuffer; }
00086 
00088   void setNormalBuffer(FXfloat *normals){ normalBuffer=normals; }
00089 
00091   FXfloat* getNormalBuffer() const { return normalBuffer; }
00092 
00094   void setTextureCoordBuffer(FXfloat *textures){ textureBuffer=textures; }
00095 
00097   FXfloat* getTextureCoordBuffer() const { return textureBuffer; }
00098 
00100   virtual void save(FXStream& store) const;
00101 
00103   virtual void load(FXStream& store);
00104 
00106   virtual ~FXGLTriangleMesh();
00107   };
00108 
00109 }
00110 
00111 #endif

Copyright © 1997-2011 Jeroen van der Zijp