16 #include "renderState.h"
17 #include "renderModeAttrib.h"
19 #include "geomLinestrips.h"
20 #include "geomPoints.h"
21 #include "geomVertexReader.h"
22 #include "geomVertexWriter.h"
23 #include "colorAttrib.h"
38 _color.set(1.0f, 1.0f, 1.0f, 1.0f);
76 segs.push_back(Point(v, _color));
79 _list.push_back(segs);
103 segs.push_back(Point(v, _color));
116 return _list.empty();
130 nassertr(_created_data != (
GeomVertexData *)NULL, LVertex::zero());
190 move_to(LVertex(0.0f, 0.0f, 0.0f));
193 return _list.back().back()._point;
212 if (!_list.empty()) {
213 CPT(
RenderAttrib) thick = RenderModeAttrib::make(RenderModeAttrib::M_unchanged, _thick);
214 CPT(
RenderAttrib) vtxcolor = ColorAttrib::make_vertex();
215 CPT(
RenderState) state = RenderState::make(thick, vtxcolor);
218 (
"lineSegs", GeomVertexFormat::get_v3cp(),
219 dynamic ? Geom::UH_dynamic : Geom::UH_static);
227 LineList::const_iterator ll;
228 SegmentList::const_iterator sl;
230 for (ll = _list.begin(); ll != _list.end(); ll++) {
233 if (segs.size() < 2) {
235 for (sl = segs.begin(); sl != segs.end(); sl++) {
236 points->add_vertex(v);
241 points->close_primitive();
246 for (sl = segs.begin(); sl != segs.end(); sl++) {
247 lines->add_vertex(v);
252 lines->close_primitive();
256 if (lines->get_num_vertices() != 0) {
257 PT(
Geom) geom =
new Geom(_created_data);
258 geom->add_primitive(lines);
261 if (points->get_num_vertices() != 0) {
262 PT(
Geom) geom =
new Geom(_created_data);
263 geom->add_primitive(points);
bool is_empty()
Returns true if move_to() or draw_to() have not been called since the last reset() or create()...
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
This is the base class for all three-component vectors and points.
LineSegs(const string &name="lines")
Constructs a LineSegs object, which can be used to create any number of disconnected lines or points ...
This is the base class for a number of render attributes (other than transform) that may be set on sc...
Defines a series of disconnected points.
void set_data3(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
Sets the write row to a particular 3-component value, and advances the write row. ...
const LVertex & get_current_position()
Returns the pen's current position.
const LVecBase4 & get_data4()
Returns the data associated with the read row, expressed as a 4-component value, and advances the rea...
GeomNode * create(bool dynamic=false)
Creates a new GeomNode that will render the series of line segments and points described via calls to...
void add_data4(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat w)
Sets the write row to a particular 4-component value, and advances the write row. ...
This is our own Panda specialization on the default STL vector.
void move_to(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
Moves the pen to the given point without drawing a line.
A base class for all things which can have a name.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
A container for geometry primitives.
const LVecBase3 & get_data3()
Returns the data associated with the read row, expressed as a 3-component value, and advances the rea...
void add_data3(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
Sets the write row to a particular 3-component value, and advances the write row. ...
void set_data4(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat w)
Sets the write row to a particular 4-component value, and advances the write row. ...
void reset()
Removes any lines in progress and resets to the initial empty state.
LColor get_vertex_color(int vertex) const
Returns the color of the nth point or vertex.
LVertex get_vertex(int n) const
Returns the nth point or vertex of the line segment sequence generated by the last call to create()...
void draw_to(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
Draws a line segment from the pen's last position (the last call to move_to or draw_to) to the indica...
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
void set_vertex(int n, const LVertex &vert)
Moves the nth point or vertex of the line segment sequence generated by the last call to create()...
This is the base class for all three-component vectors and points.
This object provides a high-level interface for quickly reading a sequence of numeric values from a v...
Defines a series of line strips.
void set_vertex_color(int vertex, const LColor &c)
Changes the vertex color of the nth point or vertex.
void set_row_unsafe(int row)
Sets the start row to the indicated value, without internal checks.
A node that holds Geom objects, renderable pieces of geometry.
void add_geom(Geom *geom, const RenderState *state=RenderState::make_empty())
Adds a new Geom to the node.
void set_row_unsafe(int row)
Sets the start row to the indicated value, without internal checks.
static const LVecBase4f & zero()
Returns a zero-length vector.