SPIN Framework
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

spin::ShapeNode Class Reference

Node that represents a simple 3D geometry (spheres, boxes, etc). More...

#include <ShapeNode.h>

Inheritance diagram for spin::ShapeNode:
spin::GroupNode spin::ReferencedNode spin::CollisionShape

List of all members.

Public Types

enum  shapeType {
  NONE = 0, SPHERE, BOX, CYLINDER,
  CAPSULE, CONE, PLANE
}
enum  billboardType { RELATIVE, POINT_EYE, STAY_UP }

Public Member Functions

 ShapeNode (SceneManager *sceneManager, const char *initID)
virtual void setContext (const char *newvalue)
void setShape (shapeType t)
void setBillboard (billboardType t)
void setColor (float red, float green, float blue, float alpha)
void setRenderBin (int i)
void setLighting (int i)
void setSingleSided (int singleSided)
int getSingleSided () const
virtual void updateStateSet ()
int getShape () const
int getBillboard () const
osg::Vec4 getColor () const
int getRenderBin () const
int getLighting () const
virtual std::vector< lo_message > getState () const

Public Attributes

shapeType shape
billboardType billboard
osg::Vec4 _color
std::string texturePath
int renderBin
bool lightingEnabled
osg::ref_ptr< osg::Geode > shapeGeode
osgUtil::Optimizer optimizer

Protected Member Functions

virtual void drawShape ()

Protected Attributes

bool singleSided_

Detailed Description

Node that represents a simple 3D geometry (spheres, boxes, etc).

This allows for the creation of simple graphical primitives (osg::Geodes such as spheres, boxes, cylinders, cones, etc.) and provides some higher level functionality, such as applying color and/or textures on the shape, setting billboards, and organizing rendering order.

The shape is attached to "shapeGeode", which in turn, is attached to the "mainTransform" inherited from GroupNode, allowing the shape to be offset from it's parent.


Member Enumeration Documentation

Possible shapes for a ShapeNode.

Each of these types of shape is identified by a unique number. The first of these shape types has number 0, the second is number 1, and so on.

We provide several possible shapes


Member Function Documentation

std::vector< lo_message > spin::ShapeNode::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.

Reimplemented in spin::CollisionShape.

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

Sets the color of this shape node.

Parameters:
redRed channel. Number in the range [0, 1]
greenGreen channel. Number in the range [0, 1]
blueBlue channel. Number in the range [0, 1]
alphaOpacity channel. Number in the range [0, 1]
void spin::ShapeNode::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::ShapeNode::setShape ( shapeType  t)

Sets the shape this ShapeNode should have, identified by its number.

void spin::ShapeNode::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::ShapeNode::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: