00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef LINESEGS_H
00016 #define LINESEGS_H
00017
00018 #include "pandabase.h"
00019
00020 #include "luse.h"
00021 #include "geom.h"
00022 #include "geomNode.h"
00023 #include "geomVertexData.h"
00024 #include "namable.h"
00025
00026 #include "pvector.h"
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 class EXPCL_PANDA_GRUTIL LineSegs : public Namable {
00037 PUBLISHED:
00038 LineSegs(const string &name = "lines");
00039 ~LineSegs();
00040
00041 void reset();
00042 INLINE void set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a = 1.0f);
00043 INLINE void set_color(const LColor &color);
00044 INLINE void set_thickness(PN_stdfloat thick);
00045
00046 INLINE void move_to(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
00047 void move_to(const LVecBase3 &v);
00048
00049 INLINE void draw_to(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
00050 void draw_to(const LVecBase3 &v);
00051
00052 const LVertex &get_current_position();
00053 bool is_empty();
00054
00055 INLINE GeomNode *create(bool dynamic = false);
00056 GeomNode *create(GeomNode *previous, bool dynamic = false);
00057
00058
00059 INLINE int get_num_vertices() const;
00060 LVertex get_vertex(int n) const;
00061 MAKE_SEQ(get_vertices, get_num_vertices, get_vertex);
00062 void set_vertex(int n, const LVertex &vert);
00063 INLINE void set_vertex(int vertex, PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
00064
00065 LColor get_vertex_color(int vertex) const;
00066 MAKE_SEQ(get_vertex_colors, get_num_vertices, get_vertex_color);
00067 void set_vertex_color(int vertex, const LColor &c);
00068 INLINE void set_vertex_color(int vertex, PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a = 1.0f);
00069
00070 private:
00071 class Point {
00072 public:
00073 INLINE Point();
00074 INLINE Point(const LVecBase3 &point, const LColor &color);
00075 INLINE Point(const Point ©);
00076 INLINE void operator = (const Point ©);
00077
00078 LVertex _point;
00079 UnalignedLVecBase4 _color;
00080 };
00081
00082 typedef pvector<Point> SegmentList;
00083 typedef pvector<SegmentList> LineList;
00084
00085 LineList _list;
00086 LColor _color;
00087 PN_stdfloat _thick;
00088
00089 PT(GeomVertexData) _created_data;
00090 };
00091
00092 #include "lineSegs.I"
00093
00094 #endif