00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
00033
00034
00035
00036
00037
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