Node Class Reference

#include <Node.h>

Inheritance diagram for Node:

Interpolator NodeAudioClip NodeBox NodeCollision NodeColor NodeCone NodeCoordinate NodeCylinder NodeCylinderSensor NodeDefBody NodeDefBodyTex NodeDirectionalLight NodeElevationGrid NodeExtrusion NodeFog NodeFontStyle NodeGroup NodeHumanoid NodeImageTexture NodeIndexedFaceSet NodeIndexedLineSet NodeInline NodeJoint NodeLOD NodeMaterial NodeMaterialProperties NodeMovieTexture NodeNavigationInfo NodeNormal NodeParticleBounce NodeParticleColorD NodeParticleSizeD NodeParticleSource NodeParticleVelocityD NodePixelTexture NodePlaneSensor NodePointLight NodePointSet NodeProximitySensor NodeScript NodeSegment NodeShape NodeSite NodeSound NodeSphere NodeSphereSensor NodeSpotLight NodeSwitch NodeText NodeTextureCoordinate NodeTextureTransform NodeTimeSensor NodeTouchSensor NodeTransform NodeViewpoint NodeVisibilitySensor NodeWorldInfo NodeWrkAnimation ProtoNode List of all members.

Public Member Functions

 Node (Scene *scene, Proto *proto)
 Node (const Node &node)
virtual void write (FILE *f, int indent)
ScenegetScene () const
FieldValuegetField (int index) const
virtual void setField (int index, FieldValue *value)
const std::string & getName () const
const std::string toString ()
void setName (const char *name)
void setName (const std::string name)
void ref ()
void unref ()
virtual int getType () const=0
virtual Nodecopy () const=0
int findChild (Node *child, int field) const
bool hasAncestor (Node *node) const
int lookupEventIn (const std::string &name) const
int lookupEventOut (const std::string &name) const
ProtogetProto () const
virtual int getNodeClass () const
void addInput (int eventIn, Node *src, int eventOut)
void addOutput (int eventOut, Node *dst, int eventIn)
void removeInput (int eventIn, Node *src, int eventOut)
void removeOutput (int eventOut, Node *dst, int eventIn)
const SocketListgetInput (int i)
const SocketListgetOutput (int i)
virtual void update ()
void addParent (Node *parent, int field)
void removeParent (Node *parent, int field)
NodegetParent (int index) const
int getParentField (int index) const
int getNumParents () const
int getNumFields () const
int getNumEventIns () const
int getNumEventOuts () const
bool needsDEF () const
bool getFlag (int flag) const
void setFlag (int flag)
void clearFlag (int flag)
virtual void preDraw ()
virtual void transform ()
virtual void transformForHandle (int)
virtual void draw ()
virtual void bind ()
virtual void unbind ()
virtual void drawHandles ()
virtual Vec3f getHandle (int, int *, int *)
virtual void setHandle (int, const Vec3f &)
void drawHandle (const Vec3f &pos)

Protected Member Functions

virtual ~Node ()
void writeFields (FILE *f, int indent)
void writeRoutes (FILE *f, int indent) const

Protected Attributes

Scene_scene
std::string _name
int _refs
int _flags
Proto_proto
SocketList _parents
FieldValue ** _fields
int _numFields
int _numEventIns
int _numEventOuts
SocketList_inputs
SocketList_outputs

Detailed Description

The base class that initialises all the Nodes. It also adds the current Node to the current Scene and initialises the Node fields and their values. In addition it contains all the factory methods that polymorphically are called through the chilren of Node class, such as NodeTransform, NodeGroup etc.


Constructor & Destructor Documentation

Node::Node ( Scene scene,
Proto proto 
)

Node constructor for the current Scene.

Parameters:
scene the handle to the current Scene
proto the handle to the current Proto that corrensponds to this Node, e.g. ProtoLOD for NodeLOD etc. It also gets from its corresponding Proto, the number of fields, of eventIns, eventOuts.

Node::Node ( const Node node  ) 

Initialises the Node in case that this is about a new Proto that doesn't pre-exist as a counterpart to a Proto. e.g. ProtoTransformgroup - NodeTransformGroup.

Node::~Node (  )  [protected, virtual]


Member Function Documentation

void Node::write ( FILE *  f,
int  indent 
) [virtual]

Writes in the specified output the contents of the Node in VRML97 format

Reimplemented in NodeScript.

Scene* Node::getScene (  )  const [inline]

Returns a handle to the current Scene

FieldValue * Node::getField ( int  index  )  const

Returns a FieldValue handle to the specified index Field that is contained in FieldValue * * _field

void Node::setField ( int  index,
FieldValue value 
) [virtual]

Sets the Field at that index with the specified FieldValue value. Special care is taken if the field is SF-MFNode.

Reimplemented in NodeDefBody, NodeDefBodyTex, NodeElevationGrid, NodeHumanoid, NodeImageTexture, NodeIndexedFaceSet, NodeJoint, NodeSegment, NodeSite, NodeTransform, and NodeWrkAnimation.

