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 FXGLTRIANGLEMESH_H
00025 #define FXGLTRIANGLEMESH_H
00026
00027 #ifndef FXGLSHAPE_H
00028 #include "FXGLShape.h"
00029 #endif
00030
00031 namespace FX {
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 class FXAPI FXGLTriangleMesh : public FXGLShape {
00046 FXDECLARE(FXGLTriangleMesh)
00047 private:
00048 FXfloat *vertexBuffer;
00049 FXfloat *colorBuffer;
00050 FXfloat *normalBuffer;
00051 FXfloat *textureBuffer;
00052 FXint vertexNumber;
00053 protected:
00054 FXGLTriangleMesh();
00055 virtual void drawshape(FXGLViewer* viewer);
00056 virtual void recomputerange();
00057 virtual void generatenormals();
00058 public:
00059
00060
00061 FXGLTriangleMesh(FXfloat x,FXfloat y,FXfloat z,FXint nv,FXfloat *v,FXfloat *n=NULL,FXfloat *c=NULL,FXfloat *t=NULL);
00062
00063
00064 FXGLTriangleMesh(FXfloat x,FXfloat y,FXfloat z,FXint nv,FXfloat *v,FXfloat *n,FXfloat *c,FXfloat *t,const FXMaterial& mtl);
00065
00066
00067 FXGLTriangleMesh(const FXGLTriangleMesh& orig);
00068
00069
00070 virtual FXGLObject* copy();
00071
00072
00073 void setVertexNumber(FXint nvertices){ vertexNumber=nvertices; }
00074
00075
00076 FXint getVertexNumber() const { return vertexNumber; }
00077
00078
00079 void setVertexBuffer(FXfloat *vertices);
00080
00081
00082 FXfloat* getVertexBuffer() const { return vertexBuffer; }
00083
00084
00085 void setColorBuffer(FXfloat *colors){ colorBuffer=colors; }
00086
00087
00088 FXfloat* getColorBuffer() const { return colorBuffer; }
00089
00090
00091 void setNormalBuffer(FXfloat *normals){ normalBuffer=normals; }
00092
00093
00094 FXfloat* getNormalBuffer() const { return normalBuffer; }
00095
00096
00097 void setTextureCoordBuffer(FXfloat *textures){ textureBuffer=textures; }
00098
00099
00100 FXfloat* getTextureCoordBuffer() const { return textureBuffer; }
00101
00102
00103 virtual void save(FXStream& store) const;
00104
00105
00106 virtual void load(FXStream& store);
00107
00108
00109 virtual ~FXGLTriangleMesh();
00110 };
00111
00112 }
00113
00114 #endif