nodes described class osg

A, osg :: Node class

Class Description: osg :: Node is a node class, there are derived classes at numerous OSG is one of the most important category, one of the most commonly used classes.

1、Node ()

Node (const Node &node, const CopyOp &copyop=CopyOp::SHALLOW_COPY)

Description: Constructor, wherein the second overload function is built from known among new Node Node, which contains two parameters, the second parameter indicates the copy type, the default is shallow copy, may be provided to a deep copy. For Node has a deep copy of enumeration values: DEEP_COPY_NODES expressed deep copy

2、virtual Object * cloneType () const

Description: Returns a copy of the object, which is useful when this function is used when using a side existing Node initialization.

3、virtual Object * clone (const CopyOp &copyop) const

Description: copy, copy type parameter represents. Returns a copy of the Node, the copy type. For Node has enumerated values: DEEP_COPY_NODES, SHALLOW_COPY

4、virtual bool isSameKindAs (const Object *obj) const

Description: to determine whether a type of two types, parent and child classes should be counted as the same type. If the same type returns true, otherwise it returns false, obj need to determine whether the Node is the same type of class.

5、virtual const char * libraryName () const

Description: Returns the Node library file name.

6、virtual const char * className () const

Description: Returns the class type name of Node.

7、virtual Group * asGroup ()

virtual const Group * asGroup () const

Description of: the Node to use as a Group, Group pointer returns a pointer to the Group method, may be cast.

8、virtual Transform * asTransform ()

virtual const Transform * asTransform () const

Description of: the Node to use as a Transform, Transform returns a pointer to a pointer, so as to have a method Transform.

9、virtual void accept (NodeVisitor &nv)

virtual void ascend (NodeVisitor &nv)

virtual void traverse (NodeVisitor &)

Description: acceptance of traversing NodeVisitor. The first acceptance traversal, generally expressed full traversal. It represents a second traverse up. The third represents traversed downward, nv represents a parameter accessor. It is a very important tool.

10、const ParentList & getParents () const

ParentList getParents ()

Description: Returns the Node parent node list, because there may be multiple parent nodes. ParentList is a std :: vector <Group *>.

11、Group * getParent (unsigned int i)

const Group * getParent (unsigned int i) const

Description: The value of the index, to find the i-th parent node.

12、unsigned int getNumParents () const

Description: to obtain the number of the parent node.

13、NodePathList getParentalNodePaths (osg::Node *haltTraversalAtNode=0) const

Description: Allows to give the parent node of the node on the path to a node. It returns a list of nodes, setting a node, traverse the parent node of the node on the path. The default value is 0, which means traversing from the current node itself. The general parameters of a parent node certainly makes sense for the current node.

14、MatrixList getWorldMatrices (osg::Node *haltTraversalAtNode=0) const

Description: Get to let the node parent node of a node on the occurrence Matrix matrix operations junction point list. Setting a node, traverse the parent node so that the node on the path Matrix operations occur. The default value is 0, which means traversing from the current node itself. The general parameters of a parent node certainly makes sense for the current node.

15、void setUpdateCallback (NodeCallback *nc)

Description: Sets an update callback, nc callback function name.

16, Node Callback getUpdateCallback * ()

const NodeCallback * getUpdateCallback () const

Description: Returns the update callback pointer.

17、unsigned int getNumChildrenRequiringUpdateTraversal () const

Description: to obtain the number of child nodes is provided to update callback.

18, setEventCallback void (* NodeCallback nc)

Description: Set the event callback, nc event callback argument pointer.

19、NodeCallback * getEventCallback ()

NodeCallback const * getEventCallback () const

Description: Get event callback pointer. Return the pointer.

20、unsigned int getNumChildrenRequiringEventTraversal () const

Description: Get set up a number of child nodes event callback.

21、void setCullCallback (NodeCallback *nc)

Description: Set picking callback.

22、NodeCallback * getCullCallback ()

NodeCallback const * getCullCallback () const

Description: get chosen callback pointer. Return pick callback pointer.

