pgl
PrimitiveOpenGL3Dprimitivelibrary
Public Member Functions | Public Attributes | List of all members
pgl::Node Class Reference

Node in the scene graph. More...

#include <pgl.h>

Inheritance diagram for pgl::Node:
Inheritance graph
[legend]

Public Member Functions

virtual void draw ()
 Draw children.
 
template<class T >
T * attach (T *child)
 Add child to list of sub-objects. More...
 

Public Attributes

std::vector< Node * > children
 Sub-objects.
 

Detailed Description

Node in the scene graph.

Mainly a list of sub-objects to draw. Note that the sub-objects are owned by the node and deleted when the node itself is deleted.

Member Function Documentation

◆ attach()

template<class T >
T* pgl::Node::attach ( T *  child)
inline

Add child to list of sub-objects.

Returns
attached child. This allows code like
object->attach(new SubObject())->color = {1, 0, 0};
Note
Transfers ownership.

The documentation for this class was generated from the following file: