コンテンツにスキップ

基本操作

ビューワーインスタンスの作成

auto viewer = livision::Viewer::Instance({
    .headless = false,
    .vsync = true,
    .width = 1280,
    .height = 720,
});

オブジェクトの登録

AddObjectstd::shared_ptr<ObjectBase> のみ受け取ります。

auto sphere = livision::Sphere::Instance(
    {.pos = {0.0, 0.0, 1.0}, .scale = {2.0, 2.0, 2.0}});
sphere->SetColor(livision::color::cyan)->SetWireColor(livision::color::black);
viewer->AddObject(sphere);

ImGuiコールバックの登録

viewer->RegisterUICallback([&]() {
  if (ImGui::Button("Close")) {
    viewer->Close();
  }
});

メインループ

while (viewer->SpinOnce()) {
  // ここでオブジェクト状態を更新
}