const std::string& Node::getName (  )  const [inline]

Gets the name of the Node

const string Node::toString (  ) 

Returns a std::string representation of the Node type

void Node::setName ( const char *  name  )  [inline]

Sets the name of the Node

void Node::setName ( const std::string  name  )  [inline]

void Node::ref (  )  [inline]

Increments the reference counter of a Node

void Node::unref (  )  [inline]

Decrements the reference counter of a Node

virtual int Node::getType (  )  const [pure virtual]

Returns the Type of a Node in the Node subclasses(here pure virtual). E.g. for the NodeGroup it returns NODE_GROUP

Implemented in NodeAudioClip, NodeBox, NodeCollision, NodeColor, NodeColorInterpolator, NodeCone, NodeCoordinate, NodeCoordinateInterpolator, NodeCylinder, NodeCylinderSensor, NodeDefBody, NodeDefBodyTex, NodeDirectionalLight, NodeElevationGrid, NodeExtrusion, NodeFog, NodeFontStyle, NodeGroup, NodeHumanoid, NodeImageTexture, NodeIndexedFaceSet, NodeIndexedLineSet, NodeInline, NodeJoint, NodeLOD, NodeMaterial, NodeMaterialProperties, NodeMovieTexture, NodeNavigationInfo, NodeNormal, NodeNormalInterpolator, NodeOrientationInterpolator, NodeParticleBounce, NodeParticleColorD, NodeParticleSizeD, NodeParticleSource, NodeParticleVelocityD, NodePixelTexture, NodePlaneSensor, NodePointLight, NodePointSet, NodePositionInterpolator, NodeProximitySensor, NodeScalarInterpolator, NodeScript, NodeSegment, NodeShape, NodeSite, NodeSound, NodeSphere, NodeSphereSensor, NodeSpotLight, NodeSwitch, NodeText, NodeTextureCoordinate, NodeTextureTransform, NodeTimeSensor, NodeTouchSensor, NodeTransform, NodeViewpoint, NodeVisibilitySensor, NodeWorldInfo, NodeWrkAnimation, and ProtoNode.

virtual Node* Node::copy (  )  const [pure virtual]

Creates a new instance of that Node in the Node subclasses(here pure virtual).

Implemented in NodeAudioClip, NodeBox, NodeCollision, NodeColor, NodeColorInterpolator, NodeCone, NodeCoordinate, NodeCoordinateInterpolator, NodeCylinder, NodeCylinderSensor, NodeDefBody, NodeDefBodyTex, NodeDirectionalLight, NodeElevationGrid, NodeExtrusion, NodeFog, NodeFontStyle, NodeGroup, NodeHumanoid, NodeImageTexture, NodeIndexedFaceSet, NodeIndexedLineSet, NodeInline, NodeJoint, NodeLOD, NodeMaterial, NodeMaterialProperties, NodeMovieTexture, NodeNavigationInfo, NodeNormal, NodeNormalInterpolator, NodeOrientationInterpolator, NodeParticleBounce, NodeParticleColorD, NodeParticleSizeD, NodeParticleSource, NodeParticleVelocityD, NodePixelTexture, NodePlaneSensor, NodePointLight, NodePointSet, NodePositionInterpolator, NodeProximitySensor, NodeScalarInterpolator, NodeScript, NodeSegment, NodeShape, NodeSite, NodeSound, NodeSphere, NodeSphereSensor, NodeSpotLight, NodeSwitch, NodeText, NodeTextureCoordinate, NodeTextureTransform, NodeTimeSensor, NodeTouchSensor, NodeTransform, NodeViewpoint, NodeVisibilitySensor, NodeWorldInfo, NodeWrkAnimation, and ProtoNode.

int Node::findChild ( Node child,
int  field 
) const

Finds if the specified child node exists in the current Node.

Parameters:
child the child Node to look for
field the index in the _fields Fieldvalue* array.
Returns:
'0' if the child node is found as SFNODE OR 'i' if the child node is found as MFNODE, where i is its index OR '-1' otherwise.

bool Node::hasAncestor ( Node node  )  const

Looks if the specified Node is an ancestor in the SocketList.

int Node::lookupEventIn ( const std::string &  name  )  const

Calls Proto::lookupEventIn(name)

int Node::lookupEventOut ( const std::string &  name  )  const

Calls Proto::lookupEventOut(name)

Proto* Node::getProto (  )  const [inline]

Gets a handle to the current Proto.

virtual int Node::getNodeClass (  )  const [inline, virtual]

Returns a NODE_CHILD as a node class (used to validate the scene)

Reimplemented in NodeAudioClip, NodeBox, NodeColor, NodeCone, NodeCoordinate, NodeCylinder, NodeElevationGrid, NodeExtrusion, NodeFontStyle, NodeImageTexture, NodeIndexedFaceSet, NodeIndexedLineSet, NodeMaterial, NodeMaterialProperties, NodeMovieTexture, NodeNormal, NodePixelTexture, NodePointSet, NodeSphere, NodeText, NodeTextureCoordinate, and NodeTextureTransform.

