A scene graph. More...
#include <sceneview/scene.hpp>
Public Types | |
typedef std::shared_ptr< Scene > | Ptr |
Public Member Functions | |
const QString & | Name () const |
GroupNode * | Root () |
Retrieve the root node. More... | |
bool | ContainsNode (SceneNode *node) const |
GroupNode * | MakeGroup (GroupNode *parent, const QString &name=kAutoName) |
Create an empty group node. | |
GroupNode * | MakeGroupFromScene (GroupNode *parent, Scene::Ptr scene, const QString &name=kAutoName) |
Create a group node populated as a copy of the specified scene graph. More... | |
CameraNode * | MakeCamera (GroupNode *parent, const QString &name=kAutoName) |
Create a camera. More... | |
LightNode * | MakeLight (GroupNode *parent, const QString &name=kAutoName) |
Create a light. More... | |
DrawNode * | MakeDrawNode (GroupNode *parent, const QString &name=kAutoName) |
Create an empty draw node. More... | |
DrawNode * | MakeDrawNode (GroupNode *parent, const GeometryResource::Ptr &geometry, const MaterialResource::Ptr &material, const QString &name=kAutoName) |
Create a draw node with a single drawable. More... | |
DrawGroup * | MakeDrawGroup (int ordering, const QString &name=kAutoName) |
Create a draw group. More... | |
void | SetDrawGroup (DrawNode *draw_node, DrawGroup *draw_group) |
Sets the draw group that a draw node belongs to. | |
void | SetDrawGroup (GroupNode *node, DrawGroup *draw_group) |
Convenience method to call SetDrawGroup() on all DrawNode descendants of the specified group. | |
void | DestroyNode (SceneNode *node) |
Destroys a node and all of its children. | |
void | DestroyDrawGroup (DrawGroup *draw_group) |
Destroys a draw group. More... | |
std::vector< LightNode * > & | Lights () |
Retrieve a list of all lights in the scene. More... | |
DrawGroup * | GetDrawGroup (const QString &name) |
Retrieve the draw group with the specified name. More... | |
DrawGroup * | GetDefaultDrawGroup () |
void | PrintStats () |
Static Public Attributes | |
static const QString | kAutoName |
static constexpr int | kDefaultDrawGroupOrder = 10 |
The order assigned to the default render group. | |
static const QString | kDefaultDrawGroupName |
Name of the default render group. More... | |
Friends | |
class | ResourceManager |
A scene graph.
Scene objects are typically used to represent either a scene to be drawn, or a 3D model loaded into memory.
Scene objects cannot be directly instantiated. Instead, use ResourceManager.
void sv::Scene::DestroyDrawGroup | ( | DrawGroup * | draw_group | ) |
Destroys a draw group.
Constraints:
DrawGroup* sv::Scene::GetDrawGroup | ( | const QString & | name | ) |
Retrieve the draw group with the specified name.
std::invalid_argument | if name does not correspond to a draw group in the scene. |
|
inline |
Retrieve a list of all lights in the scene.
Don't modify the returned vector.
CameraNode* sv::Scene::MakeCamera | ( | GroupNode * | parent, |
const QString & | name = kAutoName |
||
) |
Create a camera.
The returned camera is owned by this object.
DrawGroup* sv::Scene::MakeDrawGroup | ( | int | ordering, |
const QString & | name = kAutoName |
||
) |
Create a draw group.
The returned DrawGroup is owned by this object.
Create an empty draw node.
The returned node is owned by this object.
To attach drawables to the node, use DrawNode::Add().
DrawNode* sv::Scene::MakeDrawNode | ( | GroupNode * | parent, |
const GeometryResource::Ptr & | geometry, | ||
const MaterialResource::Ptr & | material, | ||
const QString & | name = kAutoName |
||
) |
Create a draw node with a single drawable.
The returned node is owned by this object.
You can attach additional drawables to the draw node by calling DrawNode::Add().
GroupNode* sv::Scene::MakeGroupFromScene | ( | GroupNode * | parent, |
Scene::Ptr | scene, | ||
const QString & | name = kAutoName |
||
) |
Create a group node populated as a copy of the specified scene graph.
parent | the parent node for the new group node |
scene | the scene to copy into the new node. Cannot be this scene. |
|
inline |
Retrieve the root node.
The root node of a scene is always a group node.
|
static |
Name of the default render group.
This is equal to "default".