raisim::rscene
namespace
Classes
structAsset — An asset record: the default material of objects placed from it. It creates nothing.structCamera — A camera looks along its local +X axis with local +Z up.structCoacdSettings — CoACD convex decomposition settings for MeshCollision::Convexify (see raisim::CoacdOptions).structColor — An RGBA color with components in [0, 1].structContactMaterial — A contact_material record: the material-pair properties of two RaiSim contact materials, passed to World::setMaterialPairProp() in this order.structInstancedVisual — A batch of instanced visuals (render only; no physics).structLight — A light (render settings, interpreted by a viewer).structLocalFog — A spherical volume of local fog (render settings). Only enabled volumes are loaded.structMaterial — A render material.structObject — A scene object (one object record).structPhysics — Solver settings from the time_step, gravity, solver and contact_material records. applyPhysics() applies them.structQuat — A quaternion stored as (w, x, y, z).classRecord — One line of the file.structReflectionProbe — A reflection probe (render settings). Only enabled probes are loaded.structScene — A parsed .rscene file (see load()).structTerrain — A sampled height-map terrain region.structTerrainFoliageLayer — A foliage layer scattered over a terrain by a viewer (terrain_foliage_layer).structTerrainSplatLayer — A per-sample weight map that blends one terrain texture layer (terrain_splat_layer).structTerrainTexture — A terrain texture layer (render settings, interpreted by a viewer).structTextureTransform — A texture's UV transform (scale, offset, rotation in radians).structTransform — A node transform as stored in the file.structVec2 — A 2D vector (x, y).structVec3 — A 3D vector (x, y, z).structVisualSettings — Settings of a visual a viewer draws for an object (the object record's visual* keys).structWire — A distance constraint between two bodies (wire record), added with World::addSpatialTendon() as Engine 2 does.structWorldReport — Bodies created by addToWorld.
Enumerations
Shape
#include <raisim/Rscene.hpp>
enum class ShapePrimitive 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>
enum class BodyModePhysics 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>
enum class MeshCollisionHow a mesh file becomes a collision body (see World::addMesh()).
| Enumerator |
|---|
ConvexHull |
OriginalMesh |
Convexify |
LightType
#include <raisim/Rscene.hpp>
enum class LightTypeLight kinds.
| Enumerator |
|---|
Directional |
Point |
Spot |
Area |
Functions
load
#include <raisim/Rscene.hpp>
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
| Parameter | Description |
|---|---|
file (in) | path to the .rscene file |
Returns the parsed scene
applyPhysics
#include <raisim/Rscene.hpp>
void applyPhysics(const Physics &physics, World &world)Applies the scene's solver settings and contact materials to the world.
Parameters
| Parameter | Description |
|---|---|
physics (in) | solver settings |
world (in, out) | world to configure |
addToWorld
#include <raisim/Rscene.hpp>
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
| Parameter | Description |
|---|---|
scene (in) | parsed scene |
world (in, out) | world to populate |
Returns the created bodies
forEachFileReference
#include <raisim/Rscene.hpp>
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
| Parameter | Description |
|---|---|
scene (in, out) | parsed scene |
visit (in) | called with each non-empty reference |
referencedFiles
#include <raisim/Rscene.hpp>
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
| Parameter | Description |
|---|---|
scene (in) | parsed scene |
Returns the files
Variables
kFormatVersion
#include <raisim/Rscene.hpp>
constexpr int kFormatVersionThe newest format version this reader understands (see load()).