Skip to content

hamataku/LiVision

Repository files navigation

LiVision

LiVision is a lightweight C++ 3D visualizer for rapid prototyping with ImGui and ImPlot.

PPA liblivision-dev build

✨ Features

  • 🧪 Rapid Prototyping: Fast setup for visual experiments and ideas.
  • 🔷 Primitive-Rich Drawing: Plane, box, sphere, cylinder, cone, and more.
  • 🗂️ Container-Based Group Control: Move/transform multiple objects together.
  • 🌐 3D Object Coverage: Meshes, models, and SDF-based objects.
  • 📊 ImGui + ImPlot UI: Quick interactive tools and plotting dashboards.

🚀 Quick Start

📦 Installation

Install from PPA

sudo add-apt-repository ppa:hamatakuzaq/livision
sudo apt update
sudo apt install -y liblivision-dev

Install from source

sudo apt update
sudo apt install -y \
  build-essential \
  cmake \
  pkg-config \
  git \
  libsdl2-dev \
  libeigen3-dev \
  libsdformat14-dev \
  libassimp-dev \
  libcurl4-openssl-dev

git clone https://github.com/hamataku/LiVision.git --recursive
mkdir -p LiVision/build && cd LiVision/build
cmake ..
make -j"$(nproc)"
sudo make install

🛠️ CMake Example

# Find package
find_package(livision REQUIRED)

# Add include dirs and link libraries
add_executable(your_program
  src/your_program.cpp
)
target_link_libraries(your_program
  livision::livision
)

💻 Example Program

#include "livision/Viewer.hpp"
#include "livision/marker/Grid.hpp"
#include "livision/object/primitives.hpp"

int main() {
  auto viewer = livision::Viewer::Instance({
      .width = 1280,
      .height = 720,
  });

  // UI callback
  float theta = 0;
  viewer->RegisterUICallback([&]() {
    ImGui::SliderFloat("theta", &theta, 0, M_PI * 2.0F);
    if (ImGui::Button("Close")) {
      viewer->Close();
    }
  });

  // Grid
  auto grid = livision::Grid::Instance({.scale = {15.0, 15.0, 0.0}});
  grid->SetResolution(1.0)->SetColor(livision::color::dark_gray);
  viewer->AddObject(grid);

  // Sphere
  auto sphere =
      livision::Sphere::Instance({.pos = {0.0, 0.0, 0.0},
                                  .scale = {2.0, 2.0, 2.0},
                                  .color = livision::color::rainbow_z,
                                  .wire_color = livision::color::black});
  viewer->AddObject(sphere);

  while (viewer->SpinOnce()) {
    sphere->SetRadRotation({0, 0, theta});
  }
  return 0;
}

📄 License

MIT. See LICENSE. Third-party notices are listed in NOTICE.

🙏 Special thanks to koide3/iridescene, which greatly inspired this project.

About

Object-based 3D visualizer for rapid prototyping (C++)

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors