Go to the documentation of this file.
33 _color.set(1.0f, 1.0f, 1.0f, 1.0f);
64 segs.push_back(Point(v, _color));
67 _list.push_back(segs);
87 segs.push_back(Point(v, _color));
108 nassertr(_created_data !=
nullptr, LVertex::zero());
110 vertex.set_row_unsafe(n);
111 return vertex.get_data3();
121 nassertv(_created_data !=
nullptr);
132 nassertr(_created_data !=
nullptr, LColor::zero());
134 color.set_row_unsafe(n);
135 return color.get_data4();
143 nassertv(_created_data !=
nullptr);
157 move_to(LVertex(0.0f, 0.0f, 0.0f));
160 return _list.back().back()._point;
174 if (!_list.empty()) {
175 CPT(
RenderAttrib) thick = RenderModeAttrib::make(RenderModeAttrib::M_unchanged, _thick);
176 CPT(
RenderAttrib) vtxcolor = ColorAttrib::make_vertex();
177 CPT(
RenderState) state = RenderState::make(thick, vtxcolor);
181 dynamic ? Geom::UH_dynamic : Geom::UH_static);
189 LineList::const_iterator ll;
190 SegmentList::const_iterator sl;
192 for (ll = _list.begin(); ll != _list.end(); ll++) {
195 if (segs.size() < 2) {
197 for (sl = segs.begin(); sl != segs.end(); sl++) {
198 points->add_vertex(v);
203 points->close_primitive();
207 for (sl = segs.begin(); sl != segs.end(); sl++) {
208 lines->add_vertex(v);
213 lines->close_primitive();
217 if (lines->get_num_vertices() != 0) {
218 PT(
Geom) geom =
new Geom(_created_data);
219 geom->add_primitive(lines);
222 if (points->get_num_vertices() != 0) {
223 PT(
Geom) geom =
new Geom(_created_data);
224 geom->add_primitive(points);
A container for geometry primitives.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 is our own Panda specialization on the default STL vector.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
void reset()
Removes any lines in progress and resets to the initial empty state.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Defines a series of disconnected points.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
This is the base class for a number of render attributes (other than transform) that may be set on sc...
This object provides a high-level interface for quickly reading a sequence of numeric values from a v...
Defines a series of line strips.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A node that holds Geom objects, renderable pieces of geometry.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void move_to(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
Moves the pen to the given point without drawing a line.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_row_unsafe(int row)
Sets the start row to the indicated value, without internal checks.
void set_vertex_color(int vertex, const LColor &c)
Changes the vertex color of the nth point or vertex.
get_vertex
Returns the nth point or vertex of the line segment sequence generated by the last call to create().
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A base class for all things which can have a name.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_vertex_color
Returns the color of the nth point or vertex.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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_geom(Geom *geom, const RenderState *state=RenderState::make_empty())
Adds a new Geom to the node.
bool is_empty()
Returns true if move_to() or draw_to() have not been called since the last reset() or create(),...
LineSegs(const std::string &name="lines")
Constructs a LineSegs object, which can be used to create any number of disconnected lines or points ...
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.
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().