Sceneview
 All Classes Functions Variables Enumerations Enumerator Groups Pages
Public Types | Public Member Functions | Static Public Attributes | Friends | List of all members
sv::Scene Class Reference

A scene graph. More...

#include <sceneview/scene.hpp>

Public Types

typedef std::shared_ptr< ScenePtr
 

Public Member Functions

const QString & Name () const
 
GroupNodeRoot ()
 Retrieve the root node. More...
 
bool ContainsNode (SceneNode *node) const
 
GroupNodeMakeGroup (GroupNode *parent, const QString &name=kAutoName)
 Create an empty group node.
 
GroupNodeMakeGroupFromScene (GroupNode *parent, Scene::Ptr scene, const QString &name=kAutoName)
 Create a group node populated as a copy of the specified scene graph. More...
 
CameraNodeMakeCamera (GroupNode *parent, const QString &name=kAutoName)
 Create a camera. More...
 
LightNodeMakeLight (GroupNode *parent, const QString &name=kAutoName)
 Create a light. More...
 
DrawNodeMakeDrawNode (GroupNode *parent, const QString &name=kAutoName)
 Create an empty draw node. More...
 
DrawNodeMakeDrawNode (GroupNode *parent, const GeometryResource::Ptr &geometry, const MaterialResource::Ptr &material, const QString &name=kAutoName)
 Create a draw node with a single drawable. More...
 
DrawGroupMakeDrawGroup (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...
 
DrawGroupGetDrawGroup (const QString &name)
 Retrieve the draw group with the specified name. More...
 
DrawGroupGetDefaultDrawGroup ()
 
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
 

Detailed Description

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.

Member Function Documentation

void sv::Scene::DestroyDrawGroup ( DrawGroup draw_group)

Destroys a draw group.

Constraints:

  • The default draw group cannot be destroyed.
  • The draw group must be empty (i.e., no nodes assigned to the draw group).
DrawGroup* sv::Scene::GetDrawGroup ( const QString &  name)

Retrieve the draw group with the specified name.

Exceptions
std::invalid_argumentif name does not correspond to a draw group in the scene.
std::vector<LightNode*>& sv::Scene::Lights ( )
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.

Returns
the newly created camera.
DrawGroup* sv::Scene::MakeDrawGroup ( int  ordering,
const QString &  name = kAutoName 
)

Create a draw group.

The returned DrawGroup is owned by this object.

Returns
a newly created draw group.
DrawNode* sv::Scene::MakeDrawNode ( GroupNode parent,
const QString &  name = kAutoName 
)

Create an empty draw node.

The returned node is owned by this object.

To attach drawables to the node, use DrawNode::Add().

Returns
a newly created DrawNode.
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().

Returns
a newly created DrawNode.
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.

Parameters
parentthe parent node for the new group node
scenethe scene to copy into the new node. Cannot be this scene.
LightNode* sv::Scene::MakeLight ( GroupNode parent,
const QString &  name = kAutoName 
)

Create a light.

The returned light is owned by this object.

Returns
a newly created LightNode.
GroupNode* sv::Scene::Root ( )
inline

Retrieve the root node.

The root node of a scene is always a group node.

Member Data Documentation

const QString sv::Scene::kDefaultDrawGroupName
static

Name of the default render group.

This is equal to "default".


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