Skip to content

raisin::assimp ​

namespace

Classes ​

  • struct AsyncModelLoadResult — Assimp import produced by loadModelSceneAsync(), before GL resources exist.
  • struct FallbackMaterial — Material read from an OBJ's sibling .mtl file, used when Assimp provides none.
  • struct ModelSourceFile — A file a model import read (or looked for), as it was at that point.

Functions ​

isUsdModelFile ​

#include <rayrai/AssimpMeshLoader.hpp>

cpp
bool isUsdModelFile(const std::string &path)

Returns True for .usd, .usda, .usdc and .usdz paths (case-insensitive extension).

loadModelSceneAsync ​

#include <rayrai/AssimpMeshLoader.hpp>

cpp
std::future<AsyncModelLoadResult> loadModelSceneAsync(const std::string &path)

Run the Assimp import of path on a new thread (no GL calls). USD files are not handled here; use loadModel() for them.

importedTexturesDecoded ​

#include <rayrai/AssimpMeshLoader.hpp>

cpp
bool importedTexturesDecoded(const AsyncModelLoadResult &imported)

True when the texture files an import queued for background decoding are all decoded (or were never queued), so finishing it decodes no image on the calling thread. Never waits.

finishImportedModelScene ​

#include <rayrai/AssimpMeshLoader.hpp>

cpp
std::shared_ptr<std::vector<std::shared_ptr<OpenGLMesh>>> finishImportedModelScene(AsyncModelLoadResult &imported)

Convert an import into meshes, resolving materials/textures and merging compatible meshes. Needs the render context.

Exceptions

ExceptionDescription
std::runtime_errorif the import failed or is empty.

prepareImportedModelScene ​

#include <rayrai/AssimpMeshLoader.hpp>

cpp
std::shared_ptr<std::vector<std::shared_ptr<OpenGLMesh>>> prepareImportedModelScene(AsyncModelLoadResult &imported)

Like finishImportedModelScene() but defers geometry preparation to prepareImportedModelGeometry(). Material/texture resolution requires the render context; geometry remains CPU-only.

prepareImportedModelGeometry ​

#include <rayrai/AssimpMeshLoader.hpp>

cpp
void prepareImportedModelGeometry(
    std::vector<std::shared_ptr<OpenGLMesh>> &meshes,
    const std::string &path)

Worker stage: optimize geometry, compute tangents, and merge compatible meshes.

loadModel ​

#include <rayrai/AssimpMeshLoader.hpp>

cpp
std::shared_ptr<std::vector<std::shared_ptr<OpenGLMesh>>> loadModel(const std::string &path)

Load a model synchronously (Assimp formats and USD).

Exceptions

ExceptionDescription
std::runtime_errorif the file cannot be loaded.
cpp
std::shared_ptr<std::vector<std::shared_ptr<OpenGLMesh>>> loadModel(
    const std::string &path,
    std::vector<ModelSourceFile> &sourceFiles)

loadModel(), also returning the files the import read (just the model for USD).

loadSceneLights ​

#include <rayrai/AssimpMeshLoader.hpp>

cpp
std::vector<AdditionalLight> loadSceneLights(
    const std::string &path,
    float intensityScale=1.0f)

Read authored lights (glTF KHR_lights_punctual, a rayrai light sidecar, or Assimp scene lights) as viewer lights. Lights are not added automatically.

Parameters

ParameterDescription
pathModel file.
intensityScaleMultiplier applied to light intensities.

Returns Converted lights (empty if none).

Exceptions

ExceptionDescription
std::runtime_errorif a binary glTF envelope is malformed.

RaiSim — physics for robotics and AI.