void Node::addInput ( int  eventIn,
Node src,
int  eventOut 
)

Adds an input to the Node's inputs SocketList.

void Node::addOutput ( int  eventOut,
Node dst,
int  eventIn 
)

Adds an output to the Nodes' outputs SocketList.

void Node::removeInput ( int  eventIn,
Node src,
int  eventOut 
)

Finds and removes an input from the Node's inputs SocketList.

void Node::removeOutput ( int  eventOut,
Node dst,
int  eventIn 
)

Finds and removes an output from the Node's outputs SocketList.

const SocketList& Node::getInput ( int  i  )  [inline]

const SocketList& Node::getOutput ( int  i  )  [inline]

void Node::update (  )  [virtual]

To be used by Script to update its fields

Reimplemented in NodeScript.

void Node::addParent ( Node parent,
int  field 
)

Adds a Node parent to the Node's parent SocketList

void Node::removeParent ( Node parent,
int  field 
)

Removes a Node parent from the Node's parent SocketList

Node* Node::getParent ( int  index  )  const [inline]

Gets a Node parent from the Node's parent SocketList

int Node::getParentField ( int  index  )  const [inline]

Gets a field from the Node's parent SocketList

int Node::getNumParents (  )  const [inline]

int Node::getNumFields (  )  const [inline]

int Node::getNumEventIns (  )  const [inline]

int Node::getNumEventOuts (  )  const [inline]

bool Node::needsDEF (  )  const

Used only in the write().

bool Node::getFlag ( int  flag  )  const [inline]

void Node::setFlag ( int  flag  )  [inline]

Sets the node flag to either of the enum flags FNODE_FLAG_SELECTED, NODE_LAG_TOUCHED, NODE_FLAG_COLLAPSED.

void Node::clearFlag ( int  flag  )  [inline]

virtual void Node::preDraw (  )  [inline, virtual]

To be overriden by the subclasses

Reimplemented in NodeFog, NodeGroup, NodeNavigationInfo, NodePointLight, NodeSpotLight, NodeSwitch, NodeTimeSensor, NodeTransform, and NodeViewpoint.

virtual void Node::transform (  )  [inline, virtual]

To be overriden by the subclasses

Reimplemented in NodeTransform.

virtual void Node::transformForHandle ( int   )  [inline, virtual]

To be overriden by the subclasses

Reimplemented in NodeTransform.

virtual void Node::draw (  )  [inline, virtual]

To be overriden by the subclasses

Reimplemented in NodeBox, NodeCollision, NodeCone, NodeCylinder, NodeElevationGrid, NodeGroup, NodeIndexedLineSet, NodeShape, NodeSphere, NodeSwitch, NodeText, and NodeTransform.

virtual void Node::bind (  )  [inline, virtual]

To be overriden by the subclasses

Reimplemented in NodeDirectionalLight, NodeImageTexture, NodeMaterial, NodeMaterialProperties, and NodeTextureTransform.

virtual void Node::unbind (  )  [inline, virtual]

To be overriden by the subclasses

Reimplemented in NodeDirectionalLight, NodeImageTexture, NodeMaterial, NodeMaterialProperties, and NodeTextureTransform.

virtual void Node::drawHandles (  )  [inline, virtual]

To be overriden by the subclasses

Reimplemented in NodeBox, NodeElevationGrid, NodePointLight, and NodeTransform.

virtual Vec3f Node::getHandle ( int  ,
int *  ,
int *   
) [inline, virtual]

To be overriden by the subclasses

Reimplemented in NodeBox, NodeElevationGrid, NodePointLight, and NodeTransform.

virtual void Node::setHandle ( int  ,
const Vec3f  
) [inline, virtual]

To be overriden by the subclasses

Reimplemented in NodeBox, NodeElevationGrid, NodePointLight, and NodeTransform.

void Node::drawHandle ( const Vec3f pos  ) 

To be overriden by the subclasses

void Node::writeFields ( FILE *  f,
int  indent 
) [protected]

Outputs the Fields of the current Node to a file in VRML97 format.

void Node::writeRoutes ( FILE *  f,
int  indent 
) const [protected]

Outputs the Routes of the current Node to a file in VRML97 format.


Member Data Documentation

Scene* Node::_scene [protected]

handle to the current scene

std::string Node::_name [protected]

name of the Node

int Node::_refs [protected]

int Node::_flags [protected]

Proto* Node::_proto [protected]

handle to the current proto

SocketList Node::_parents [protected]

FieldValue* * Node::_fields [protected]

array of FieldValue ptrs objects

int Node::_numFields [protected]

int Node::_numEventIns [protected]

int Node::_numEventOuts [protected]

SocketList* Node::_inputs [protected]

SocketList* Node::_outputs [protected]


Generated on Thu Jan 18 10:06:18 2007 for vhdPLUS by  doxygen 1.5.1-p1