23、void setCullingActive (bool active)

Description: Whether open election.

24、bool getCullingActive () const

Description: get chosen open state. If enabled, it returns true, false otherwise.

25、unsigned int getNumChildrenWithCullingDisabled () const

Description: to obtain the number of child nodes no sorting opening. The number of returns.

26、bool containsOccluderNodes () const

Explanation: see if it contains occluder node. Occluder node is often a geometrical shape for the back of the file node.

27、void setNodeMask (NodeMask nm)

Description: Sets the node is hidden. If nm to 0 to hide, display or on behalf of, nm is 0 to hide, is non-zero indicates displayed.

28、NodeMask getNodeMask () const

Description: to give the node status is displayed or hidden. Such as 0 indicates hidden, or that display.

29、void setDescriptions (const DescriptionList &descriptions)

Description: Sets the node described. Often be expressed as a string of nodes, the node is described as a string. sequence. std :: vector <std :: string>

30、DescriptionList & getDescriptions ()

const DescriptionList & getDescriptions () const

const std::string & getDescription (unsigned int i) const

std::string & getDescription (unsigned int i)

Description: to give junction is described, the sequence returns a string std :: vector <std :: string>. There are obtained the parameter i represents the i-th description, is described as a sequence obtained indicates the i-th described. Returns a string string.

31、unsigned int getNumDescriptions () const

Description: to obtain the number of nodes is described.

32、void addDescription (const std::string &desc)

Description: Add a description.

33、void setStateSet (osg::StateSet *stateset)

Description: Set status settings. Set to state relations among all states OpenGL.

34、osg::StateSet * getOrCreateStateSet ()

Description: get or create a status indicator. Upon return of the pointer, which can be associated with the node, the pointer will change state to change the value of a node.

35、osg::StateSet * getStateSet ()

const osg::StateSet * getStateSet () const

Description: to give state pointer, if not bound too, return empty.

36、void setInitialBound (const osg::BoundingSphere &bsphere)

Description: Sets the initial bounding sphere. Parameter represents a bounding sphere. If dirty, and it will change the value of the ball. Equal is associated with a golf ball.

37、const BoundingSphere & getInitialBound () const

Description: Get the original ball. Returns a reference to the Sphere.

38、void dirtyBound ()

Description: Sphere surrounded calculation required.

39、const BoundingSphere & getBound () const

Description: get surrounded by balls.

40、virtual BoundingSphere computeBound () const

Description: Sphere Calculation surrounded.

41、void setComputeBoundingSphereCallback (ComputeBoundingSphereCallback *callback)

Description: Sets the bounding sphere callback when computing bounding sphere This function is called, this parameter is a pointer to a callback.

42、ComputeBoundingSphereCallback * getComputeBoundingSphereCallback () const

Description: Get the ball surrounded by calculation callback. Get a callback pointer.

43、virtual void setThreadSafeRefUnref (bool threadSafe)

Description: Set whether to view the ref and thread safety unref view expressed is true, false means no view.

44、virtual void resizeGLObjectBuffers (unsigned int)

Description: Buffer resizing GL objects of the specified size, Buffer size value, to modify each Buffer.

45、virtual void releaseGLObjects (osg::State *=0) const

Description: GL release objects. If State is not only associated with the release of the object is 0, thereby releasing the context associated therewith. Otherwise it will release all the object image for the release of all context.

 

Two, osg :: Group class

Class Description: play a role in the organization of the nodes, the parent node or a general root do occur. It allows a range of children, between the same child or children will be cited too heavy to join the shared memory is osg :: Referenced by the parent class automatically handles memory management. It inherits the osg :: Node

1、Group ()

Group (const Group &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)

Description: constructor. The second constructor means is known from a new Group Group structure. Parameter indicates the copy type, the default is shallow copy, copy type, the default is shallow copy, may be a deep copy: DEEP_COPY_OBJECTS

2、virtual Group * asGroup ()

virtual const Group * asGroup () const

Description: Returns a pointer Group, which is available to a subclass to be used. When the object is a non-pointer can also be used.

