SPIN Framework
Public Types | Public Member Functions

spin::TextNode Class Reference

Provides 3D text rendered in the scene. More...

#include <TextNode.h>

Inheritance diagram for spin::TextNode:
spin::GroupNode spin::ReferencedNode

List of all members.

Public Types

enum  DrawMode { GLYPH, TEXT3D }
enum  billboardType { RELATIVE, POINT_EYE, STAY_UP }
enum  decorationType {
  DROP_SHADOW_BOTTOM_RIGHT = 0, DROP_SHADOW_CENTER_RIGHT, DROP_SHADOW_TOP_RIGHT, DROP_SHADOW_BOTTOM_CENTER,
  DROP_SHADOW_TOP_CENTER, DROP_SHADOW_BOTTOM_LEFT, DROP_SHADOW_CENTER_LEFT, DROP_SHADOW_TOP_LEFT,
  OUTLINE, NONE
}
enum  backgroundType { NO_BACKGROUND, FILLED, WIREFRAME, ALL }

Public Member Functions

 TextNode (SceneManager *sceneManager, const char *initID)
virtual void callbackUpdate (osg::NodeVisitor *nv)
virtual void setContext (const char *newvalue)
void setDrawMode (DrawMode mode)
int getDrawMode () const
void setText (const char *s)
const char * getText () const
std::string getTextString () const
void setTextValue (const char *s)
void setRepetitions (int repetitions)
int getRepetitions () const
void setFont (const char *s)
const char * getFont () const
void setFontResolution (int resolution)
int getFontResolution () const
void setCharacterSize (float s)
float getCharacterSize () const
void setThickness (float thickness)
float getThickness () const
void setBoxSize (float width, float height)
void setLineSpacing (float spacing)
float getLineSpacing () const
void setAlignment (int alignment)
void setColor (float red, float green, float blue, float alpha)
osg::Vec4 getColor () const
void setBgColor (float red, float green, float blue, float alpha)
osg::Vec4 getBgColor () const
void setMargin (float margin)
float getMargin () const
void setBillboard (billboardType t)
int getBillboard () const
void setDecoration (decorationType t)
int getDecoration () const
void setBackground (backgroundType t)
int getBackround () const
void setSingleSided (int singleSided)
int getSingleSided () const
void setLighting (int lighting)
int getLighting () const
virtual std::vector< lo_message > getState () const

Detailed Description

Provides 3D text rendered in the scene.


Member Enumeration Documentation

The backgroundType specifies the type of rectangle to draw around the text (filled or wireframe). Use setMargin along with this to adjust the appearance of a text box.

Enumerator:
NO_BACKGROUND 

The text box will have no background.

FILLED 

Creates a text box with a filled background.

WIREFRAME 

Creates a wireframe text box.

ALL 

Creates a filled background with visible wireframe.

The billboardType specifies how the text is oriented with respect to the current camera position.

Enumerator:
RELATIVE 

No billboarding.

POINT_EYE 

Set to rotate billboard around a camera's perspective

STAY_UP 

Billboard rotates only on z axis.

The decorationType specifies the type of dropshadow/outline used, which can help the visibility of text on noisy backgrounds of similar color.

Enumerator:
DROP_SHADOW_BOTTOM_RIGHT 

Shadows down and to the right.

DROP_SHADOW_CENTER_RIGHT 

Shadows to the right.

DROP_SHADOW_TOP_RIGHT 

Shadows up and to the right.

DROP_SHADOW_BOTTOM_CENTER 

Shadows below.

DROP_SHADOW_TOP_CENTER 

Shadows upwards.

DROP_SHADOW_BOTTOM_LEFT 

Shadows down and to the left.

DROP_SHADOW_CENTER_LEFT 

Shadows to the left.

DROP_SHADOW_TOP_LEFT 

Shadows up and to the left.

OUTLINE 

Creates an outline of the text.

NONE 

No shadowing or outline.

Enumerator:
GLYPH 

characters are rendered to glyph textures

TEXT3D 

render 3D text with depth


Member Function Documentation

void spin::TextNode::callbackUpdate ( osg::NodeVisitor *  nv) [virtual]

For nodes that require regular programmatic control, there is a callback that is evaluated with every refresh. This function can thus be used for animations, or any other periodic updates.

Note that changes to the scene graph structure (eg, moving/deleting nodes should NOT be done within this callback because traversals stacks will become corrupted. The technique is rather to enable a flag and then do the actual change in the SceneManager::updateGraph() method.

Reimplemented from spin::GroupNode.

std::vector< lo_message > spin::TextNode::getState ( ) const [virtual]

For each subclass of ReferencedNode, we override the getState() method to fill the vector with the correct set of methods for this particular node

Reimplemented from spin::GroupNode.

void spin::TextNode::setAlignment ( int  alignment)

Sets the maximum size of the text box.

void spin::TextNode::setBackground ( backgroundType  t)

Sets a background type for the text box (drawn from the backgroundType enum).

void spin::TextNode::setBgColor ( float  red,
float  green,
float  blue,
float  alpha 
)

Sets the background color for this node.

void spin::TextNode::setBillboard ( billboardType  t)

Sets the type of billboarding asigned to this node (drawn from the enum billboardType).

void spin::TextNode::setBoxSize ( float  width,
float  height 
)

Sets the maximum size of the text box. Values of 0 in either dimension means no maximum, so that the box will stretch to fit the text

void spin::TextNode::setCharacterSize ( float  s)

Sets the size of text characters (in local coordinate system units)

void spin::TextNode::setColor ( float  red,
float  green,
float  blue,
float  alpha 
)

Sets the color for the text associated to this node in RGBA values.

void spin::TextNode::setContext ( const char *  newvalue) [virtual]

A node can 'belong' to a certain host machine, allowing it to be rendered or behave differently than on other machines.

NOTE: the "NULL" string means that it belongs to no specific context.

NOTE: a scene operating in SERVER_MODE will always create the node, so this feature is only really relevant for clients applications.

Reimplemented from spin::ReferencedNode.

void spin::TextNode::setDecoration ( decorationType  t)

Sets the shadowing or outline type for this text node (drawn from the decorationType enum).

void spin::TextNode::setDrawMode ( DrawMode  mode)

Choose whether the text is drawn in 2D glyphs, or as 3D geometry.

void spin::TextNode::setFont ( const char *  s)

Sets the font for the text associated with this node.

void spin::TextNode::setFontResolution ( int  resolution)

Set the font resolution. eg, 128 will produce 128x128 textures

void spin::TextNode::setLighting ( int  lighting)

Specify whether both sides or only one side of the text is rendered. ie, whether the backface is culled or not.

void spin::TextNode::setLineSpacing ( float  spacing)

Sets the line spacing, as a percentage of the character height. The default is 0

void spin::TextNode::setMargin ( float  margin)

Sets the margins for the text associated to this node.

void spin::TextNode::setRepetitions ( int  repetitions)

Set the number of times the text should repeat

void spin::TextNode::setSingleSided ( int  singleSided)

Specify whether both sides or only one side of the text is rendered. ie, whether the backface is culled or not.

void spin::TextNode::setText ( const char *  s)

Accepts user-entered string for the node's text.

void spin::TextNode::setTextValue ( const char *  s) [inline]

Deprecated method (here for backwards compatibility).

void spin::TextNode::setThickness ( float  thickness)

Set the thickness of 3D text


The documentation for this class was generated from the following files: