osg.Node

class osg.Node
Represents

c++ class

Wraps

osg::Node

Bases

osg.Object

Base 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.Node is a osg.Geometry, otherwise return nil.

Тип результата

osg.Geometry

:asGroup()

Convert „this“ into a Group if osg.Node is a osg.Group, otherwise return nil.

Тип результата

osg.Group

:asTransform()

Convert „this“ into a Transform if osg.Node is a osg.Transform, otherwise return nil.

Тип результата

osg.Transform

:asSwitch()

Convert „this“ into a Switch if osg.Node is a osg.Switch, otherwise return nil.

Тип результата

osg.Switch

:asGeode()

Convert „this“ into a Geode if osg.Node is a osg.Geode, otherwise return nil.

Тип результата

osg.Geode

:accept(osg.NodeVisitor nv)

Visitor Pattern : calls the apply method of a osg.NodeVisitor with this node’s type.

Параметры

nv (osg.NodeVisitor) – NodeVisitor

:ascend(osg.NodeVisitor nv)

Traverse upwards : calls parents“ accept method with osg.NodeVisitor.

Параметры

nv (osg.NodeVisitor) – NodeVisitor

:traverse(osg.NodeVisitor nv)

Traverse downwards : calls children’s accept method with osg.NodeVisitor.

Параметры

nv (osg.NodeVisitor) – NodeVisitor

:getParent(unsigned i)

Get a single parent of node by index. Return nil if bad index specified.

Параметры

i (unsigned) – Index of a parent

Тип результата

osg.Group

:getNumParents()

Get the number of parents of node.

Тип результата

unsigned

:getParentalNodePaths(osg.Node haltTraversalAtNode)

Get the list of node paths parent paths.

Параметры

haltTraversalAtNode (osg.Node) – Allows the user to prevent traversal beyond a specified node.

Тип результата

osg.NodePathList

:getParentalNodePaths()

Get the list of node paths parent paths.

Тип результата

osg.NodePathList

:getWorldMatrices()

Get the list of matrices that transform this node from local coordinates to world coordinates.

Тип результата

osg.MatrixList

:setUpdateCallback(osg.Callback nc)

Set update node callback, called during update traversal.

Параметры

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.

Параметры

nc (osg.Callback) – Update callback that must be added.

:getUpdateCallback()

Get update node callback, called during update traversal.

Тип результата

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.

Параметры

nc (osg.Callback) – Update callback that must be removed.

:setEventCallback(osg.Callback nc)

Set event node callback, called during event traversal.

Параметры

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.

Параметры

nc (osg.Callback) – Event callback that must be added.

:getEventCallback()

Get event node callback, called during event traversal.

Тип результата

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.

Параметры

nc (osg.Callback) – Event callback that must be removed.

:setCullCallback(osg.Callback nc)

Set cull node callback, called during cull traversal.

Параметры

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.

Параметры

nc (osg.Callback) – Cull callback that must be added.

:getCullCallback()

Get cull node callback, called during cull traversal.

Тип результата

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.

Параметры

nc (osg.Callback) – Cull callback that must be removed.

:setNodeMask(unsigned mask)

Set the node Mask.

Параметры

mask (unsigned) – Node mask (0xffffffff etc.)

:getNodeMask()

Get the node mask.

Тип результата

unsigned

:setStateSet(osg.StateSet ss)

Set the node’s osg.StateSet

Параметры

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.

Тип результата

osg.StateSet

:getStateSet()

Return the node’s StateSet if exists, otherwise return nil.

Тип результата

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.

Параметры

i (unsigned) – Index of the description.

Тип результата

std.string

:addDescription(std.string desc)

Add a description string to the node.

Параметры

desc (std.string) – Description string.

:setInitialBound(osg.BoundingSphere bs)

Set the initial bounding volume to use when computing the overall bounding volume.

Параметры

bs (osg.BoundingSphere) – Bounding volume of the node.

:getInitialBound()

Set the initial bounding volume to use when computing the overall bounding volume.

Тип результата

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.

Тип результата

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 via osg.Node.dirtyBound().

Тип результата

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.

Тип результата

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.

Параметры

active (bool) – Must be true to activate culling, otherwise must be set to false.

:name()

Alias to osg.Object.getName()

Тип результата

std.string

: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.

Тип результата

bool