Representation of an entire scene graph. More...
#include <rendering/rendering.hh>
Public Member Functions | |
Scene (const std::string &_name, bool _enableVisualizations=false) | |
Constructor. | |
virtual | ~Scene () |
Destructor. | |
void | AddVisual (VisualPtr _vis) |
Add a visual to the scene. | |
void | Clear () |
Clear rendering::Scene. | |
VisualPtr | CloneVisual (const std::string &_visualName, const std::string &_newName) |
Clone a visual. | |
CameraPtr | CreateCamera (const std::string &_name, bool _autoRender=true) |
Create a camera. | |
DepthCameraPtr | CreateDepthCamera (const std::string &_name, bool _autoRender=true) |
Create depth camera. | |
GpuLaserPtr | CreateGpuLaser (const std::string &_name, bool _autoRender=true) |
Create laser that generates data from rendering. | |
void | CreateGrid (uint32_t _cellCount, float _cellLength, float _lineWidth, const common::Color &_color) |
Create a square grid of cells. | |
UserCameraPtr | CreateUserCamera (const std::string &_name) |
Create a user camera. | |
void | DrawLine (const math::Vector3 &_start, const math::Vector3 &_end, const std::string &_name) |
Draw a named line. | |
common::Color | GetAmbientColor () const |
Get the ambient color. | |
common::Color | GetBackgroundColor () const |
Get the background color. | |
CameraPtr | GetCamera (uint32_t _index) const |
Get a camera based on an index. | |
CameraPtr | GetCamera (const std::string &_name) const |
Get a camera by name. | |
uint32_t | GetCameraCount () const |
Get the number of cameras in this scene. | |
math::Vector3 | GetFirstContact (CameraPtr _camera, const math::Vector2i &_mousePos) |
Get the world pos of a the first contact at a pixel location. | |
Grid * | GetGrid (uint32_t _index) const |
Get a grid based on an index. | |
uint32_t | GetGridCount () const |
Get the number of grids. | |
Heightmap * | GetHeightmap () const |
Get a pointer to the heightmap. | |
uint32_t | GetId () const |
Get the scene ID. | |
std::string | GetIdString () const |
Get the scene Id as a string. | |
LightPtr | GetLight (const std::string &_name) const |
Get a light by name. | |
LightPtr | GetLight (uint32_t _index) const |
Get a light based on an index. | |
uint32_t | GetLightCount () const |
Get the count of the lights. | |
Ogre::SceneManager * | GetManager () const |
Get the OGRE scene manager. | |
VisualPtr | GetModelVisualAt (CameraPtr _camera, const math::Vector2i &_mousePos) |
Get a model's visual at a mouse position. | |
std::string | GetName () const |
Get the name of the scene. | |
VisualPtr | GetSelectedVisual () const |
Get the currently selected visual. | |
bool | GetShadowsEnabled () const |
Get whether shadows are on or off. | |
UserCameraPtr | GetUserCamera (uint32_t _index) const |
Get a user camera by index. | |
uint32_t | GetUserCameraCount () const |
Get the number of user cameras in this scene. | |
VisualPtr | GetVisual (const std::string &_name) const |
Get a visual by name. | |
VisualPtr | GetVisualAt (CameraPtr _camera, const math::Vector2i &_mousePos, std::string &mod) |
Get an entity at a pixel location using a camera. | |
VisualPtr | GetVisualAt (CameraPtr _camera, const math::Vector2i &_mousePos) |
Get a visual at a mouse position. | |
VisualPtr | GetVisualBelow (const std::string &_visualName) |
Get the closest visual below a given visual. | |
void | GetVisualsBelowPoint (const math::Vector3 &_pt, std::vector< VisualPtr > &_visuals) |
Get a visual directly below a point. | |
VisualPtr | GetWorldVisual () const |
Get the top level world visual. | |
void | Init () |
Init rendering::Scene. | |
void | Load (sdf::ElementPtr _scene) |
Load the scene from a set of parameters. | |
void | Load () |
Load the scene with default parameters. | |
void | PreRender () |
Process all received messages. | |
void | PrintSceneGraph () |
Print the scene graph to std_out. | |
void | RemoveVisual (VisualPtr _vis) |
Remove a visual from the scene. | |
void | SelectVisual (const std::string &_name, const std::string &_mode) |
Select a visual by name. | |
void | SetAmbientColor (const common::Color &_color) |
Set the ambient color. | |
void | SetBackgroundColor (const common::Color &_color) |
Set the background color. | |
void | SetFog (const std::string &_type, const common::Color &_color, double _density, double _start, double _end) |
Set the fog parameters. | |
void | SetGrid (bool _enabled) |
Set the grid on or off. | |
void | SetShadowsEnabled (bool _value) |
Set whether shadows are on or off. | |
void | SetVisible (const std::string &_name, bool _visible) |
Hide or show a visual. | |
void | SnapVisualToNearestBelow (const std::string &_visualName) |
Move the visual to be ontop of the nearest visual below it. | |
std::string | StripSceneName (const std::string &_name) const |
Remove the name of scene from a string. | |
Public Attributes | |
SkyX::SkyX * | skyx |
Pointer to the sky. | |
Representation of an entire scene graph.
Maintains all the Visuals, Lights, and Cameras for a World.
gazebo::rendering::Scene::Scene | ( | const std::string & | _name, |
bool | _enableVisualizations = false |
||
) |
Constructor.
[in] | _name | Name of the scene. |
[in] | _enableVisualizations | True to enable visualizations, this should be set to true for user interfaces, and false for sensor generation. |
|
virtual |
Destructor.
void gazebo::rendering::Scene::AddVisual | ( | VisualPtr | _vis | ) |
Add a visual to the scene.
[in] | _vis | Visual to add. |
void gazebo::rendering::Scene::Clear | ( | ) |
Clear rendering::Scene.
VisualPtr gazebo::rendering::Scene::CloneVisual | ( | const std::string & | _visualName, |
const std::string & | _newName | ||
) |
Clone a visual.
[in] | _visualName | Name of the visual to clone. |
[in] | _newName | New name of the visual. |
CameraPtr gazebo::rendering::Scene::CreateCamera | ( | const std::string & | _name, |
bool | _autoRender = true |
||
) |
Create a camera.
[in] | _name | Name of the new camera. |
[in] | _autoRender | True to allow Gazebo to automatically render the camera. This should almost always be true. |
DepthCameraPtr gazebo::rendering::Scene::CreateDepthCamera | ( | const std::string & | _name, |
bool | _autoRender = true |
||
) |
Create depth camera.
[in] | _name | Name of the new camera. |
[in] | _autoRender | True to allow Gazebo to automatically render the camera. This should almost always be true. |
GpuLaserPtr gazebo::rendering::Scene::CreateGpuLaser | ( | const std::string & | _name, |
bool | _autoRender = true |
||
) |
Create laser that generates data from rendering.
[in] | _name | Name of the new laser. |
[in] | _autoRender | True to allow Gazebo to automatically render the camera. This should almost always be true. |
void gazebo::rendering::Scene::CreateGrid | ( | uint32_t | _cellCount, |
float | _cellLength, | ||
float | _lineWidth, | ||
const common::Color & | _color | ||
) |
Create a square grid of cells.
[in] | _cellCount | Number of grid cells in one direction. |
[in] | _cellLength | Length of one grid cell. |
[in] | _lineWidth | Width of the grid lines. |
[in] | _color | Color of the grid lines. |
UserCameraPtr gazebo::rendering::Scene::CreateUserCamera | ( | const std::string & | _name | ) |
Create a user camera.
A user camera is one design for use with a GUI.
[in] | _name | Name of the UserCamera. |
void gazebo::rendering::Scene::DrawLine | ( | const math::Vector3 & | _start, |
const math::Vector3 & | _end, | ||
const std::string & | _name | ||
) |
Draw a named line.
[in] | _start | Start position of the line. |
[in] | _end | End position of the line. |
[in] | _name | Name of the line. |
common::Color gazebo::rendering::Scene::GetAmbientColor | ( | ) | const |
Get the ambient color.
common::Color gazebo::rendering::Scene::GetBackgroundColor | ( | ) | const |
Get the background color.
CameraPtr gazebo::rendering::Scene::GetCamera | ( | uint32_t | _index | ) | const |
Get a camera based on an index.
Index must be between 0 and Scene::GetCameraCount.
[in] | _index | Index of the camera to get. |
CameraPtr gazebo::rendering::Scene::GetCamera | ( | const std::string & | _name | ) | const |
Get a camera by name.
[in] | _name | Name of the camera. |
uint32_t gazebo::rendering::Scene::GetCameraCount | ( | ) | const |
Get the number of cameras in this scene.
math::Vector3 gazebo::rendering::Scene::GetFirstContact | ( | CameraPtr | _camera, |
const math::Vector2i & | _mousePos | ||
) |
Get the world pos of a the first contact at a pixel location.
[in] | _camera | Pointer to the camera. |
[in] | _mousePos | 2D position of the mouse in pixels. |
Grid* gazebo::rendering::Scene::GetGrid | ( | uint32_t | _index | ) | const |
Get a grid based on an index.
Index must be between 0 and Scene::GetGridCount.
[in] | _index | Index of the grid. |
uint32_t gazebo::rendering::Scene::GetGridCount | ( | ) | const |
Get the number of grids.
Heightmap* gazebo::rendering::Scene::GetHeightmap | ( | ) | const |
Get a pointer to the heightmap.
uint32_t gazebo::rendering::Scene::GetId | ( | ) | const |
Get the scene ID.
std::string gazebo::rendering::Scene::GetIdString | ( | ) | const |
Get the scene Id as a string.
LightPtr gazebo::rendering::Scene::GetLight | ( | const std::string & | _name | ) | const |
Get a light by name.
[in] | _name | Name of the light to get. |
LightPtr gazebo::rendering::Scene::GetLight | ( | uint32_t | _index | ) | const |
Get a light based on an index.
The index must be between 0 and Scene::GetLightCount.
[in] | _index | Index of the light. |
uint32_t gazebo::rendering::Scene::GetLightCount | ( | ) | const |
Get the count of the lights.
Ogre::SceneManager* gazebo::rendering::Scene::GetManager | ( | ) | const |
Get the OGRE scene manager.
VisualPtr gazebo::rendering::Scene::GetModelVisualAt | ( | CameraPtr | _camera, |
const math::Vector2i & | _mousePos | ||
) |
Get a model's visual at a mouse position.
[in] | _camera | Pointer to the camera used to project the mouse position. |
[in] | _mousePos | The 2d position of the mouse in pixels. |
std::string gazebo::rendering::Scene::GetName | ( | ) | const |
Get the name of the scene.
VisualPtr gazebo::rendering::Scene::GetSelectedVisual | ( | ) | const |
Get the currently selected visual.
bool gazebo::rendering::Scene::GetShadowsEnabled | ( | ) | const |
Get whether shadows are on or off.
UserCameraPtr gazebo::rendering::Scene::GetUserCamera | ( | uint32_t | _index | ) | const |
Get a user camera by index.
The index value must be between 0 and Scene::GetUserCameraCount.
[in] | _index | Index of the UserCamera to get. |
uint32_t gazebo::rendering::Scene::GetUserCameraCount | ( | ) | const |
Get the number of user cameras in this scene.
VisualPtr gazebo::rendering::Scene::GetVisual | ( | const std::string & | _name | ) | const |
Get a visual by name.
VisualPtr gazebo::rendering::Scene::GetVisualAt | ( | CameraPtr | _camera, |
const math::Vector2i & | _mousePos, | ||
std::string & | mod | ||
) |
Get an entity at a pixel location using a camera.
Used for mouse picking.
[in] | camera | The ogre camera, used to do mouse picking |
[in] | mousePos | The position of the mouse in screen coordinates |
[out] | _mod | Used for object manipulation |
VisualPtr gazebo::rendering::Scene::GetVisualAt | ( | CameraPtr | _camera, |
const math::Vector2i & | _mousePos | ||
) |
Get a visual at a mouse position.
[in] | _camera | Pointer to the camera used to project the mouse position. |
[in] | _mousePos | The 2d position of the mouse in pixels. |
VisualPtr gazebo::rendering::Scene::GetVisualBelow | ( | const std::string & | _visualName | ) |
Get the closest visual below a given visual.
[in] | _visualName | Name of the visual to search below. |
void gazebo::rendering::Scene::GetVisualsBelowPoint | ( | const math::Vector3 & | _pt, |
std::vector< VisualPtr > & | _visuals | ||
) |
Get a visual directly below a point.
[in] | _pt | 3D point to get the visual below. |
[out] | _visuals | The visuals below the point order in proximity. |
VisualPtr gazebo::rendering::Scene::GetWorldVisual | ( | ) | const |
Get the top level world visual.
void gazebo::rendering::Scene::Init | ( | ) |
Init rendering::Scene.
void gazebo::rendering::Scene::Load | ( | sdf::ElementPtr | _scene | ) |
Load the scene from a set of parameters.
[in] | _scene | SDF scene element to load. |
void gazebo::rendering::Scene::Load | ( | ) |
Load the scene with default parameters.
void gazebo::rendering::Scene::PreRender | ( | ) |
Process all received messages.
void gazebo::rendering::Scene::PrintSceneGraph | ( | ) |
Print the scene graph to std_out.
void gazebo::rendering::Scene::RemoveVisual | ( | VisualPtr | _vis | ) |
Remove a visual from the scene.
[in] | _vis | Visual to remove. |
void gazebo::rendering::Scene::SelectVisual | ( | const std::string & | _name, |
const std::string & | _mode | ||
) |
Select a visual by name.
[in] | _name | Name of the visual to select. |
[in] | _mode | Selection mode (normal, or move). |
void gazebo::rendering::Scene::SetAmbientColor | ( | const common::Color & | _color | ) |
Set the ambient color.
[in] | _color | The ambient color to use. |
void gazebo::rendering::Scene::SetBackgroundColor | ( | const common::Color & | _color | ) |
Set the background color.
[in] | _color | The background color. |
void gazebo::rendering::Scene::SetFog | ( | const std::string & | _type, |
const common::Color & | _color, | ||
double | _density, | ||
double | _start, | ||
double | _end | ||
) |
Set the fog parameters.
[in] | _type | Type of fog: "linear", "exp", or "exp2". |
[in] | _color | Color of the fog. |
[in] | _density | Fog density. |
[in] | _start | Distance from camera to start the fog. |
[in] | _end | Distance from camera at which the fog is at max density. |
void gazebo::rendering::Scene::SetGrid | ( | bool | _enabled | ) |
Set the grid on or off.
[in] | _enabled | Set to true to turn on the grid |
void gazebo::rendering::Scene::SetShadowsEnabled | ( | bool | _value | ) |
Set whether shadows are on or off.
[in] | _value | True to enable shadows, False to disable |
void gazebo::rendering::Scene::SetVisible | ( | const std::string & | _name, |
bool | _visible | ||
) |
Hide or show a visual.
[in] | _name | Name of the visual to change. |
[in] | _visible | True to make visual visible, False to make it invisible. |
void gazebo::rendering::Scene::SnapVisualToNearestBelow | ( | const std::string & | _visualName | ) |
Move the visual to be ontop of the nearest visual below it.
[in] | _visualName | Name of the visual to move. |
std::string gazebo::rendering::Scene::StripSceneName | ( | const std::string & | _name | ) | const |
Remove the name of scene from a string.
[in] | _name | Name to string the scene name from. |
SkyX::SkyX* gazebo::rendering::Scene::skyx |
Pointer to the sky.