Class AssimpExporter#

Inheritance Relationships#

Base Type#

Class Documentation#

class AssimpExporter : public Karana::Scene::AbstractExporter#

Exporter implementation backed by the third-party ASSIMP library.

AssimpExporter converts every ScenePartSpec to a triangulated Assimp mesh and writes an Assimp scene to disk. The exporter calls AbstractStaticGeometry::computeMesh() for each geometry, so built-in primitives, height fields, imported meshes, and user-defined static geometry all share the same output path.

Materials are emitted as simple diffuse/specular or PBR-style scalar colors when the selected Assimp format supports them. Texture maps are referenced by filepath when they were created through kdFlex texture cache APIs and Texture::lookupFilepath() or GrayscaleTexture::lookupFilepath() can resolve the source image path.

Public Functions

AssimpExporter()#

Construct an exporter with automatic format detection.

virtual void exportTo(const std::filesystem::path &filename, const std::vector<ScenePartSpec> &parts) override#

Export scene part specifications through Assimp.

Parameters:
  • filename – Destination file. If no explicit format id was configured, the extension is mapped to an Assimp exporter id such as “obj”, “collada”, or “gltf2”.

  • partsScenePartSpec collection to write.

Throws:
  • std::invalid_argument – when the filename has no supported format extension.

  • std::runtime_error – when Assimp rejects or cannot write the scene.

void setFormatId(std::string format_id)#

Set a concrete Assimp format id.

Parameters:

format_id – Assimp exporter id, for example “obj”, “collada”, “gltf2”, or “stl”.

void clearFormatId()#

Clear the concrete Assimp format id and return to extension-based detection.

std::string formatId() const#

Get the configured Assimp format id.

Returns:

The configured format id, or an empty string when extension detection is active.