Python bindings for SlamDunk
Project description
SlamDunk is a simple and user-friendly C++ library for making live 3D and 2D visualizations for prototyping, data exploration, and algorithm development.
It is very lightweight, built using OpenGL and ImGui.
The project is in very early development with many improvements coming in the near future.
Examples
Hello world
Here is a simple "hello world" program for a SlamDunk visualization.
#include <slamd/slamd.hpp>
int main() {
slamd::Window window("Hello world", 1000, 1000);
auto scene = slamd::scene();
scene->set_object("/origin", slamd::geom::triad());
window.add_scene("scene", scene);
window.wait_for_close();
}
This example highlights the main components of SlamDunk.
- The
Windowobject handles the actual display window. - A
Sceneobject represents and contains a tree of 3D objects. Geometryobjects can be added toScenes with a path in the tree.- To display a scene, we must add it to the window - this creates a view of the scene.
Running this program results in the following interactive visualization:
Multiple scenes
We use ImGui to allow multiple sub-windows with floating and docking support inside the SlamDunk viewer. The following example illustrates creating two windows, each showing its own scene.
#include <glm/glm.hpp>
#include <slamd/slamd.hpp>
int main() {
slamd::Window window("two windows", 1000, 1000);
auto scene1 = slamd::scene();
auto scene2 = slamd::scene();
window.add_scene("scene 1", scene1);
scene1->set_object("/box", slamd::geom::box());
window.add_scene("scene 2", scene2);
scene2->set_object("/origin", slamd::geom::triad());
scene2->set_object("/ball", slamd::geom::sphere(2.0f));
glm::mat4 sphere_transform(1.0);
sphere_transform[3] += glm::vec4(5.0, 1.0, 2.0, 1.0);
scene2->set_transform("/ball", sphere_transform);
window.wait_for_close();
}
The resulting window looks like this:
The windows are fully controllable - you can drag then around, make tabs, use them in floating mode, dock them to the sides like you see in the screenshot. All of this is supported by ImGui.
Further reading
The examples in the /examples folder showcase some more features of SlamDunk, like
- Canvases for 2D visualizations
- Multiple views of the same scene
- Moving objects around.
- Taking control of the render loop to create fully-fletced GUIs around SlamDunk using the power of ImGui.
Installation
If you are not using a package manager, the SlamDunk requires the following dependencies available in your build system:
With FetchContent
You can use CMake's FetchContent. Add this to your CMakeLists.txt:
include(FetchContent)
FetchContent_Declare(
MyCoolLib
GIT_REPOSITORY https://github.com/you/yourproject.git
GIT_TAG main
SOURCE_SUBDIR mylib
)
FetchContent_MakeAvailable(MyCoolLib)
Linking to it then looks like:
target_link_libraries(
your_target PRIVATE
slamd::slamd
)
With git submodules
If you add the repo as a submodule in your project, you can add it as a subdirectory with
add_subdirectory(path/to/slam_dunk/slamd)
You can then link it to your executable or library with
target_link_libraries(
your_target PRIVATE
slamd::slamd
)
With vcpkg
We are currently working on a vcpkg port for SlamDunk, stay tuned!
Contributions
All contributions are welcome! SlamDunk is in very early development, so there is enough work to do, and multiple things to improve.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file slamd-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: slamd-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 48.2 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1d4ccddffc01333b26e6beedb11678e913587d6a7d9fb7aca1741a785f25772
|
|
| MD5 |
f57ea5fd9a655d9de6a6a0bd89c67d68
|
|
| BLAKE2b-256 |
abdfba431fc3a3a394053b612ece041a65820933a41a91e591b52e1a24d021a1
|
Provenance
The following attestation bundles were made for slamd-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl:
Publisher:
pip_publish.yml on Robertleoj/slam_dunk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
slamd-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl -
Subject digest:
a1d4ccddffc01333b26e6beedb11678e913587d6a7d9fb7aca1741a785f25772 - Sigstore transparency entry: 195861112
- Sigstore integration time:
-
Permalink:
Robertleoj/slam_dunk@aaa54686f17f8908a1b4af96c2c8c163c4c5afb8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Robertleoj
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pip_publish.yml@aaa54686f17f8908a1b4af96c2c8c163c4c5afb8 -
Trigger Event:
push
-
Statement type: