osg.Node¶
-
class
osg.Node¶ Represents: c++ class Wraps: osg::Node Bases: osg.ObjectBase class for all internal nodes in the scene graph. Provides interface for most common node operations (Composite Pattern).
-- Пример создания группы local root = osg.Group() -- Создает новый экземпляр группы узлов local group = osg.Group() -- Создает новый экземпляр группы узлов root:addChild(group) -- Добавляет группу group в группу root
Constructors:
-
osg.Node()¶ Construct a node.
Methods:
-
:
asGeometry()¶ Convert ‘this’ into a Geometry if
osg.Nodeis aosg.Geometry, otherwise return nil.Return type: osg.Geometry
-
:
asGroup()¶ Convert ‘this’ into a Group if
osg.Nodeis aosg.Group, otherwise return nil.Return type: osg.Group
-
:
asTransform()¶ Convert ‘this’ into a Transform if
osg.Nodeis aosg.Transform, otherwise return nil.Return type: osg.Transform
-
:
asSwitch()¶ Convert ‘this’ into a Switch if
osg.Nodeis aosg.Switch, otherwise return nil.Return type: osg.Switch
-
:
asGeode()¶ Convert ‘this’ into a Geode if
osg.Nodeis aosg.Geode, otherwise return nil.Return type: osg.Geode
-
:
accept(osg.NodeVisitor nv)¶ Visitor Pattern : calls the apply method of a
osg.NodeVisitorwith this node’s type.Parameters: nv ( osg.NodeVisitor) – NodeVisitor
-
:
ascend(osg.NodeVisitor nv)¶ Traverse upwards : calls parents’ accept method with
osg.NodeVisitor.Parameters: nv ( osg.NodeVisitor) – NodeVisitor
-
:
traverse(osg.NodeVisitor nv)¶ Traverse downwards : calls children’s accept method with
osg.NodeVisitor.Parameters: nv ( osg.NodeVisitor) – NodeVisitor
-
:
getParent(unsigned i)¶ Get a single parent of node by index. Return nil if bad index specified.
Parameters: i ( unsigned) – Index of a parentReturn type: osg.Group
-
:
getNumParents()¶ Get the number of parents of node.
Return type: unsigned
-
:
getParentalNodePaths(osg.Node haltTraversalAtNode)¶ Get the list of node paths parent paths.
Parameters: haltTraversalAtNode ( osg.Node) – Allows the user to prevent traversal beyond a specified node.Return type: osg.NodePathList
-
:
getParentalNodePaths() Get the list of node paths parent paths.
Return type: osg.NodePathList
-
:
getWorldMatrices()¶ Get the list of matrices that transform this node from local coordinates to world coordinates.
Return type: osg.MatrixList
-
:
setUpdateCallback(osg.Callback nc)¶ Set update node callback, called during update traversal.
Parameters: nc ( osg.Callback) – Update callback that must be set.
-
:
addUpdateCallback(osg.Callback nc)¶ Convenience method that sets the update callback of the node if it doesn’t exist, or nest it into the existing one.
Parameters: nc ( osg.Callback) – Update callback that must be added.
-
:
getUpdateCallback()¶ Get update node callback, called during update traversal.
Return type: osg.Callback
-
:
removeUpdateCallback(osg.Callback nc)¶ Convenience method that removes a given callback from a node, even if that callback is nested. There is no error return in case the given callback is not found.
Parameters: nc ( osg.Callback) – Update callback that must be removed.
-
:
setEventCallback(osg.Callback nc)¶ Set event node callback, called during event traversal.
Parameters: nc ( osg.Callback) – Event callback that must be set.
-
:
addEventCallback(osg.Callback nc)¶ Convenience method that sets the event callback of the node if it doesn’t exist, or nest it into the existing one.
Parameters: nc ( osg.Callback) – Event callback that must be added.
-
:
getEventCallback()¶ Get event node callback, called during event traversal.
Return type: osg.Callback
-
:
removeEventCallback(osg.Callback nc)¶ Convenience method that removes a given callback from a node, even if that callback is nested. There is no error return in case the given callback is not found.
Parameters: nc ( osg.Callback) – Event callback that must be removed.
-
:
setCullCallback(osg.Callback nc)¶ Set cull node callback, called during cull traversal.
Parameters: nc ( osg.Callback) – Cull callback that must be set.
-
:
addCullCallback(osg.Callback nc)¶ Convenience method that sets the cull callback of the node if it doesn’t exist, or nest it into the existing one.
Parameters: nc ( osg.Callback) – Cull callback that must be added.
-
:
getCullCallback()¶ Get cull node callback, called during cull traversal.
Return type: osg.Callback
-
:
removeCullCallback(osg.Callback nc)¶ Convenience method that removes a given callback from a node, even if that callback is nested. There is no error return in case the given callback is not found.
Parameters: nc ( osg.Callback) – Cull callback that must be removed.
-
:
setNodeMask(unsigned mask)¶ Set the node Mask.
Parameters: mask ( unsigned) – Node mask (0xffffffff etc.)
-
:
getNodeMask()¶ Get the node mask.
Return type: unsigned
-
:
setStateSet(osg.StateSet ss)¶ Set the node’s
osg.StateSetParameters: ss ( osg.StateSet) – StateSet (nil is possible).
-
:
getOrCreateStateSet()¶ Return the node’s StateSet, if one does not already exist create it set the node and return the newly created StateSet. This ensures that a valid StateSet is always returned and can be used directly.
Return type: osg.StateSet
-
:
getStateSet()¶ Return the node’s StateSet if exists, otherwise return nil.
Return type: osg.StateSet
-
:
removeStateSet()¶ Alias to
osg.Node.setStateSet()with nil argument.
-
:
getDescription(unsigned i)¶ Get description string by index. Return nil if bad index specified.
Parameters: i ( unsigned) – Index of the description.Return type: std.string
-
:
getNumDescriptions()¶ Return the number of descriptions.
Return type: unsigned
-
:
addDescription(std.string desc)¶ Add a description string to the node.
Parameters: desc ( std.string) – Description string.
-
:
setInitialBound(osg.BoundingSphere bs)¶ Set the initial bounding volume to use when computing the overall bounding volume.
Parameters: bs ( osg.BoundingSphere) – Bounding volume of the node.
-
:
getInitialBound()¶ Set the initial bounding volume to use when computing the overall bounding volume.
Return type: osg.BoundingSphere
-
:
dirtyBound()¶ Mark this node’s bounding sphere dirty. Forcing it to be computed on the next call to
osg.Node.getBound().
-
:
getBound()¶ Get bounding volume of the node.
Return type: osg.BoundingSphere
-
:
computeBound()¶ Compute the bounding sphere around Node’s geometry or children. This method is automatically called by
osg.Node.getBound()when the bounding sphere has been marked dirty viaosg.Node.dirtyBound().Return type: osg.BoundingSphere
-
:
getCullingActive()¶ Return true if this node can be culled by view frustum, occlusion or small feature culling during the cull traversal. Note, returns true only if no children have culling disabled, and the local _cullingActive flag is true.
Return type: bool
-
:
setCullingActive(bool active)¶ Set the view frustum/small feature culling of this node to be active or inactive. The default value is true for _cullingActive. Used as a guide to the cull traversal.
Parameters: active ( bool) – Must be true to activate culling, otherwise must be set to false.
-
:
hide()¶ Alias to
osg.Node.setNodeMask()with 0x0 (black) mask.
-
:
show()¶ Alias to
osg.Node.setNodeMask()with ~0x0 (white) mask.
-
:
isVisible()¶ Return true if
osg.Node.getNodeMask()is ~0x0 (white), false otherwise.Return type: bool
-