Panda3D
Public Member Functions | Static Public Member Functions

LineSegs Class Reference

Encapsulates creation of a series of connected or disconnected line segments or points, for drawing paths or rays. More...

Inheritance diagram for LineSegs:
Namable

List of all members.

Public Member Functions

 LineSegs (string 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.
 LineSegs ()
 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.
 clearName ()
 Resets the Namable's name to empty.
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 ()
 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().
GeomNode create (GeomNode previous)
 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 (VBase3 const 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.
Point3 const getCurrentPosition ()
 Returns the pen's current position.
string getName ()
int getNumVertices ()
 Returns the total number of line segment and point vertices generated by the last call to create().
Point3 getVertex (int n)
 Returns the nth point or vertex of the line segment sequence generated by the last call to create().
VBase4 getVertexColor (int vertex)
 Returns the color of the nth point or vertex.
list getVertexColors ()
list getVertices ()
bool hasName ()
 Returns true if the Namable has a nonempty name set, false if the name is empty.
bool isEmpty ()
 Returns true if move_to() or draw_to() have not been called since the last reset() or create(), false otherwise.
 moveTo (VBase3 const 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.
 output (ostream out)
 Outputs the Namable.
 reset ()
 Removes any lines in progress and resets to the initial empty state.
 setColor (VBase4 const 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().
 setColor (float r, float g, float b)
 Establishes the color that will be assigned to all vertices created by future calls to move_to() and draw_to().
 setName (string name)
 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 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().
 setVertex (int n, Point3 const vert)
 Moves the nth point or vertex of the line segment sequence generated by the last call to create().
 setVertexColor (int vertex, VBase4 const 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.
 setVertexColor (int vertex, float r, float g, float b)
 Changes the vertex color of the nth point or vertex.

Static Public Member Functions

static TypeHandle getClassType ()

Detailed Description

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.


Constructor & Destructor Documentation

LineSegs ( string  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.

LineSegs ( )

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.


Member Function Documentation

clearName ( ) [inherited]

Resets the Namable's name to empty.

Reimplemented in AsyncTask.

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().

The lines and points are created with the color and thickness established by calls to set_color() and set_thick().

If dynamic is true, the line segments will be created with the dynamic Geom setting, optimizing them for runtime vertex animation.

GeomNode create ( GeomNode  previous)

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_thick().

If dynamic is true, the line segments will be created with the dynamic Geom setting, optimizing them for runtime vertex animation.

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_thick().

If dynamic is true, the line segments will be created with the dynamic Geom setting, optimizing them for runtime vertex animation.

GeomNode create ( )

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_thick().

If dynamic is true, the line segments will be created with the dynamic Geom setting, optimizing them for runtime vertex animation.

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.

drawTo ( VBase3 const  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.

static TypeHandle getClassType ( ) [static, inherited]

Reimplemented in PGItem, PandaNode, PGButton, PGTop, PGEntry, PGMouseWatcherBackground, MouseWatcherRegion, PGVirtualFrame, PGSliderBar, PGScrollFrame, PGWaitBar, ButtonThrower, DataNode, MouseInterfaceNode, DriveInterface, MouseSubregion, MouseWatcher, Trackball, Transform2SG, TextFont, DynamicTextPage, Texture, DynamicTextFont, StaticTextFont, TextNode, ParametricCurve, CubicCurveseg, PiecewiseCurve, HermiteCurve, NurbsCurve, RopeNode, SheetNode, AnimateVerticesRequest, AsyncTask, Material, TextureReloadRequest, VideoTexture, AsyncTaskBase, AsyncTaskChain, AsyncTaskManager, AsyncTaskPause, AsyncTaskSequence, PythonTask, Thread, ExternalThread, MainThread, PythonThread, AnalogNode, ButtonNode, DialNode, MouseAndKeyboard, TrackerNode, VirtualMouse, CollisionNode, CollisionTraverser, CollisionVisualizer, CharacterJoint, MovingPartMatrix, CharacterSlider, MovingPartScalar, Character, PartBundleNode, CharacterJointBundle, PartBundle, AnimGroup, AnimBundle, AnimBundleNode, PartGroup, AnimControl, AnimChannelBase, AnimChannelACMatrixSwitchType, AnimChannelACScalarSwitchType, AnimChannelMatrixDynamic, AnimChannelMatrixXfmTable, AnimChannelScalarDynamic, AnimChannelScalarTable, BindAnimRequest, ModelLoadRequest, MovingPartBase, MovingPartACMatrixSwitchType, MovingPartACScalarSwitchType, FFMpegTexture, FrameRateMeter, SceneGraphAnalyzerMeter, MovieTexture, RigidBodyCombiner, MovieVideo, MovieAudio, InkblotVideo, FfmpegVideo, FfmpegAudio, MicrophoneAudio, UserDataAudio, LensNode, Camera, PlaneNode, GeomNode, Fog, PandaLoader, ModelFlattenRequest, ModelNode, ModelRoot, PolylightNode, PortalNode, UvScrollNode, LightNode, AmbientLight, CallbackNode, LightLensNode, DirectionalLight, LODNode, FadeLODNode, PointLight, SelectiveChildNode, SequenceNode, Spotlight, SwitchNode, and MouseRecorder.

Point3 const getCurrentPosition ( )

Returns the pen's current position.

The next call to draw_to() will draw a line segment from this point.

string getName ( ) [inherited]

Reimplemented in DynamicTextFont.

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().

Point3 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.

VBase4 getVertexColor ( int  vertex)

Returns the color of the nth point or vertex.

list getVertexColors ( )
list getVertices ( )
bool hasName ( ) [inherited]

Returns true if the Namable has a nonempty name set, false if the name is empty.

bool isEmpty ( )

Returns true if move_to() or draw_to() have not been called since the last reset() or create(), false otherwise.

moveTo ( VBase3 const  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.

output ( ostream  out) [inherited]

Outputs the Namable.

This function simply writes the name to the output stream; most Namable derivatives will probably redefine this.

Reimplemented in PandaNode, MouseWatcherRegion, TextNode, AdaptiveLru, SimpleLru, AsyncTask, Material, AsyncTaskChain, AsyncTaskManager, Thread, CollisionTraverser, PartBundle, AnimGroup, AnimControl, PandaLoader, LightNode, and LightLensNode.

reset ( )

Removes any lines in progress and resets to the initial empty state.

setColor ( float  r,
float  g,
float  b 
)

Establishes the color that will be assigned to all vertices created by future calls to move_to() and draw_to().

setColor ( VBase4 const  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().

setName ( string  name) [inherited]

Reimplemented in PGItem, and AsyncTask.

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,
Point3 const  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,
VBase4 const  c 
)

Changes the vertex color of the nth point or vertex.

See set_vertex().

setVertexColor ( int  vertex,
float  r,
float  g,
float  b 
)

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().

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties