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);
145 color.set_row_unsafe(n);
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);
199 vertex.add_data3((*sl)._point);
200 color.add_data4((*sl)._color);
203 points->close_primitive();
207 for (sl = segs.begin(); sl != segs.end(); sl++) {
208 lines->add_vertex(v);
209 vertex.add_data3((*sl)._point);
210 color.add_data4((*sl)._color);
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);
Defines a series of line strips.
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.
Defines a series of disconnected points.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
This object provides a high-level interface for quickly reading a sequence of numeric values from a v...
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
void set_row_unsafe(int row)
Sets the start row to the indicated value, without internal checks.
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.
A container for geometry primitives.
LineSegs(const std::string &name="lines")
Constructs a LineSegs object, which can be used to create any number of disconnected lines or points ...
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...
get_vertex_color
Returns the color of the nth point or vertex.
void reset()
Removes any lines in progress and resets to the initial empty state.
GeomNode * create(bool dynamic=false)
Creates a new GeomNode that will render the series of line segments and points described via calls to...
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().
bool is_empty()
Returns true if move_to() or draw_to() have not been called since the last reset() or create(),...
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().
void move_to(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
Moves the pen to the given point without drawing a line.
const LVertex & get_current_position()
Returns the pen's current position.
A base class for all things which can have a name.
This is the base class for a number of render attributes (other than transform) that may be set on sc...
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
This is our own Panda specialization on the default STL vector.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.