Skip to content

EntropyCanvas::UsdMeshExtractor

Extracts mesh geometry from USD stages and files. More…

#include <UsdMeshExtractor.h>

Name
structOptions
Extraction options.
Name
MeshExtractionResultextractFromStage(const pxr::UsdStageRefPtr & stage, const Options & options =defaultOptions()) =default
Extract meshes from an existing USD stage.
MeshExtractionResultextractFromMemory(std::span< const uint8_t > data, const std::string & formatHint =“.usdc”, const Options & options =defaultOptions()) =default
Extract meshes from in-memory USD data.
MeshExtractionResultextractFromFile(const std::string & filePath, const Options & options =defaultOptions()) =default
Extract meshes from a USD file.
OptionsdefaultOptions()
Get default extraction options.
class EntropyCanvas::UsdMeshExtractor;

Extracts mesh geometry from USD stages and files.

UsdMeshExtractor traverses USD stages and extracts UsdGeomMesh prims, converting them to a render-ready format (triangulated, indexed).

Features:

  • Triangulates n-gon faces
  • Extracts positions, normals, UVs
  • Computes bounds
  • Handles face-varying primvars

Usage: // From in-memory bytes (e.g., from asset system) auto result = UsdMeshExtractor::extractFromMemory(bytes, “.usdc”);

// From existing stage auto result = UsdMeshExtractor::extractFromStage(stagePtr);

// From file path auto result = UsdMeshExtractor::extractFromFile(“/path/to/mesh.usd”);

static MeshExtractionResult extractFromStage(
const pxr::UsdStageRefPtr & stage,
const Options & options =defaultOptions()
) =default

Extract meshes from an existing USD stage.

Parameters:

  • stage USD stage pointer
  • options Extraction options

Return: Extraction result with mesh data

static MeshExtractionResult extractFromMemory(
std::span< const uint8_t > data,
const std::string & formatHint =".usdc",
const Options & options =defaultOptions()
) =default

Extract meshes from in-memory USD data.

Parameters:

  • data Raw USD file bytes (.usd, .usda, .usdc)
  • formatHint File extension hint (e.g., “.usdc”, “.usda”)
  • options Extraction options

Return: Extraction result with mesh data

static MeshExtractionResult extractFromFile(
const std::string & filePath,
const Options & options =defaultOptions()
) =default

Extract meshes from a USD file.

Parameters:

  • filePath Path to USD file
  • options Extraction options

Return: Extraction result with mesh data

static inline Options defaultOptions()

Get default extraction options.


Updated on 2026-01-26 at 16:50:32 -0500