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

FXGLTriangleMesh.h
1 /********************************************************************************
2 * *
3 * O p e n G L T r i a n g l e M e s h O b j e c t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1999,2016 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXGLTRIANGLEMESH_H
22 #define FXGLTRIANGLEMESH_H
23 
24 #ifndef FXGLSHAPE_H
25 #include "FXGLShape.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 /*
32  * Arrays Formats
33  *
34  * vertex: x,y,z
35  * normal: x,y,z
36  * Color: r,g.b,a
37  * texture: u,v
38  */
39 
40 
42 class FXAPI FXGLTriangleMesh : public FXGLShape {
43  FXDECLARE(FXGLTriangleMesh)
44 private:
45  FXfloat *vertexBuffer;
46  FXfloat *colorBuffer;
47  FXfloat *normalBuffer;
48  FXfloat *textureBuffer;
49  FXint vertexNumber;
50 protected:
52  virtual void drawshape(FXGLViewer* viewer);
53  virtual void recomputerange();
54  virtual void generatenormals();
55 public:
56 
58  FXGLTriangleMesh(FXfloat x,FXfloat y,FXfloat z,FXint nv,FXfloat *v,FXfloat *n=NULL,FXfloat *c=NULL,FXfloat *t=NULL);
59 
61  FXGLTriangleMesh(FXfloat x,FXfloat y,FXfloat z,FXint nv,FXfloat *v,FXfloat *n,FXfloat *c,FXfloat *t,const FXMaterial& mtl);
62 
65 
67  virtual FXGLObject* copy();
68 
70  void setVertexNumber(FXint nvertices){ vertexNumber=nvertices; }
71 
73  FXint getVertexNumber() const { return vertexNumber; }
74 
76  void setVertexBuffer(FXfloat *vertices);
77 
79  FXfloat* getVertexBuffer() const { return vertexBuffer; }
80 
82  void setColorBuffer(FXfloat *colors){ colorBuffer=colors; }
83 
85  FXfloat* getColorBuffer() const { return colorBuffer; }
86 
88  void setNormalBuffer(FXfloat *normals){ normalBuffer=normals; }
89 
91  FXfloat* getNormalBuffer() const { return normalBuffer; }
92 
94  void setTextureCoordBuffer(FXfloat *textures){ textureBuffer=textures; }
95 
97  FXfloat* getTextureCoordBuffer() const { return textureBuffer; }
98 
100  virtual void save(FXStream& store) const;
101 
103  virtual void load(FXStream& store);
104 
106  virtual ~FXGLTriangleMesh();
107  };
108 
109 }
110 
111 #endif

Copyright © 1997-2016 Jeroen van der Zijp