esp::sim::RenderInstanceHelper class

A helper for adding and posing render asset instances in the Habitat-sim visual scene. They will appear when rendering, e.g. Simulator::drawObservation. A render asset is generally a 3D model file.

The interface here is intentionally minimal to ensure (1) effciency, and (2) that we can easily port the backend to other renderers.

Constructors, destructors, conversion operators

RenderInstanceHelper(Simulator& sim, bool useXYZWOrientations = true)
RenderInstanceHelper constructor.

Public functions

auto AddInstance(const std::string& assetFilepath, int semanticId) -> int
Add an instance of a render asset to the scene. The instance gets an identity pose; change it later using set_world_poses.
void ClearAllInstances()
Remove all instances from the scene.
auto GetNumInstances() -> int
Get the number of instances you've added.
void SetWorldPoses(float* positions, int positionsSize, float* orientations, int orientationsSize)
Set the world poses of all your instances. See the index returned by AddInstance.

Function documentation

esp::sim::RenderInstanceHelper::RenderInstanceHelper(Simulator& sim, bool useXYZWOrientations = true)

RenderInstanceHelper constructor.

Parameters
sim the Habitat-sim instance where you'll render, e.g. Simulator::drawObservation
useXYZWOrientations specify the format of the quaternions you'll pass to set_world_poses later; If use_xyzw_orientations=False, we assume wxyz

int esp::sim::RenderInstanceHelper::AddInstance(const std::string& assetFilepath, int semanticId)

Add an instance of a render asset to the scene. The instance gets an identity pose; change it later using set_world_poses.

Parameters
assetFilepath can be for example a .glb or .obj 3D model file
semanticId used for semantic rendering

void esp::sim::RenderInstanceHelper::SetWorldPoses(float* positions, int positionsSize, float* orientations, int orientationsSize)

Set the world poses of all your instances. See the index returned by AddInstance.

Parameters
positions pointer to position floats
positionsSize number of position floats; must be GetNumInstances() * 3
orientations pointer to rotation quaternion floats, as xyzw or wxyz; See also use_xyzw_orientations in the RenderAssetInstance constructor.
orientationsSize number of orientation floats; must be GetNumInstances() * 4

The raw-pointer interface here is to enable efficient interop with numpy, see SimBindings.cpp.