RobWorkProject
24.12.4-
|
interface for a minimalistic scenegraph that does not depend on the frame structure. See WorkCellScene for an implementation that wraps this interface to enable a more RobWork specific use. More...
#include <SceneGraph.hpp>
Inherited by SceneOpenGL.
Classes | |
struct | SceneGraphRenderInfo |
all general render information is located in this struct More... | |
Public Types | |
typedef rw::core::Ptr< SceneGraph > | Ptr |
smart pointer type of this class | |
typedef DrawableNode::DrawType | DrawType |
Drawing types. | |
using | RenderInfo = SceneGraphRenderInfo |
typedef boost::function< bool(rw::core::Ptr< rw::graphics::SceneNode > &node, rw::core::Ptr< rw::graphics::SceneNode > &parent)> | NodeVisitor |
Type of a visitor function. Returns true if visit is done. | |
typedef boost::function< bool(const rw::core::Ptr< rw::graphics::SceneNode > &node)> | NodeFilter |
Type of a filter function. | |
Public Member Functions | |
virtual | ~SceneGraph () |
Destructor. | |
virtual void | draw (RenderInfo &info)=0 |
draws the scene, using the specified render information More... | |
virtual DrawableNode::Ptr | pickDrawable (RenderInfo &info, int x, int y)=0 |
picks the drawable in the scene that intersects with the ray (x,y,-1) in camera coordinates. More... | |
virtual rw::math::Vector3D | unproject (SceneCamera::Ptr camera, int x, int y)=0 |
this method unprojects a 2D screen coordinate to 3D coordinates from the last draw'n scene. Which is the closest 3d point from the intersection of the ray (x,y,-1) and the objects drawn in the scene. More... | |
virtual rw::math::Vector3D | project (SceneCamera::Ptr camera, double x, double y, double z)=0 |
this method projects a 3D coordinate to 2D screen coordinates from the last draw'n scene. More... | |
virtual void | update ()=0 |
should be called after the structure of the scene has been changed | |
virtual void | clear ()=0 |
Clear the scene graph. | |
virtual rw::graphics::DrawableGeometryNode::Ptr | makeDrawableFrameAxis (const std::string &name, double size, int dmask=DrawableNode::Physical)=0 |
Create a drawable node for a frame axis coordinate system. More... | |
virtual rw::graphics::DrawableGeometryNode::Ptr | makeDrawable (const std::string &name, rw::core::Ptr< class rw::geometry::Geometry > geom, int dmask=DrawableNode::Physical)=0 |
Create a drawable node for a geometry. More... | |
virtual rw::graphics::DrawableGeometryNode::Ptr | makeDrawable (const std::string &name, const std::vector< class rw::geometry::Line > &lines, int dmask=DrawableNode::Physical)=0 |
Create a drawable node for lines. More... | |
virtual DrawableNode::Ptr | makeDrawable (const std::string &name, const class rw::sensor::Image &img, int dmask=DrawableNode::Virtual)=0 |
Create a drawable node for an image. More... | |
virtual DrawableNode::Ptr | makeDrawable (const std::string &name, const rw::geometry::PointCloud &scan, int dmask=DrawableNode::Virtual)=0 |
Create a drawable node for a point cloud. More... | |
virtual DrawableNode::Ptr | makeDrawable (const std::string &name, rw::core::Ptr< rw::geometry::Model3D > model, int dmask=DrawableNode::Physical)=0 |
Create a drawable node for a 3d model. More... | |
virtual DrawableNode::Ptr | makeDrawable (const std::string &name, const std::string &text, rw::core::Ptr< rw::kinematics::Frame > labelFrame, int dmask=DrawableNode::Virtual)=0 |
Create a drawable node for a text label. More... | |
virtual DrawableNode::Ptr | makeDrawable (const std::string &name, rw::core::Ptr< rw::graphics::Render > render, int dmask=DrawableNode::Physical)=0 |
Create a drawable node for a render. More... | |
virtual DrawableNode::Ptr | makeDrawable (const std::string &filename, int dmask=DrawableNode::Physical)=0 |
Create a drawable node from a file. More... | |
virtual rw::core::Ptr< SceneCamera > | makeCamera (const std::string &name)=0 |
Create a new scene camera. More... | |
virtual GroupNode::Ptr | makeGroupNode (const std::string &name) |
Make a group node. More... | |
virtual rw::core::Ptr< rw::graphics::CameraGroup > | makeCameraGroup (const std::string &name) |
Create a camera group. More... | |
virtual rw::core::Ptr< rw::graphics::CameraGroup > | findCameraGroup (const std::string &name) |
Find a camera group. More... | |
virtual void | addCameraGroup (rw::core::Ptr< rw::graphics::CameraGroup > cgroup) |
Add a camera group. More... | |
virtual void | removeCameraGroup (rw::core::Ptr< rw::graphics::CameraGroup > cgroup) |
Remove a camera group. More... | |
virtual void | removeCameraGroup (const std::string &name) |
Remove a camera group. More... | |
virtual std::list< rw::core::Ptr< rw::graphics::CameraGroup > > | getCameraGroups () |
Get all camera groups. More... | |
virtual void | setRoot (rw::graphics::GroupNode::Ptr node) |
Set the root of the scene graph. More... | |
virtual rw::graphics::GroupNode::Ptr | getRoot () |
Get the root of the scene graph. More... | |
virtual void | addChild (rw::core::Ptr< rw::graphics::SceneNode > child, rw::graphics::GroupNode::Ptr parent) |
add a drawable to a node | |
virtual std::vector< rw::graphics::DrawableNode::Ptr > | getDrawables () |
get all drawables in the scene. More... | |
virtual std::vector< rw::graphics::DrawableNode::Ptr > | getDrawables (rw::core::Ptr< rw::graphics::SceneNode > node) |
get a vector of drawables attached to a node More... | |
virtual std::vector< rw::graphics::DrawableNode::Ptr > | getDrawablesRec (rw::core::Ptr< rw::graphics::SceneNode > node) |
get all drawable nodes in the subtree of node. nodes of type camera will not be traversed More... | |
virtual rw::graphics::DrawableNode::Ptr | findDrawable (const std::string &name) |
Find a drawable node in the scene graph. More... | |
virtual rw::graphics::DrawableNode::Ptr | findDrawable (const std::string &name, rw::core::Ptr< SceneNode > node) |
Find a drawable node in the scene graph. More... | |
virtual std::vector< rw::graphics::DrawableNode::Ptr > | findDrawables (const std::string &name) |
Find multiple drawable nodes in the scene graph. More... | |
virtual bool | removeDrawables (rw::graphics::GroupNode::Ptr node) |
Remove a node. More... | |
virtual bool | removeDrawables (const std::string &name) |
Remove all drawables with a given name. More... | |
virtual bool | removeDrawable (rw::graphics::DrawableNode::Ptr drawable) |
Remove a specific drawable. More... | |
virtual bool | removeDrawable (rw::graphics::DrawableNode::Ptr drawable, rw::core::Ptr< rw::graphics::SceneNode > node) |
Remove a specific drawable. More... | |
virtual bool | removeDrawable (const std::string &name) |
Remove a specific drawable with a given name. More... | |
virtual bool | removeChild (const std::string &name, rw::graphics::GroupNode::Ptr node) |
Removes child with the specified name from the node. More... | |
void | traverse (rw::core::Ptr< rw::graphics::SceneNode > &node, NodeVisitor &visitor) |
Traverse all nodes in the subtree under node recursively. More... | |
void | traverse (rw::core::Ptr< rw::graphics::SceneNode > &node, NodeVisitor &visitor, NodeVisitor &postvisitor) |
Traverse all nodes in the subtree under node recursively. More... | |
void | traverse (rw::core::Ptr< rw::graphics::SceneNode > &node, NodeVisitor &visitor, const NodeFilter &filter) |
Traverse all nodes in the subtree under node recursively. More... | |
void | traverse (rw::core::Ptr< rw::graphics::SceneNode > &node, NodeVisitor &visitor, NodeVisitor &postvisitor, const NodeFilter &filter) |
Traverse all nodes in the subtree under node recursively. More... | |
Protected Member Functions | |
SceneGraph () | |
Construct new scene graph with only a root node "Root". | |
SceneGraph (rw::graphics::GroupNode::Ptr root) | |
Construct a new scene graph with a given root node. More... | |
Protected Attributes | |
rw::graphics::GroupNode::Ptr | _root |
The root node of the graph. | |
std::list< rw::core::Ptr< rw::graphics::CameraGroup > > | _cameraGroups |
The camera groups in the graph. | |
interface for a minimalistic scenegraph that does not depend on the frame structure. See WorkCellScene for an implementation that wraps this interface to enable a more RobWork specific use.
Cameras - SceneCameras define how the world is rendered from a specific point of view, render setting, projection matrix, viewport and so on.
Cameras are ordered in CameraGroups. Each camera group can contain multiple cameras that are ordered according to how they should render the scene. A typical setup of one group would be: first camera - clear color and depth buffers, render background ibn orthographic projection second camera - render all 3D scene elements in perspective projection third camera - render foreground such as logo in orthographic projection
As can be seen the ordering is of high importance since the first camera clears the frame buffers.
|
inlineprotected |
Construct a new scene graph with a given root node.
root | [in] the root node. |
|
virtual |
Add a camera group.
cgroup | [in] the group to add. |
|
pure virtual |
draws the scene, using the specified render information
info | documentation missing ! |
Implemented in SceneOpenGL.
|
virtual |
Find a camera group.
name | [in] name of the group. |
|
virtual |
Find a drawable node in the scene graph.
name | [in] the name of the drawable node. |
|
virtual |
Find a drawable node in the scene graph.
name | [in] the name of the drawable node. |
node | [in] search only this node and all children recursively. |
|
virtual |
Find multiple drawable nodes in the scene graph.
name | [in] the name of the drawable node(s). |
|
virtual |
Get all camera groups.
|
virtual |
get all drawables in the scene.
|
virtual |
get a vector of drawables attached to a node
node |
|
virtual |
get all drawable nodes in the subtree of node. nodes of type camera will not be traversed
node | [in] |
|
virtual |
Get the root of the scene graph.
|
pure virtual |
Create a new scene camera.
name | [in] name of the camera. |
Implemented in SceneOpenGL.
|
virtual |
Create a camera group.
name | [in] name of the group. |
Reimplemented in SceneOpenGL.
|
pure virtual |
Create a drawable node from a file.
filename | [in] a filename (alternatively a string for a geometric primitive). |
dmask | [in] (optional) the type of drawable. Default is DrawableNode::Physical. |
Implemented in SceneOpenGL.
|
pure virtual |
Create a drawable node for an image.
name | [in] name of the drawable. |
img | [in] the image to draw. |
dmask | [in] (optional) the type of drawable. Default is DrawableNode::Physical. |
Implemented in SceneOpenGL.
|
pure virtual |
Create a drawable node for a point cloud.
name | [in] name of the drawable. |
scan | [in] the point cloud to draw. |
dmask | [in] (optional) the type of drawable. Default is DrawableNode::Physical. |
Implemented in SceneOpenGL.
|
pure virtual |
Create a drawable node for a text label.
name | [in] name of the drawable. |
text | [in] the text to draw. |
labelFrame | [in] the frame the label belongs to. |
dmask | [in] (optional) the type of drawable. Default is DrawableNode::Virtual. |
Implemented in SceneOpenGL.
|
pure virtual |
Create a drawable node for lines.
name | [in] name of the drawable. |
lines | [in] the lines to draw. |
dmask | [in] (optional) the type of drawable. Default is DrawableNode::Physical. |
Implemented in SceneOpenGL.
|
pure virtual |
Create a drawable node for a geometry.
name | [in] name of the drawable. |
geom | [in] the geometry to draw. |
dmask | [in] (optional) the type of drawable. Default is DrawableNode::Physical. |
Implemented in SceneOpenGL.
|
pure virtual |
Create a drawable node for a 3d model.
name | [in] name of the drawable. |
model | [in] the 3d model to draw. |
dmask | [in] (optional) the type of drawable. Default is DrawableNode::Physical. |
Implemented in SceneOpenGL.
|
pure virtual |
Create a drawable node for a render.
name | [in] name of the drawable. |
render | [in] the render to draw. |
dmask | [in] (optional) the type of drawable. Default is DrawableNode::Physical. |
Implemented in SceneOpenGL.
|
pure virtual |
Create a drawable node for a frame axis coordinate system.
name | [in] name of the drawable. |
size | [in] size of the axis. |
dmask | [in] (optional) the type of drawable. Default is DrawableNode::Physical. |
Implemented in SceneOpenGL.
|
virtual |
Make a group node.
name | [in] name of the node. |
|
pure virtual |
picks the drawable in the scene that intersects with the ray (x,y,-1) in camera coordinates.
info | [in] rendering information. |
x | [in] first camera coordinate. |
y | [in] second camera coordinate. |
Implemented in SceneOpenGL.
|
pure virtual |
this method projects a 3D coordinate to 2D screen coordinates from the last draw'n scene.
(0,0) is located in the upper left corner, with x-axis increasing to the right and y-axis increasing to the bottom. The negative z-axis points into the scene-
camera | [in] the SceneCamera. |
x | [in] x coordinate [0;viewport.width] |
y | [in] y coordinate [0;viewport.height] |
z | [in] z coordinate |
Implemented in SceneOpenGL.
|
virtual |
Remove a camera group.
name | [in] the name of the group. |
|
virtual |
Remove a camera group.
cgroup | [in] the group to remove. |
|
virtual |
Removes child with the specified name from the node.
name | [in] Name of child to remove |
node | [in] Node to remove from |
|
virtual |
Remove a specific drawable with a given name.
name | [in] the name. |
|
virtual |
Remove a specific drawable.
drawable | [in] the drawable. |
|
virtual |
Remove a specific drawable.
drawable | [in] the drawable. |
node | [in] only search this node and children recursively. |
|
virtual |
Remove all drawables with a given name.
name | [in] the name. |
|
virtual |
Remove a node.
node | [in] the group node to remove. |
|
virtual |
Set the root of the scene graph.
node | [in] the root node. |
void traverse | ( | rw::core::Ptr< rw::graphics::SceneNode > & | node, |
NodeVisitor & | visitor | ||
) |
Traverse all nodes in the subtree under node recursively.
node | [in] the root node. |
visitor | [in] the visitor function to execute for each node visited. |
void traverse | ( | rw::core::Ptr< rw::graphics::SceneNode > & | node, |
NodeVisitor & | visitor, | ||
const NodeFilter & | filter | ||
) |
Traverse all nodes in the subtree under node recursively.
node | [in] the root node. |
visitor | [in] the visitor function to execute for each node visited. |
filter | [in] filter which nodes to visit. |
void traverse | ( | rw::core::Ptr< rw::graphics::SceneNode > & | node, |
NodeVisitor & | visitor, | ||
NodeVisitor & | postvisitor | ||
) |
Traverse all nodes in the subtree under node recursively.
node | [in] the root node. |
visitor | [in] the visitor function to execute for each node visited. |
postvisitor | [in] the visitor function to execute for each node visited afterwards. |
void traverse | ( | rw::core::Ptr< rw::graphics::SceneNode > & | node, |
NodeVisitor & | visitor, | ||
NodeVisitor & | postvisitor, | ||
const NodeFilter & | filter | ||
) |
Traverse all nodes in the subtree under node recursively.
node | [in] the root node. |
visitor | [in] the visitor function to execute for each node visited. |
postvisitor | [in] the visitor function to execute for each node visited afterwards. |
filter | [in] filter which nodes to visit. |
|
pure virtual |
this method unprojects a 2D screen coordinate to 3D coordinates from the last draw'n scene. Which is the closest 3d point from the intersection of the ray (x,y,-1) and the objects drawn in the scene.
(0,0) is located in the upper left corner, with x-axis increasing to the right and y-axis increasing to the bottom. The negative z-axis points into the scene-
camera | [in] the scene camera. |
x | [in] x coordinate [0;viewport.width] |
y | [in] y coordinate [0;viewport.height] |
Implemented in SceneOpenGL.