00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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
00040
00041
00042
00043
00044
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