Skip to content

raisim::rscene ​

namespace

Classes ​

  • struct Asset — An asset record: the default material of objects placed from it. It creates nothing.
  • struct Camera — A camera looks along its local +X axis with local +Z up.
  • struct CoacdSettings — CoACD convex decomposition settings for MeshCollision::Convexify (see raisim::CoacdOptions).
  • struct Color — An RGBA color with components in [0, 1].
  • struct ContactMaterial — A contact_material record: the material-pair properties of two RaiSim contact materials, passed to World::setMaterialPairProp() in this order.
  • struct InstancedVisual — A batch of instanced visuals (render only; no physics).
  • struct Light — A light (render settings, interpreted by a viewer).
  • struct LocalFog — A spherical volume of local fog (render settings). Only enabled volumes are loaded.
  • struct Material — A render material.
  • struct Object — A scene object (one object record).
  • struct Physics — Solver settings from the time_step, gravity, solver and contact_material records. applyPhysics() applies them.
  • struct Quat — A quaternion stored as (w, x, y, z).
  • class Record — One line of the file.
  • struct ReflectionProbe — A reflection probe (render settings). Only enabled probes are loaded.
  • struct Scene — A parsed .rscene file (see load()).
  • struct Terrain — A sampled height-map terrain region.
  • struct TerrainFoliageLayer — A foliage layer scattered over a terrain by a viewer (terrain_foliage_layer).
  • struct TerrainSplatLayer — A per-sample weight map that blends one terrain texture layer (terrain_splat_layer).
  • struct TerrainTexture — A terrain texture layer (render settings, interpreted by a viewer).
  • struct TextureTransform — A texture's UV transform (scale, offset, rotation in radians).
  • struct Transform — A node transform as stored in the file.
  • struct Vec2 — A 2D vector (x, y).
  • struct Vec3 — A 3D vector (x, y, z).
  • struct VisualSettings — Settings of a visual a viewer draws for an object (the object record's visual* keys).
  • struct Wire — A distance constraint between two bodies (wire record), added with World::addSpatialTendon() as Engine 2 does.
  • struct WorldReport — Bodies created by addToWorld.

Enumerations ​

Shape ​

#include <raisim/Rscene.hpp>

cpp
enum class Shape

Primitive type of a scene Object, as built by addToWorld(): Ground (static infinite plane at transform.position.z), Box (full side lengths = transform.scale), Sphere (radius * scale.x), Cylinder and Capsule (radius * scale.x, height * scale.z), Mesh (a .rasset descriptor, or a mesh file with a mesh collision mode, scaled by the mean of transform.scale).

Enumerator
Ground
Box
Sphere
Cylinder
Capsule
Mesh

BodyMode ​

#include <raisim/Rscene.hpp>

cpp
enum class BodyMode

Physics body mode of a scene Object; maps to BodyType::STATIC, KINEMATIC and DYNAMIC. A VisualOnly object has no physics body; a viewer draws it.

Enumerator
Static
Kinematic
Dynamic
VisualOnly

MeshCollision ​

#include <raisim/Rscene.hpp>

cpp
enum class MeshCollision

How a mesh file becomes a collision body (see World::addMesh()).

Enumerator
ConvexHull
OriginalMesh
Convexify

LightType ​

#include <raisim/Rscene.hpp>

cpp
enum class LightType

Light kinds.

Enumerator
Directional
Point
Spot
Area

Functions ​

load ​

#include <raisim/Rscene.hpp>

cpp
Scene load(const std::filesystem::path &file)

Parses a scene file; throws std::runtime_error on unsupported content. The file must start with the header "raisim_engine_scene 1" or "raisim_engine_scene 2"; lines starting with '#' are comments. In version 2, asset_root is relative to the scene file's directory. A version-1 file may only use asset_root "." because Engine 2 resolved a version-1 asset_root against its project root when the scene was in a project. Error messages name the file and line.

Parameters

ParameterDescription
file (in)path to the .rscene file

Returns the parsed scene

applyPhysics ​

#include <raisim/Rscene.hpp>

cpp
void applyPhysics(const Physics &physics, World &world)

Applies the scene's solver settings and contact materials to the world.

Parameters

ParameterDescription
physics (in)solver settings
world (in, out)world to configure

addToWorld ​

#include <raisim/Rscene.hpp>

cpp
WorldReport addToWorld(const Scene &scene, World &world)

Applies the solver settings and adds the terrain, the bodies and the wires. Terrains become static height maps in collision group 1 << 63 colliding with everything. Visual-only objects get no body. Throws std::runtime_error for a non-static .rasset object, a missing mesh file or a wire whose body has no physics body. Non-uniform .rasset scale uses its mean for the collision proxies.

Parameters

ParameterDescription
scene (in)parsed scene
world (in, out)world to populate

Returns the created bodies

forEachFileReference ​

#include <raisim/Rscene.hpp>

cpp
void forEachFileReference(
    Scene &scene,
    const std::function<void(std::string &reference)> &visit)

Calls visit once for each file reference the scene stores, as written in the file (before Scene::resolve()): mesh paths of objects, instanced visuals and foliage layers, terrain texture images, material and light textures, per-object environment images and the environment record's HDR map. Empty references are skipped. visit may rewrite a reference, e.g. to point an absolute path at a local copy.

Parameters

ParameterDescription
scene (in, out)parsed scene
visit (in)called with each non-empty reference

referencedFiles ​

#include <raisim/Rscene.hpp>

cpp
std::vector<std::filesystem::path> referencedFiles(const Scene &scene)

Every file that RaiSim or a viewer reads for the scene, as absolute paths in lexically normal form, sorted and without duplicates. The list holds the scene file, each existing file the scene references (see forEachFileReference(); resolved with Scene::resolve()), the visual and collision meshes of .rasset descriptors, the buffers and images that a glTF, GLB, OBJ (through its .mtl files) or COLLADA mesh references, and the images in a mesh's texture folders (textures, materials and materials/textures, recursively), which rayrai picks up for a mesh whose materials name no texture. A reference to a missing file or a malformed .rasset descriptor is left out, so loading the scene reports it. Scenes and their dependencies are trusted input: references may name files outside the scene directory. Enable server file sharing only for scenes whose referenced files may be shared with the viewer. Filename extensions do not establish file confidentiality.

Parameters

ParameterDescription
scene (in)parsed scene

Returns the files

Variables ​

kFormatVersion ​

#include <raisim/Rscene.hpp>

cpp
constexpr int kFormatVersion

The newest format version this reader understands (see load()).

RaiSim — physics for robotics and AI.