chrono::sensor::ChScene Class Reference

Description

Scene class used for camera renderings. Includes environment colors, lights, etc.

#include <ChScene.h>

Public Member Functions

 ChScene ()
 Class constructor.
 
 ~ChScene ()
 Class destructor.
 
unsigned int AddPointLight (ChVector3f pos, ChColor color, float max_range, bool const_color=true)
 Add a point light that emits light in all directions. More...
 
void ModifyPointLight (unsigned int light_ID, const ChOptixLight &point_light)
 Function for modifying an existing point light in the scene. More...
 
unsigned int AddDirectionalLight (ChColor color, float elevation, float azimuth)
 Add a directional light that emits light in a particular direction. More...
 
void ModifyDirectionalLight (unsigned int light_ID, const ChOptixLight &directional_light)
 Function for modifying an existing directional light in the scene. More...
 
unsigned int AddSpotLight (ChVector3f pos, ChColor color, float max_range, ChVector3f light_dir, float angle_falloff_start, float angle_range, bool const_color=true)
 Add a spot light that emits light in a particular direction. More...
 
void ModifySpotLight (unsigned int light_ID, const ChOptixLight &spot_light)
 Function for modifying an existing spot light in the scene. More...
 
unsigned int AddRectangleLight (ChVector3f pos, ChColor color, float max_range, ChVector3f length_vec, ChVector3f width_vec, bool const_color=true)
 Add a rectangle light that emits light forward from a rectangle area. More...
 
void ModifyRectangleLight (unsigned int light_ID, const ChOptixLight &rectangle_light)
 Function for modifying an existing rectangle light in the scene. More...
 
unsigned int AddDiskLight (ChVector3f pos, ChColor color, float max_range, ChVector3f light_dir, float radius, bool const_color=true)
 Add a disk light that emits light forward from a circular area. More...
 
void ModifyDiskLight (unsigned int light_ID, const ChOptixLight &disk_light)
 Function for modifying an existing disk light in the scene. More...
 
unsigned int AddEnvironmentLight (std::string env_tex_path, float intensity_scale=1.f)
 Add the environment light that emits light from all directions based on an environment map. More...
 
std::vector< ChOptixLightGetLights ()
 Function for gaining access to the vector of lights which can be used to modify lighting dynamically. More...
 
Background GetBackground ()
 Function for gaining access to the background. More...
 
void SetBackground (Background b)
 Function for gaining access to the background. More...
 
void SetAmbientLight (ChVector3f color)
 Function for setting the ambient light color. More...
 
ChVector3f GetAmbientLight ()
 Function for setting the ambient light color. More...
 
void ResetLightsChanged ()
 Function for resetting the lights changed variable.
 
bool GetLightsChanged ()
 Function for getting the lights changed variable.
 
void ResetBackgroundChanged ()
 Function for resetting the background changed variable.
 
bool GetBackgroundChanged ()
 Function for getting the background changed variable.
 
void SetFogColor (ChVector3f color)
 Function to set the fog color.
 
ChVector3f GetFogColor ()
 Function to get the fog color.
 
void SetFogScattering (float coefficient)
 Function to set the fog scattering coefficient.
 
void SetFogScatteringFromDistance (float distance)
 Function to set the fog scattering coefficient from max visible distance. More...
 
float GetFogScattering ()
 Function to get the fog scattering coefficient.
 
void SetSceneEpsilon (float e)
 Allows setting the scene epsilon used for traversal checks. More...
 
float GetSceneEpsilon ()
 Accessor to the scene epsilon value. More...
 
void AddSprite (std::shared_ptr< ChBody > sprite)
 Add a sprite (a Chrono body that is only used for visualization and does not affect the physics simulation) to the scene. More...
 
void SetSprites (std::vector< std::shared_ptr< ChBody >> sprites)
 
std::shared_ptr< ChBodyGetSprite (int i)
 
std::vector< std::shared_ptr< ChBody > > GetSprites ()
 
void UpdateOriginOffset (ChVector3f sensor_pos, bool force=false)
 Function to change the origin offset if necessary. More...
 
bool GetOriginChanged ()
 
void ResetOriginChanged ()
 
ChVector3f GetOriginOffset ()
 Access function for the origin offset. More...
 
void SetOriginOffsetThreshold (float threshold)
 Set the threshold for moving the origin. More...
 
void EnableDynamicOrigin (bool enable)
 Enable dynamic moving of the scene origin. More...
 

