H3D API
2.4.1
|
Node is the base class for all classes that can be part of the H3D scene-graph. More...
#include <H3D/Node.h>
Classes | |
struct | LineIntersectResult |
Used as input to lineIntersect functions. More... | |
struct | NodeIntersectResult |
Used as input to intersection functions. More... | |
Public Types | |
typedef std::map< Node *, Node * > | DeepCopyMap |
A map type used during a deep copy clone() to map from original nodes to cloned nodes. | |
Public Member Functions | |
Node () | |
Constructor. | |
virtual Node * | clone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL) |
Returns a new instance of this node type with the same state as this one. More... | |
virtual | ~Node () |
Destructor. | |
X3DPrototypeInstance * | getProtoInstanceParent () |
If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More... | |
void | setProtoInstanceParent (X3DPrototypeInstance *p) |
Set the X3DPrototypeInstance this node is the the root node if applicaple. | |
virtual void | render () |
the render() function is used for the depth-first rendering traversal of the scene-graph. More... | |
virtual void | traverseSG (TraverseInfo &ti) |
traverseSG is called once per scenegraph loop on the scene in order to traverse the scenegraph. More... | |
virtual bool | lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result) |
Detect intersection between a line segment and the Node. More... | |
virtual void | closestPoint (const Vec3f &p, NodeIntersectResult &result) |
Find closest point on Node to p. More... | |
virtual bool | movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result) |
Detect collision between a moving sphere and the Node. More... | |
virtual string | defaultXMLContainerField () |
Returns the default xml containerField attribute value. More... | |
virtual Field * | getField (const string &_name) const |
return a pointer to the field specified by name within this instance | |
int | addDestructCallback (void(*func)(Node *, void *), void *args) |
Add a callback function to be run on destruction of node. More... | |
int | removeDestructCallback (void(*func)(Node *, void *), void *args) |
Add a callback function to be run on destruction of node. More... | |
Static Public Member Functions | |
static unsigned int | nrNodesAlive () |
Returns the nr of nodes currently alive, i.e. nodes created but not destructed. | |
static int | nrNodesCreated () |
Returns the number of nodes created in total since the start of the program. | |
Protected Member Functions | |
void | cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for the clone() method. More... | |
Static Protected Member Functions | |
static Node * | getClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for nodes that implement clone() More... | |
int Node::addDestructCallback | ( | void(*)(Node *, void *) | func, |
void * | args | ||
) |
Add a callback function to be run on destruction of node.
Returns 0 on success.
Referenced by H3D::H3DScriptNode::addNamedNode().
|
virtual |
Returns a new instance of this node type with the same state as this one.
The default implementation copies the node's registered field values of access type INPUT_OUTPUT and INITIALIZE_ONLY.
deepCopy | If true then references to other nodes will also be cloned. Otherwise just the pointer is copied. |
deepCopyMap | A map from original nodes to their cloned versions. This parameter is normally not required by the root caller, but is passed down the call graph to ensure that nodes that appear multiple times will be assigned the same clone. |
Reimplemented in H3D::PrototypeInstance, H3D::PixelTexture, and H3D::Pixel3DTexture.
References H3D::H3DNodeDatabase::createNode(), H3D::H3DDynamicFieldsObject::endField(), H3D::H3DDynamicFieldsObject::firstField(), H3D::X3DUrlObject::getURLBase(), H3D::H3DNodeDatabase::lookupTypeId(), and H3D::X3DUrlObject::setURLBase().
Referenced by H3D::Pixel3DTexture::clone(), H3D::PixelTexture::clone(), H3D::PyNode::clone(), and getClonedInstance().
|
protected |
A helper function for the clone() method.
Recursively clone a single field value
References H3D::Field::getAccessType(), getClonedInstance(), H3D::Field::INITIALIZE_ONLY, H3D::Field::INPUT_OUTPUT, H3DUtil::AutoRefVector< class >::set(), and H3DUtil::AutoRefVector< class >::size().
|
virtual |
Find closest point on Node to p.
p | The point to find the closest point to. |
result | A struct containing various results of closest points such as which geometries the closest points where detected on. |
Reimplemented in H3D::X3DShapeNode, H3D::X3DPrototypeInstance, H3D::X3DGroupingNode, H3D::X3DGeometryNode, H3D::ToggleGroup, H3D::Switch, H3D::Sphere, H3D::PlanarReflector, H3D::MatrixTransform, H3D::LOD, H3D::Inline, H3D::HumanHand, H3D::HAnimHumanoid, H3D::GeometryGroup, and H3D::Collision.
Referenced by H3D::Collision::closestPoint(), H3D::LOD::closestPoint(), H3D::Switch::closestPoint(), and H3D::PyNode::closestPoint().
|
inlinevirtual |
Returns the default xml containerField attribute value.
For this node it is "children".
Reimplemented in H3D::X3DVertexAttributeNode, H3D::X3DTextureTransformNode, H3D::X3DTextureNode, H3D::X3DTextureCoordinateNode, H3D::X3DSoundSourceNode, H3D::X3DShaderNode, H3D::X3DPrototypeInstance, H3D::X3DParticlePhysicsModelNode, H3D::X3DParticleEmitterNode, H3D::X3DNormalNode, H3D::X3DMaterialNode, H3D::X3DGeometryNode, H3D::X3DFontStyleNode, H3D::X3DCoordinateNode, H3D::X3DColorNode, H3D::X3DAppearanceNode, H3D::TextureProperties, H3D::ShaderProgram, H3D::ShaderPart, H3D::ShaderConstants, H3D::RenderProperties, H3D::NurbsTextureCoordinate, H3D::MetadataString, H3D::MetadataSet, H3D::MetadataInteger, H3D::MetadataFloat, H3D::MetadataDouble, H3D::LineProperties, H3D::H3DVideoClipDecoderNode, H3D::H3DSurfaceNode, H3D::H3DShadowObjectNode, H3D::H3DOptionNode, H3D::H3DImageLoaderNode, H3D::H3DHapticsRendererNode, H3D::H3DHapticsDevice, H3D::H3DFunctionNode, H3D::H3DCoordinateDeformerNode, H3D::FogCoordinate, and H3D::FillProperties.
Referenced by H3D::X3DPrototypeInstance::defaultXMLContainerField().
|
staticprotected |
A helper function for nodes that implement clone()
Given an original node, the clone is returned.
For shallow copy the original is returned. For deep copy, if the original already in deepCopyMap that clone is returned, otherwise a new clone is created, added to the map and returned
If original is NULL then NULL is returned.
References clone().
Referenced by H3D::PrototypeInstance::clone(), and cloneFieldValue().
|
inline |
If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node.
IF not it returns NULL.
|
virtual |
Detect intersection between a line segment and the Node.
from | The start of the line segment. |
to | The end of the line segment. |
result | Contains info about the closest intersection for every object that intersects the line. |
Reimplemented in H3D::X3DShapeNode, H3D::X3DPrototypeInstance, H3D::X3DGroupingNode, H3D::X3DGeometryNode, H3D::ToggleGroup, H3D::Text, H3D::Switch, H3D::Sphere, H3D::PlanarReflector, H3D::MatrixTransform, H3D::LOD, H3D::Inline, H3D::HumanHand, H3D::HAnimHumanoid, H3D::GeometryGroup, and H3D::Collision.
Referenced by H3D::H3DNavigation::doNavigation(), H3D::Collision::lineIntersect(), H3D::LOD::lineIntersect(), H3D::Switch::lineIntersect(), H3D::PyNode::lineIntersect(), and H3D::X3DPointingDeviceSensorNode::updateX3DPointingDeviceSensors().
|
virtual |
Detect collision between a moving sphere and the Node.
Only nodes to which collision is possible will return true
radius | The radius of the sphere |
from | The start position of the sphere |
to | The end position of the sphere. |
result | A struct containing various results of intersections such as which geometries intersected the moving sphere. |
Reimplemented in H3D::X3DShapeNode, H3D::X3DPrototypeInstance, H3D::X3DGroupingNode, H3D::X3DGeometryNode, H3D::ToggleGroup, H3D::Switch, H3D::Sphere, H3D::PointSet, H3D::PlanarReflector, H3D::MatrixTransform, H3D::LOD, H3D::Inline, H3D::IndexedLineSet, H3D::HumanHand, H3D::HAnimHumanoid, H3D::GeometryGroup, and H3D::Collision.
Referenced by H3D::X3DViewpointNode::detectCollision(), H3D::Collision::movingSphereIntersect(), H3D::LOD::movingSphereIntersect(), H3D::Switch::movingSphereIntersect(), and H3D::X3DViewpointNode::translate().
int Node::removeDestructCallback | ( | void(*)(Node *, void *) | func, |
void * | args | ||
) |
Add a callback function to be run on destruction of node.
Returns 0 on success, -1 if the callback does not exist.
|
inlinevirtual |
the render() function is used for the depth-first rendering traversal of the scene-graph.
Reimplemented in H3D::X3DTexture3DNode, H3D::X3DTexture2DNode, H3D::X3DShapeNode, H3D::X3DPrototypeInstance, H3D::X3DNurbsSurfaceGeometryNode, H3D::X3DGroupingNode, H3D::X3DBackgroundNode, H3D::TwoSidedMaterial, H3D::TriangleStripSet, H3D::TriangleSet2D, H3D::TriangleSet, H3D::TriangleFanSet, H3D::TransformInfo, H3D::Transform, H3D::ToggleGroup, H3D::TextureTransform3D, H3D::TextureTransform, H3D::TextureMatrixTransform, H3D::TextureBackground, H3D::Text, H3D::TexGenGeometry, H3D::Switch, H3D::SuperShape, H3D::Sphere, H3D::ShadowCaster, H3D::ShaderStorageBuffer, H3D::ShaderProgram, H3D::ShaderImage3D, H3D::ShaderImage2D, H3D::ShaderAtomicCounter, H3D::RenderTargetTexture, H3D::RenderTargetSelectGroup, H3D::RenderProperties, H3D::Rectangle2D, H3D::ProgramShader, H3D::Polypoint2D, H3D::Polyline2D, H3D::PointSet, H3D::ParticleSystem, H3D::PackagedShader, H3D::NurbsCurve, H3D::MultiTextureTransform, H3D::MultiTexture, H3D::MatrixTransform, H3D::Material, H3D::LOD, H3D::LineSet, H3D::LineProperties, H3D::Inline, H3D::IndexedTriangleStripSet, H3D::IndexedTriangleSet, H3D::IndexedTriangleFanSet, H3D::IndexedLineSet, H3D::IndexedFaceSet, H3D::ImageTexture, H3D::Image3DTexture, H3D::HumanHand, H3D::HAnimHumanoid, H3D::H3DVideoTextureNode, H3D::H3DRenderModeGroupNode, H3D::GeometryGroup, H3D::GeneratedTexture3D, H3D::GeneratedTexture, H3D::GeneratedCubeMapTexture, H3D::FullscreenRectangle, H3D::FrameBufferTextureGenerator, H3D::FillProperties, H3D::FBODebugger, H3D::Extrusion, H3D::ElevationGrid, H3D::Disk2D, H3D::Cylinder, H3D::Cone, H3D::ComposedShader, H3D::ComposedCubeMapTexture, H3D::Circle2D, H3D::Capsule, H3D::Box, H3D::Background, H3D::ArcClose2D, H3D::Arc2D, and H3D::Appearance.
Referenced by H3D::H3DWindowNode::display(), H3D::Appearance::render(), H3D::Capsule::render(), H3D::Cone::render(), H3D::Cylinder::render(), H3D::ElevationGrid::render(), H3D::Extrusion::render(), H3D::HAnimHumanoid::render(), H3D::Material::render(), H3D::ParticleSystem::render(), H3D::ShadowCaster::render(), H3D::SuperShape::render(), H3D::Switch::render(), H3D::TwoSidedMaterial::render(), H3D::X3DShapeNode::render(), H3D::X3DTextureTransformNode::renderForTextureUnit(), H3D::PlanarReflector::renderPostViewpoint(), H3D::H3DHapticsDevice::renderStylus(), H3D::H3DDisplayListObject::DisplayList::update(), and H3D::GeneratedCubeMapTexture::updateCubeMap().
|
virtual |
traverseSG is called once per scenegraph loop on the scene in order to traverse the scenegraph.
During this traversal things can be updated in the node and HapticObject instances to be rendered should be added to the TraverseInfo object.
ti | The TraverseInfo object containing information about the traversal. |
Reimplemented in H3D::X3DViewpointNode, H3D::X3DShapeNode, H3D::X3DPrototypeInstance, H3D::X3DNurbsSurfaceGeometryNode, H3D::X3DLightNode, H3D::X3DGroupingNode, H3D::X3DGeometryNode, H3D::X3DBackgroundNode, H3D::X3DAppearanceNode, H3D::WindPhysicsModel, H3D::VisibilitySensor, H3D::ViscosityEffect, H3D::ViewpointGroup, H3D::TriangleStripSet, H3D::TriangleSet2D, H3D::TriangleSet, H3D::TriangleFanSet, H3D::TransformInfo, H3D::ToggleGroup, H3D::TimeFunctionEffect, H3D::Text, H3D::TexGenGeometry, H3D::Switch, H3D::SuperShape, H3D::SpringEffect, H3D::Sphere, H3D::Sound, H3D::ShadowCaster, H3D::ShaderCombiner, H3D::ShaderAtomicCounter, H3D::Script, H3D::RotationalSpringEffect, H3D::Rectangle2D, H3D::RazerHydraSensor, H3D::PythonScript, H3D::ProximitySensor, H3D::PositionFunctionEffect, H3D::PointLight, H3D::PlanarReflector, H3D::PhongShader, H3D::ParticleSystem, H3D::MultiRenderTargetShader, H3D::MFNodeSplitter, H3D::MatrixTransform, H3D::MagneticGeometryEffect, H3D::LOD, H3D::LoadSensor, H3D::LineSet, H3D::Inline, H3D::IndexedTriangleStripSet, H3D::IndexedTriangleSet, H3D::IndexedTriangleFanSet, H3D::IndexedFaceSet, H3D::HumanHand, H3D::HapticLayeredGroup, H3D::HAnimSegment, H3D::HAnimJoint, H3D::HAnimHumanoid, H3D::H3DVideoTextureNode, H3D::H3DRenderModeGroupNode, H3D::GeometryGroup, H3D::GeneratedCubeMapTexture, H3D::FrameBufferTextureGenerator, H3D::ForceField, H3D::Fog, H3D::FBODebugger, H3D::Extrusion, H3D::ElevationGrid, H3D::Disk2D, H3D::DirectionalLight, H3D::DeviceLog, H3D::DeformableShape, H3D::Cylinder, H3D::ConvolutionFilterShader, H3D::Cone, H3D::ComposedShader, H3D::ComposedGeneratedShader, H3D::Capsule, H3D::Box, H3D::Billboard, H3D::ArcClose2D, and H3D::Appearance.
Referenced by H3D::Scene::idle(), H3D::Appearance::traverseSG(), H3D::ComposedShader::traverseSG(), H3D::GeneratedCubeMapTexture::traverseSG(), H3D::H3DVideoTextureNode::traverseSG(), H3D::HAnimHumanoid::traverseSG(), H3D::HAnimJoint::traverseSG(), H3D::LoadSensor::traverseSG(), H3D::MFNodeSplitter::traverseSG(), H3D::ParticleSystem::traverseSG(), H3D::PlanarReflector::traverseSG(), H3D::RazerHydraSensor::traverseSG(), H3D::Sound::traverseSG(), H3D::Switch::traverseSG(), H3D::TransformInfo::traverseSG(), H3D::WindPhysicsModel::traverseSG(), H3D::X3DBackgroundNode::traverseSG(), and H3D::X3DShapeNode::traverseSG().