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 FXGLVERTICES_H
00029 #define FXGLVERTICES_H
00030
00031 #ifndef FXGLSHAPE_H
00032 #include "FXGLShape.h"
00033 #endif
00034
00035 namespace FX {
00036
00037
00038
00039 enum {
00040 VERTICES_POINTS = 0x00000100,
00041 VERTICES_LINES = 0x00000200,
00042 VERTICES_LOOPLINES = 0x00000400,
00043 VERTICES_LINEITEMS = 0x00000800,
00044 VERTICES_NODEPTHTEST = 0x00001000
00045 };
00046
00047
00053 class FXGRAPHINGMODULEAPI FXGLVertices : public FXGLShape {
00054 FXDECLARE(FXGLVertices)
00055 public:
00056 typedef void (*ColorGeneratorFunc)(FXGLColor &color, FXGLVertices *obj, FXGLViewer *viewer, FXuint vertex, void *&data);
00057
00058 protected:
00059 FXuchar modified;
00060 FXuint displayLists;
00061 FXuint vertexNumber;
00062 FXVec3f *vertices;
00063 FXfloat pointSize, lineSize;
00064 FXGLColor color;
00065 ColorGeneratorFunc colorGenerator;
00066 void *colorGeneratorData;
00067 protected:
00068 FXGLVertices();
00069 private:
00070 friend class FXGLCircle;
00071 inline void renderPoints(FXGLViewer *viewer, bool isHit, bool complex);
00072 inline void renderLines(FXGLViewer *viewer, bool isHit, bool complex);
00073 inline void render(FXGLViewer *viewer, bool isHit, bool complex);
00074 virtual void drawshape(FXGLViewer*);
00075 public:
00077 FXGLVertices(FXfloat x,FXfloat y,FXfloat z,FXuint opts=VERTICES_POINTS, FXVec3f *vertices=NULL, FXuint no=0, FXfloat pointSize=4.0f, FXfloat lineSize=1.0f);
00078
00080 FXGLVertices(const FXGLVertices& orig);
00081
00082 ~FXGLVertices();
00083
00085 void setModified(bool v=true) { modified=3*v; }
00086
00088 FXuint getNumberOfVertices() const { return vertexNumber; }
00089
00091 void setNumberOfVertices(FXuint vertices);
00092
00094 FXVec3f *getVertices() const { return vertices; }
00095
00097 void setVertices(FXVec3f *verts, FXuint no);
00098
00100 FXfloat getPointSize() const { return pointSize; }
00101
00103 void setPointSize(FXfloat ps);
00104
00106 FXfloat getLineSize() const { return lineSize; }
00107
00109 void setLineSize(FXfloat ps);
00110
00112 const FXGLColor &getColor() const { return color; }
00113
00115 void setColor(const FXGLColor &col);
00116
00118 void setColorGenerator(ColorGeneratorFunc func, void *data=0);
00119
00121 virtual void bounds(FXRangef& box);
00122
00124 virtual void draw(FXGLViewer* viewer);
00125
00127 virtual void hit(FXGLViewer* viewer);
00128
00130 virtual FXGLObject* copy();
00131
00133 virtual void save(FXStream& store) const;
00134
00136 virtual void load(FXStream& store);
00137
00138 public:
00140 static void RainbowGenerator(FXGLColor &color, FXGLVertices *obj, FXGLViewer *viewer, FXuint vertex, void *&data);
00141
00143 static void BrighterGenerator(FXGLColor &color, FXGLVertices *obj, FXGLViewer *viewer, FXuint vertex, void *&data);
00144
00146 static void DarkerGenerator(FXGLColor &color, FXGLVertices *obj, FXGLViewer *viewer, FXuint vertex, void *&data);
00147
00148 };
00149
00150
00156 class FXGRAPHINGMODULEAPI FXGLCircle : public FXGLShape {
00157 float radius;
00158 FXMat4f transformation;
00159 protected:
00160 virtual void drawshape(FXGLViewer*);
00161 public:
00162 FXGLCircle() { }
00164 FXGLCircle(float x, float y, float z, float r, FXuint options=0);
00166 const FXMat4f &getTransformation() const { return transformation; }
00168 void setTransformation(const FXMat4f &t) { transformation=t; }
00169
00170 virtual void bounds(FXRangef& box);
00171 virtual void draw(FXGLViewer* viewer);
00172 virtual FXGLObject* copy();
00173 virtual void save(FXStream& store) const;
00174 virtual void load(FXStream& store);
00175 };
00176
00177 }
00178
00179 #endif
00180 #endif
00181 #endif