Member Function Documentation

◆ AddDirectionalLight()

CH_SENSOR_API unsigned int chrono::sensor::ChScene::AddDirectionalLight ( ChColor  color,
float  elevation,
float  azimuth 
)

Add a directional light that emits light in a particular direction.

-— Directional light -— ///

Parameters
color[W/m^2] or [lumen/m^2], color irradiance of the light
elevation[rad], elevation angle of the directional light comes from
azimuth[rad], azimuth angle of the directional light comes from
Returns
the index of the light that has been added

◆ AddDiskLight()

CH_SENSOR_API unsigned int chrono::sensor::ChScene::AddDiskLight ( ChVector3f  pos,
ChColor  color,
float  max_range,
ChVector3f  light_dir,
float  radius,
bool  const_color = true 
)

Add a disk light that emits light forward from a circular area.

-— Disk light -— ///

Parameters
pos[m], the world position of the rectangle light
color[W/m^2] or [lumen/m^2], color radiance of the light
max_range[m], range at which the light intensity falls to 1% of its maximum color intensity. If set to -1, follows inverse square law.
light_dirthe direction in which the disk light points (no need to be normalized)
radius[m], radius of the disk light
const_colorwhether to use constant color (no attenuation with distance)
Returns
the index of the added light

◆ AddEnvironmentLight()

CH_SENSOR_API unsigned int chrono::sensor::ChScene::AddEnvironmentLight ( std::string  env_tex_path,
float  intensity_scale = 1.f 
)

Add the environment light that emits light from all directions based on an environment map.

Parameters
env_tex_paththe full path of the environment map texture.
intensity_scalea scale factor for the intensity of the environment light. Default value is 1.0 (no scaling).
Returns
the index of the light that has been added

◆ AddPointLight()

CH_SENSOR_API unsigned int chrono::sensor::ChScene::AddPointLight ( ChVector3f  pos,
ChColor  color,
float  max_range,
bool  const_color = true 
)

Add a point light that emits light in all directions.

Point light ///.

Parameters
posThe world position of the point light
color[W/sr/m^2] or [lumen/sr/m^2], color radiance of the light
max_range[m], range at which the light intensity falls to 1% of its maximum color intensity. If set to -1, follows inverse square law.
Returns
the index of the light that has been added

◆ AddRectangleLight()

CH_SENSOR_API unsigned int chrono::sensor::ChScene::AddRectangleLight ( ChVector3f  pos,
ChColor  color,
float  max_range,
ChVector3f  length_vec,
ChVector3f  width_vec,
bool  const_color = true 
)

Add a rectangle light that emits light forward from a rectangle area.

-— Rectangle light -— ///

Parameters
pos[m], the world position of the rectangle light
color[W/m^2] or [lumen/m^2], color radiance of the light
max_range[m], range at which the light intensity falls to 1% of its maximum color intensity. If set to -1, follows inverse square law.
length_vec[m], one edge vector of the rectangle light
width_vec[m], the other edge vector of the rectangle light perpendicular to length_vec. Light direction is: length_vec x width_vec.
const_colorwhether to use constant color (no attenuation with distance)
Returns
the index of the added light

◆ AddSpotLight()

CH_SENSOR_API unsigned int chrono::sensor::ChScene::AddSpotLight ( ChVector3f  pos,
ChColor  color,
float  max_range,
ChVector3f  light_dir,
float  angle_falloff_start,
float  angle_range,
bool  const_color = true 
)

Add a spot light that emits light in a particular direction.

-— Spot light -— ///

Parameters
posthe world position of the spot light
colorcolor radiance of the light
max_rangerange at which the light intensity falls to 1% of its maximum color intensity. If set to -1, follows inverse square law.
light_dirthe direction in which the spotlight points (no need to be normalized)
angle_falloff_start[m], angle at which the spotlight starts to linearly fall off
angle_range[rad], angle range of the spotlight falling off to zero.
const_colorwhether to use constant color (no attenuation with distance)
Returns
the index of the light that has been added

◆ AddSprite()

CH_SENSOR_API void chrono::sensor::ChScene::AddSprite ( std::shared_ptr< ChBody sprite)

Add a sprite (a Chrono body that is only used for visualization and does not affect the physics simulation) to the scene.

Parameters
spritethe Chrono body to be added as a sprite in the scene

◆ EnableDynamicOrigin()

