esp::gfx::Renderer class

Public types

enum class Flag { NoTextures = 1 << 0, VisualizeTexture = 1 << 1, BackgroundRenderer = 1 << 2, LeaveContextWithBackgroundRenderer = 1 << 3, HorizonBasedAmbientOcclusion = 1 << 4 }
using Flags = Corrade::Containers::EnumSet<Flag>

Public static functions

static void setupMagnumFeatures()

Constructors, destructors, conversion operators

Renderer(Flags flags = {}) explicit
Constructor.
Renderer(WindowlessContext* context, Flags flags = {}) explicit
Constructor for when creating a background thread.

Public functions

void draw(RenderCamera& camera, scene::SceneGraph& sceneGraph, RenderCamera::Flags flags = {RenderCamera::Flag::FrustumCulling})
void draw(sensor::VisualSensor& visualSensor, sim::Simulator& sim)
draw the active scene in current sim using the specified visual sensor
void visualize(sensor::VisualSensor& visualSensor, float colorMapOffset, float colorMapScale)
visualize the observation of a non-rgb visual sensor, e.g., depth, semantic
void visualize(sensor::VisualSensor& visualSensor)
visualize the observation of a non-rgb visual sensor, e.g., depth, semantic, using already-specified offset and scale.
void setSemanticVisualizerColormap(Cr::Containers::ArrayView<const Mn::Vector3ub> colorMap)
Sets the colormap for the TextureVisualizerShader used for Semantic Scene rendering. Note, these colors are only used for visualization purposes.
void waitSceneGraph()
Acquires ownership of the scene graph from the background render thread. Will block if needed.
void acquireGlContext()
Acquires the OpenGL context from the background render thread. Will block if needed.
auto wasBackgroundRendererInitialized() const -> bool
Was the background rendering thread ever initialized. Initialization is lazy and done the first time async render jobs are started.
void bindRenderTarget(sensor::VisualSensor& sensor, Flags bindingFlags = {})
Binds a RenderTarget to the sensor.
void applyGaussianFiltering(CubeMap& target, CubeMap& helper, CubeMap::TextureType type)
apply gaussian filtering to source cubemap and store the result in target cubemap

Enum documentation

enum class esp::gfx::Renderer::Flag

Enumerators
NoTextures

No textures for the meshes. Textures take a lot of GPU memory but they are not needed unless we are doing RGB rendering. Note: Cannot set this flag when doing RGB rendering

VisualizeTexture

When binding the render target to a depth or a sementic sensor, setting this flag will give the render target the ability to visualize the depth, or sementic info see bindRenderTarget for more info.

BackgroundRenderer

Use a background renderer to overlap rendering with physics simulation.

LeaveContextWithBackgroundRenderer

Leave the OpenGL context with the background renderer thread after waitDrawJobs. Otherwise the context will be reacquired by the main thread. Enabling this improves performance slightly but makes OpenGL context management more challenging.

This flag only has effect if habitat-sim was built with the BackgroundRenderer and the BackgroundRenderer flag is true.

HorizonBasedAmbientOcclusion

Enable HBAO visual effect that adds soft shadows to corners and crevices.

Function documentation

void esp::gfx::Renderer::draw(sensor::VisualSensor& visualSensor, sim::Simulator& sim)

draw the active scene in current sim using the specified visual sensor

Parameters
visualSensor in visual sensor, from which the observation is obtained
sim in simulator instance

void esp::gfx::Renderer::waitSceneGraph()

Acquires ownership of the scene graph from the background render thread. Will block if needed.

The blocking waiting is guarded by an atomic, so if the main thread already has ownership of the scene graph, this method is lock-free and very cheap.

void esp::gfx::Renderer::acquireGlContext()

Acquires the OpenGL context from the background render thread. Will block if needed.

This method is lock-free if the main thread already has ownership of the OpenGL context.

void esp::gfx::Renderer::bindRenderTarget(sensor::VisualSensor& sensor, Flags bindingFlags = {})

Binds a RenderTarget to the sensor.

Parameters
sensor in the target sensor
bindingFlags in flags, such as to control the bindings

void esp::gfx::Renderer::applyGaussianFiltering(CubeMap& target, CubeMap& helper, CubeMap::TextureType type)

apply gaussian filtering to source cubemap and store the result in target cubemap

Parameters
target in/out target cubemap
helper in/out helper cubemap with the same cube size, and texture type (e.g., color, variance shadow map)
type in cubemap texture type, indicating which texture type the filtering would apply to. It can ONLY be Color