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