void chrono::sensor::ChScene::EnableDynamicOrigin ( bool  enable)
inline

Enable dynamic moving of the scene origin.

Parameters
enablewhether to enable to the moving origin

◆ GetAmbientLight()

ChVector3f chrono::sensor::ChScene::GetAmbientLight ( )
inline

Function for setting the ambient light color.

Returns
the ambient light in the scene

◆ GetBackground()

Background chrono::sensor::ChScene::GetBackground ( )
inline

Function for gaining access to the background.

Can be used to dynamically change the background color, or texture

Returns
m_background the background used for rendering

◆ GetLights()

std::vector<ChOptixLight> chrono::sensor::ChScene::GetLights ( )
inline

Function for gaining access to the vector of lights which can be used to modify lighting dynamically.

Returns
A vector of lights in the scene currently

◆ GetOriginOffset()

ChVector3f chrono::sensor::ChScene::GetOriginOffset ( )
inline

Access function for the origin offset.

Returns
the origin offset

◆ GetSceneEpsilon()

float chrono::sensor::ChScene::GetSceneEpsilon ( )
inline

Accessor to the scene epsilon value.

Returns
the scene epsilon

◆ ModifyDirectionalLight()

CH_SENSOR_API void chrono::sensor::ChScene::ModifyDirectionalLight ( unsigned int  light_ID,
const ChOptixLight directional_light 
)

Function for modifying an existing directional light in the scene.

Parameters
light_IDthe index of the directional light to be modified
directional_lightthe new directional light

◆ ModifyDiskLight()

CH_SENSOR_API void chrono::sensor::ChScene::ModifyDiskLight ( unsigned int  light_ID,
const ChOptixLight disk_light 
)

Function for modifying an existing disk light in the scene.

Parameters
light_IDthe index of the disk light to be modified
disk_lightthe new disk light

◆ ModifyPointLight()

CH_SENSOR_API void chrono::sensor::ChScene::ModifyPointLight ( unsigned int  light_ID,
const ChOptixLight point_light 
)

Function for modifying an existing point light in the scene.

Parameters
light_IDthe index of the point light to be modified
point_lightthe new point light

◆ ModifyRectangleLight()

CH_SENSOR_API void chrono::sensor::ChScene::ModifyRectangleLight ( unsigned int  light_ID,
const ChOptixLight rectangle_light 
)

Function for modifying an existing rectangle light in the scene.

Parameters
light_IDthe index of the rectangle light to be modified
rectangle_lightthe new rectangle light

◆ ModifySpotLight()

CH_SENSOR_API void chrono::sensor::ChScene::ModifySpotLight ( unsigned int  light_ID,
const ChOptixLight spot_light 
)

Function for modifying an existing spot light in the scene.

Parameters
light_IDthe index of the spot light to be modified
spot_lightthe new spot light

◆ SetAmbientLight()

void chrono::sensor::ChScene::SetAmbientLight ( ChVector3f  color)
inline

Function for setting the ambient light color.

Parameters
colorthe color+intensity of ambient light

◆ SetBackground()

CH_SENSOR_API void chrono::sensor::ChScene::SetBackground ( Background  b)

Function for gaining access to the background.

Can be used to dynamically change the background color, or texture

Parameters
ba new background for the scene

◆ SetFogScatteringFromDistance()

CH_SENSOR_API void chrono::sensor::ChScene::SetFogScatteringFromDistance ( float  distance)

Function to set the fog scattering coefficient from max visible distance.

Function to set the fog scattering coefficient.

◆ SetOriginOffsetThreshold()

void chrono::sensor::ChScene::SetOriginOffsetThreshold ( float  threshold)
inline

Set the threshold for moving the origin.

Parameters
thresholdthe threshold outside of which to move the scene origin

◆ SetSceneEpsilon()

CH_SENSOR_API void chrono::sensor::ChScene::SetSceneEpsilon ( float  e)

Allows setting the scene epsilon used for traversal checks.

Parameters
ethe epsilon value

◆ UpdateOriginOffset()

void chrono::sensor::ChScene::UpdateOriginOffset ( ChVector3f  sensor_pos,
bool  force = false 
)

Function to change the origin offset if necessary.

Parameters
sensor_posthe position of the sensor
forcewhether to force updating even if threshold is not met

The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono_sensor/optix/scene/ChScene.h
  • /builds/uwsbel/chrono/src/chrono_sensor/optix/scene/ChScene.cpp