Panda3D
|
Encapsulates creation of a series of connected or disconnected line segments or points, for drawing paths or rays. More...
#include <pandadoc.hpp>
Public Member Functions | |
__init__ (const LineSegs) | |
__init__ (str name) | |
Constructs a LineSegs object, which can be used to create any number of disconnected lines or points of various thicknesses and colors through the visible scene. | |
GeomNode | create (bool dynamic) |
Creates a new GeomNode that will render the series of line segments and points described via calls to move_to() and draw_to(). | |
GeomNode | create (GeomNode previous, bool dynamic) |
Appends to an existing GeomNode a new Geom that will render the series of line segments and points described via calls to move_to() and draw_to(). | |
drawTo (const LVecBase3 v) | |
Draws a line segment from the pen's last position (the last call to move_to or draw_to) to the indicated point. | |
drawTo (float x, float y, float z) | |
Draws a line segment from the pen's last position (the last call to move_to or draw_to) to the indicated point. | |
const LVertex | getCurrentPosition () |
Returns the pen's current position. | |
int | getNumVertices () |
Returns the total number of line segment and point vertices generated by the last call to create(). | |
LVertex | getVertex (int n) |
Returns the nth point or vertex of the line segment sequence generated by the last call to create(). | |
LColor | getVertexColor (int vertex) |
Returns the color of the nth point or vertex. | |
list | getVertexColors () |
list | getVertices () |
bool | isEmpty () |
Returns true if move_to() or draw_to() have not been called since the last reset() or create(), false otherwise. | |
moveTo (const LVecBase3 v) | |
Moves the pen to the given point without drawing a line. | |
moveTo (float x, float y, float z) | |
Moves the pen to the given point without drawing a line. | |
reset () | |
Removes any lines in progress and resets to the initial empty state. | |
setColor (const LColor color) | |
Establishes the color that will be assigned to all vertices created by future calls to move_to() and draw_to(). | |
setColor (float r, float g, float b, float a) | |
Establishes the color that will be assigned to all vertices created by future calls to move_to() and draw_to(). | |
setThickness (float thick) | |
Establishes the line thickness or point size in pixels that will be assigned to all lines and points created by future calls to create(). | |
setVertex (int n, const LVertex vert) | |
Moves the nth point or vertex of the line segment sequence generated by the last call to create(). | |
setVertex (int vertex, float x, float y, float z) | |
Moves the nth point or vertex of the line segment sequence generated by the last call to create(). | |
setVertexColor (int vertex, const LColor c) | |
Changes the vertex color of the nth point or vertex. | |
setVertexColor (int vertex, float r, float g, float b, float a) | |
Changes the vertex color of the nth point or vertex. | |
![]() | |
__init__ (const Namable) | |
__init__ (str initial_name) | |
clearName () | |
Resets the Namable's name to empty. | |
str | getName () |
bool | hasName () |
Returns true if the Namable has a nonempty name set, false if the name is empty. | |
output (Ostream out) | |
Outputs the Namable. | |
setName (str name) | |
Additional Inherited Members | |
![]() | |
static TypeHandle | getClassType () |
![]() | |
const String | name |
Encapsulates creation of a series of connected or disconnected line segments or points, for drawing paths or rays.
This class doesn't attempt to be the smartest it could possibly be; it's intended primarily as a visualization and editing tool.
__init__ | ( | const LineSegs | ) |
__init__ | ( | str | name | ) |
Constructs a LineSegs object, which can be used to create any number of disconnected lines or points of various thicknesses and colors through the visible scene.
After creating the object, call move_to() and draw_to() repeatedly to describe the path, then call create() to create a GeomNode which will render the described path.
GeomNode create | ( | bool | dynamic | ) |
Creates a new GeomNode that will render the series of line segments and points described via calls to move_to() and draw_to().
The lines and points are created with the color and thickness established by calls to set_color() and set_thickness().
If dynamic is true, the line segments will be created with the dynamic Geom setting, optimizing them for runtime vertex animation.
Appends to an existing GeomNode a new Geom that will render the series of line segments and points described via calls to move_to() and draw_to().
The lines and points are created with the color and thickness established by calls to set_color() and set_thickness().
If dynamic is true, the line segments will be created with the dynamic Geom setting, optimizing them for runtime vertex animation.
drawTo | ( | const LVecBase3 | v | ) |
Draws a line segment from the pen's last position (the last call to move_to or draw_to) to the indicated point.
move_to() and draw_to() only update tables; the actual drawing is performed when create() is called.
drawTo | ( | float | x, |
float | y, | ||
float | z ) |
Draws a line segment from the pen's last position (the last call to move_to or draw_to) to the indicated point.
move_to() and draw_to() only update tables; the actual drawing is performed when create() is called.
const LVertex getCurrentPosition | ( | ) |
Returns the pen's current position.
The next call to draw_to() will draw a line segment from this point.
int getNumVertices | ( | ) |
Returns the total number of line segment and point vertices generated by the last call to create().
The positions of these vertices may be read and adjusted through get_vertex() and set_vertex().
LVertex getVertex | ( | int | n | ) |
Returns the nth point or vertex of the line segment sequence generated by the last call to create().
The first move_to() generates vertex 0; subsequent move_to() and draw_to() calls generate consecutively higher vertex numbers.
LColor getVertexColor | ( | int | vertex | ) |
Returns the color of the nth point or vertex.
list getVertexColors | ( | ) |
list getVertices | ( | ) |
bool isEmpty | ( | ) |
moveTo | ( | const LVecBase3 | v | ) |
Moves the pen to the given point without drawing a line.
When followed by draw_to(), this marks the first point of a line segment; when followed by move_to() or create(), this creates a single point.
moveTo | ( | float | x, |
float | y, | ||
float | z ) |
Moves the pen to the given point without drawing a line.
When followed by draw_to(), this marks the first point of a line segment; when followed by move_to() or create(), this creates a single point.
reset | ( | ) |
Removes any lines in progress and resets to the initial empty state.
setColor | ( | const LColor | color | ) |
Establishes the color that will be assigned to all vertices created by future calls to move_to() and draw_to().
setColor | ( | float | r, |
float | g, | ||
float | b, | ||
float | a ) |
Establishes the color that will be assigned to all vertices created by future calls to move_to() and draw_to().
setThickness | ( | float | thick | ) |
Establishes the line thickness or point size in pixels that will be assigned to all lines and points created by future calls to create().
setVertex | ( | int | n, |
const LVertex | vert ) |
Moves the nth point or vertex of the line segment sequence generated by the last call to create().
The first move_to() generates vertex 0; subsequent move_to() and draw_to() calls generate consecutively higher vertex numbers.
setVertex | ( | int | vertex, |
float | x, | ||
float | y, | ||
float | z ) |
Moves the nth point or vertex of the line segment sequence generated by the last call to create().
The first move_to() generates vertex 0; subsequent move_to() and draw_to() calls generate consecutively higher vertex numbers.
setVertexColor | ( | int | vertex, |
const LColor | c ) |
Changes the vertex color of the nth point or vertex.
See set_vertex().
setVertexColor | ( | int | vertex, |
float | r, | ||
float | g, | ||
float | b, | ||
float | a ) |
Changes the vertex color of the nth point or vertex.
See set_vertex().