3、virtual void traverse (NodeVisitor &nv)

Description: Accept a visit to traverse NodeVisitor up, nv to access parameters, note passing a reference type.

4、virtual bool addChild (Node *child)

Description: add a child node to the group. If you add true success is returned.

5、virtual bool insertChild (unsigned int index, Node *child)

Description: Insert a node back to the index th node. If the insert succeeds, it returns true, false otherwise.

6、bool removeChild (Node *child)

bool removeChild (unsigned int pos, unsigned int numChildrenToRemove=1)

Note: To remove a child, removing success, returns true, otherwise returns false. The first function is a pointer to a child as a parameter to remove it. The second one is numChildrenToRemove, to remove the child pointer value after the first child for the pos parameter to remove pos.

7、virtual bool removeChildren (unsigned int pos, unsigned int numChildrenToRemove)

Description: delete some children, after removing some children from child pos. NumChildrenToRemove number of children you want to delete.

8、virtual bool replaceChild (Node *origChild, Node *newChild)

Note: Use a junction, instead of a child, origChild represent old child, it is to be out for the child. newChild said the new child, to go on top of the child.

9、unsigned int getNumChildren () const

Description: Get the number of children of the group. Returns the number of children value.

10、virtual bool setChild (unsigned int i, Node *node)

Description: Sets the i-th child node for the value to be set group of the i-th child. node represents the value to be set.

11、Node * getChild (unsigned int i)

const Node * getChild (unsigned int i) const

Description: Get the i-th child. Return to the i-th child pointer.

12、bool containsNode (const Node *node) const

Description: Determine whether the group contains parameters referred node Returns true if it contains false otherwise.

13、unsigned int getChildIndex (const Node *node) const

Description: The node of the index values ​​obtained indicated. Return to the index value.

14、virtual void setThreadSafeRefUnref (bool threadSafe)

Description: Sets whether to check thread safety and unref the ref, threadSafe expressed view is true, false means no view.

15、virtual void resizeGLObjectBuffers (unsigned int)

Description: Buffer resizing GL objects of the specified size.

16、virtual void releaseGLObjects (osg::State *=0) const

Description: GL release objects. If State is not only associated with the release of the object is 0, thereby releasing the context associated therewith. Otherwise it will release all the object image for the release of all context,

 

Three, osg :: Switch category

Class Description: Switch is a managed class that can have many subclasses below, it is like a switch may control the display and the hidden subclass, and this is not hidden memory-intensive, in contrast to SetNodeMask has obvious advantages, SetNodeMask really just hidden settled point, but the node is still drawn. This class is derived from the Node and Group, and so asGroup node group and the like may be added to various methods. It is a very popular class.

1、Switch ()

Switch (const Switch &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)

Description: constructor. The second constructor is the construction of new known from Switch Switch. Second control parameters for the copy type. The default value is shallow copy, a deep copy is: DEEP_COPY_OBJECTS

2、META_Node (osg, Switch)

Description: is a macro, macro defines a standard Clone, and having isSameAs, ClassName, accept three important ways. Purpose is to allow a subclass derived from the Node easily define desired pure virtual methods.

3、virtual void traverse (NodeVisitor &nv)

Description: Sets the downward traverse, a generally downward traversal from the start node.

4、void setNewChildDefaultValue (bool value)

Description: Set the default value when new children are added or display on or off. If the value is true means open, false representation off.

5、bool getNewChildDefaultValue () const

Description: to obtain a new node is added default switch value, if the default is on, the process returns true, false otherwise.

6、virtual bool addChild (Node *child)

virtual bool addChild (Node *child, bool value)

Description: Adding a child to switch. Add successful returns true, fails to add false is returned. Since the failure may be added or a null pointer contained in the node has been set among the nodes.

7、virtual bool insertChild (unsigned int index, Node *child)

virtual bool insertChild (unsigned int index, Node *child, bool value)

Description: Insert a child to the index value. Value switch may be provided. Insert success, it returns true, otherwise returns false. If the child is empty or already in the group, it will return false.

