hydra-rs 0.0.1

Rust bindings to OpenUSD's Hydra rendering layer: scene-index ingestion, render-delegate enumeration, headless render to RGBA via Storm.
#pragma once

#include "rust/cxx.h"

#include <pxr/imaging/hd/sceneIndex.h>
#include <pxr/usd/usd/stage.h>
#include <pxr/usdImaging/usdImaging/stageSceneIndex.h>

#include <cstddef>
#include <memory>
#include <string>
#include <vector>

namespace hydra_rs {

struct SceneIndex {
    // Owns the UsdStageRefPtr that backs the scene index — the imaging
    // delegate keeps a non-owning reference, so the stage must outlive it.
    pxr::UsdStageRefPtr stage_owner;
    pxr::HdSceneIndexBaseRefPtr scene_index;

    rust::String stage_root() const;
    size_t prim_count() const;
    std::unique_ptr<std::vector<std::string>> prim_paths() const;
};

std::unique_ptr<SceneIndex> populate_from_path(rust::Str usd_path);

// Render delegate plugin IDs registered in this process (e.g.
// "HdStormRendererPlugin"). Querying this triggers plug-registry discovery.
std::unique_ptr<std::vector<std::string>> list_render_delegate_ids();

// Render the stage at `usd_path` to a tightly-packed RGBA8 buffer of size
// width*height*4. `render_delegate_id` may be empty for the default (Storm).
// Throws on construction or render failure. The camera is a hardcoded free
// camera at (5, 5, 5) looking at origin with a 45° vertical FOV — for now.
std::unique_ptr<std::vector<uint8_t>> render_to_rgba(
    rust::Str usd_path,
    rust::Str render_delegate_id,
    uint32_t width,
    uint32_t height);

}  // namespace hydra_rs