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