SPIN Framework
Public Member Functions

spin::GeometryNode Class Reference

Node to draw arbitrary polygon. More...

#include <GeometryNode.h>

Inheritance diagram for spin::GeometryNode:
spin::GroupNode spin::ReferencedNode

List of all members.

Public Member Functions

 GeometryNode (SceneManager *sceneManager, const char *initID)
virtual void callbackUpdate (osg::NodeVisitor *nv)
virtual void updateStateSet ()
void setNumVertices (int i)
void setVertex (int index, float x, float y, float z)
void setColor (int index, float red, float green, float blue, float alpha)
void setTexCoord (int index, float x, float y)
void setSingleSided (int singleSided)
int getSingleSided () const
virtual std::vector< lo_message > getState () const

Detailed Description

Node to draw arbitrary polygon.

Allow a low-level specification of a mesh by providing arrays of vertices, colors, and texture coordinates.


Member Function Documentation

void spin::GeometryNode::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::GeometryNode::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::GeometryNode::setColor ( int  index,
float  red,
float  green,
float  blue,
float  alpha 
)

Update the color of one vertex in the geometry, using an index.

void spin::GeometryNode::setNumVertices ( int  i)

Sets the number of vertices that this geometry is supposed to have.

This should be a multiple of 3 if you want to draw using GL_TRIANGLES or amultiple of 4 if you want to draw using GL_QUADS. Anything else will draw using GL_LINES.

If you grow the number of vertices, all new vertices will be created with default values: position of (0,0,0), full white color, and texcoords of (0,0).

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

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

void spin::GeometryNode::setTexCoord ( int  index,
float  x,
float  y 
)

Update the texture coord of one vertex in the geometry, using an index.

void spin::GeometryNode::setVertex ( int  index,
float  x,
float  y,
float  z 
)

Update the position of one vertex in the geometry, using an index.

void spin::GeometryNode::updateStateSet ( ) [virtual]

This method actually applies the stateset to the subgraph, replacing any existing stateset with this one. The setStateSet and setStateSetFromFile methods just set the stateset_ symbol, while updateStateSet does the actual work.

Override this method in subclasses in order to change how stateset should be applied. For example, to which node in the subgraph it should be attached, or whether it should be merged with the existing stateset (rather than merged).

By default it is applied to the mainTransform_.

Reimplemented from spin::GroupNode.


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