8、virtual bool removeChildren (unsigned int pos, unsigned int numChildrenToRemove)

Description: Starting from the first pos, remove numChildrenToR child nodes.

9、void setValue (unsigned int pos, bool value)

Description: Sets the value of the switching node pos first value if the true value is represented by open, if false indicates OFF.

10、bool getValue (unsigned int pos) const

Description: Returns the first child of the switch value Pos. Returns true open, shut it returns false.

11、void setChildValue (const Node *child, bool value)

Description: Sets the child switch values, a pointer to the node as a parameter. If the value is true is set to On, otherwise set to Off.

12、bool getChildValue (const Node *child) const

Description: to give the child a switching value, as a parameter a pointer to the child.

13、bool setAllChildrenOff ()

Description: Close all children. If you close the successful return true, otherwise it returns false.

14、bool setAllChildrenOn ()

Description: Open to all children, if successful, open returns true, false otherwise.

15、bool setSingleChildOn (unsigned int pos)

Description: Sets the child individual switches on and off. Setting successful return true, otherwise returns false.

16、void setValueList (const ValueList &values)

Description: a switching sequence is provided a child to complete the set sequence of Boolean values, switching sequence, defined as std :: vector <bool>

17、const ValueList & getValueList () const

Description: to give the child the switching sequence of values ​​switching sequence.

18、virtual BoundingSphere computeBound () const

Description: computing a bounding sphere, the switch returns the bounding sphere total of all open child nodes.

 

Four, osg :: MatrixTransform class

Class Description: This is the most commonly used class of mobile nodes may follow, the rotation control node. These operations are multiplied by a matrix obtained.

1、MatrixTransform ()

MatrixTransform (const MatrixTransform &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)

MatrixTransform (const Matrix &matix)

Description: Constructor, from the second constructor for a conventional construction of new MatrixTransform MatrixTransform. Copy type may be determined, the default is shallow copy, may be a deep copy: DEEP_COPY_OBJECTS. And the third from a constructor to construct a matrix MatrixTransform.

2、META_Node (osg, Switch)

Description: is a macro, macro defines a standard Clone, and having isSameAs, ClassName, accept three important ways. Purpose is to allow a subclass derived from the Node easily define desired pure virtual methods.

3、virtual MatrixTransform * asMatrixTransform ()

virtual const MatrixTransform * asMatrixTransform () const

Description: Returns a pointer to the MatrixTransform, if the object can be used as such, or other types of its parent class.

4、void setMatrix (const Matrix &mat)

Note: This method is very important, which is the most important way, there are a lot of usage. Such formats are wherein: mat.setMatrix (osg :: Matrix :: Transform (x, y, z)), wherein osg :: Matrix :: Scale osg :: Matrix :: Rotate and may also be used therein, with good and may be superimposed. This sets the mat matrix. Node is then added to the mat, the mat and then added to the Group.

5、const Matrix & getMatrix () const

Description: to obtain a matrix of values ​​that have been set. It returns a reference to a matrix.

6、void preMult (const Matrix &mat)

void postMult (const Matrix &mat)

Description: preMult meant for the former matrix multiplication, postMult mean after multiplication matrix.

7、const Matrix & getInverseMatrix () const

Description: get the inverse matrix.

8、virtual bool computeLocalToWorldMatrix (Matrix &matrix, NodeVisitor *) const

virtual bool computeWorldToLocalMatrix (Matrix &matrix, NodeVisitor *) const

Description: The node steering NodeVisitor indicated by the local coordinate system in the world coordinate system, the world coordinate system or a steering local coordinate system. Value obtained matrix, the matrix may be converted into coordinate values, the conversion is successful returns true, else return false.


This very detailed, good to see Leilei, reproduced over the following address:

https://zhuanlan.zhihu.com/p/38327504

 

 

 

Published 68 original articles · won praise 141 · views 370 000 +

Guess you like

Origin blog.csdn.net/cfl997/article/details/105195855