32LineSegs(
const std::string &name) : Namable(name) {
33 _color.set(1.0f, 1.0f, 1.0f, 1.0f);
64 segs.push_back(Point(v, _color));
67 _list.push_back(segs);
84 SegmentList &segs = _list.back();
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()) {
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++) {
193 const SegmentList &segs = (*ll);
195 if (segs.size() < 2) {
197 for (sl = segs.begin(); sl != segs.end(); sl++) {
198 points->add_vertex(v);
200 color.add_data4((*sl)._color);
203 points->close_primitive();
207 for (sl = segs.begin(); sl != segs.end(); sl++) {
208 lines->add_vertex(v);
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);
static ConstPointerTo< RenderAttrib > make_vertex()
Constructs a new ColorAttrib object that indicates geometry should be rendered according to its own v...
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.
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.
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.
This is the base class for a number of render attributes (other than transform) that may be set on sc...
static ConstPointerTo< RenderAttrib > make(Mode mode, PN_stdfloat thickness=1.0f, bool perspective=false, const LColor &wireframe_color=LColor::zero())
Constructs a new RenderModeAttrib object that specifies whether to draw polygons in the normal,...
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
static ConstPointerTo< RenderState > make(const RenderAttrib *attrib, int override=0)
Returns a RenderState with one attribute set.
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.