Python bindings for SlamDunk
Project description
SlamDunk is a powerful and user-friendly C++/Python 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.
#python
import slamd
if __name__ == "__main__":
vis = slamd.Visualizer("Hello world")
scene = slamd.Scene()
scene.set_object("/origin", slamd.geom.Triad())
vis.add_scene("scene", scene)
vis.hang_forever()
// C++
#include <slamd/slamd.hpp>
int main() {
auto vis = slamd::visualizer("hello_world");
auto scene = slamd::scene();
scene->set_object("/origin", slamd::geom::triad());
vis->add_scene("scene", scene);
vis->hang_forever();
}
This example highlights the main components of SlamDunk.
- The
Visualizerobject maintains the state of the visualization. It starts a TCP server, and spawns a viewer process that reads from it and displays the visualizations. - 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 visualizer - 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.
# python
import slamd
import numpy as np
if __name__ == "__main__":
vis = slamd.Visualizer("two windows")
scene1 = slamd.Scene()
scene2 = slamd.Scene()
vis.add_scene("scene 1", scene1)
scene1.set_object("/box", slamd.geom.Box())
vis.add_scene("scene 2", scene2)
scene2.set_object("/origin", slamd.geom.Triad())
scene2.set_object("/ball", slamd.geom.Sphere(2.0))
sphere_transform = np.identity(4, dtype=np.float32)
sphere_transform[:, 3] = np.array([5.0, 1.0, 2.0, 1.0])
scene2.set_transform("/ball", sphere_transform)
vis.hang_forever()
// C++
#include <glm/glm.hpp>
#include <slamd/slamd.hpp>
int main() {
auto vis = slamd::visualizer("two windows");
auto scene1 = slamd::scene();
auto scene2 = slamd::scene();
vis->add_scene("scene 1", scene1);
scene1->set_object("/box", slamd::geom::box());
vis->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);
vis->hang_forever();
}
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
Python
The python binding wheels are available on PyPi, so you can simply
pip install slamd
C++
With FetchContent
You can use CMake's FetchContent. Add this to your CMakeLists.txt:
include(FetchContent)
FetchContent_Declare(
slamd
GIT_REPOSITORY https://github.com/Robertleoj/slam_dunk.git
GIT_TAG main
SOURCE_SUBDIR slamd
)
FetchContent_MakeAvailable(slamd)
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)
Just make sure to
git submodule update --init --recursive
inside the submodule, as all necessary dependencies are vendored.
You can then link it to your executable or library with
target_link_libraries(
your_target PRIVATE
slamd::slamd
)
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 Distributions
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-2.1.2-cp313-cp313-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: slamd-2.1.2-cp313-cp313-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 67.8 MB
- Tags: CPython 3.13, 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 |
aac889a41cb9d014ea65e12235ab799b7b99823e755eac0c8079dc9ed6e37fcf
|
|
| MD5 |
609c93a2485f25a6d1fcccccc8037078
|
|
| BLAKE2b-256 |
d68688bde732a054ba47e8c13f8774cfef2d9d01ebf00831c138f1a72c84f6da
|
Provenance
The following attestation bundles were made for slamd-2.1.2-cp313-cp313-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-2.1.2-cp313-cp313-manylinux_2_28_x86_64.whl -
Subject digest:
aac889a41cb9d014ea65e12235ab799b7b99823e755eac0c8079dc9ed6e37fcf - Sigstore transparency entry: 206668304
- Sigstore integration time:
-
Permalink:
Robertleoj/slam_dunk@472e48ece5a4c2f183dc89a97ece83d55301ad27 -
Branch / Tag:
refs/tags/v2.1.2 - Owner: https://github.com/Robertleoj
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pip_publish.yml@472e48ece5a4c2f183dc89a97ece83d55301ad27 -
Trigger Event:
release
-
Statement type:
File details
Details for the file slamd-2.1.2-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: slamd-2.1.2-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 7.9 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbab12c27eb5b3d8034426d224f26a4c4e33bc0c75be22d5b6898188dfbc2e45
|
|
| MD5 |
943d12f342f3dcd69c454de342a1f6db
|
|
| BLAKE2b-256 |
9f0bbac447350cfc956f15c84b031984e17d16f1bb5a6d48892243695e60070a
|
Provenance
The following attestation bundles were made for slamd-2.1.2-cp313-cp313-macosx_11_0_arm64.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-2.1.2-cp313-cp313-macosx_11_0_arm64.whl -
Subject digest:
dbab12c27eb5b3d8034426d224f26a4c4e33bc0c75be22d5b6898188dfbc2e45 - Sigstore transparency entry: 206668310
- Sigstore integration time:
-
Permalink:
Robertleoj/slam_dunk@472e48ece5a4c2f183dc89a97ece83d55301ad27 -
Branch / Tag:
refs/tags/v2.1.2 - Owner: https://github.com/Robertleoj
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pip_publish.yml@472e48ece5a4c2f183dc89a97ece83d55301ad27 -
Trigger Event:
release
-
Statement type:
File details
Details for the file slamd-2.1.2-cp312-cp312-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: slamd-2.1.2-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 67.8 MB
- Tags: CPython 3.12, 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 |
b077effc7dd479b1a0702f14a88ac5e843f1589f43f5df56c8a595149e5bf2d7
|
|
| MD5 |
afe3a8a8d529641def6968a15546c0cd
|
|
| BLAKE2b-256 |
d6d6216c58d89bcedd69758de0310548d05a93a526d1d55f9c7ea4832568f899
|
Provenance
The following attestation bundles were made for slamd-2.1.2-cp312-cp312-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-2.1.2-cp312-cp312-manylinux_2_28_x86_64.whl -
Subject digest:
b077effc7dd479b1a0702f14a88ac5e843f1589f43f5df56c8a595149e5bf2d7 - Sigstore transparency entry: 206668306
- Sigstore integration time:
-
Permalink:
Robertleoj/slam_dunk@472e48ece5a4c2f183dc89a97ece83d55301ad27 -
Branch / Tag:
refs/tags/v2.1.2 - Owner: https://github.com/Robertleoj
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pip_publish.yml@472e48ece5a4c2f183dc89a97ece83d55301ad27 -
Trigger Event:
release
-
Statement type:
File details
Details for the file slamd-2.1.2-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: slamd-2.1.2-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 7.9 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd0958ce2d68549e96ba8a8b2c156cb4fa84dff38448f325732fddd0cb186843
|
|
| MD5 |
5fe60fcd494369c4750a01c64f515875
|
|
| BLAKE2b-256 |
f2bc8ca8c6061668572df0cb5866f0588eb2eeeae76719d401ea25bb6677d6bb
|
Provenance
The following attestation bundles were made for slamd-2.1.2-cp312-cp312-macosx_11_0_arm64.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-2.1.2-cp312-cp312-macosx_11_0_arm64.whl -
Subject digest:
cd0958ce2d68549e96ba8a8b2c156cb4fa84dff38448f325732fddd0cb186843 - Sigstore transparency entry: 206668302
- Sigstore integration time:
-
Permalink:
Robertleoj/slam_dunk@472e48ece5a4c2f183dc89a97ece83d55301ad27 -
Branch / Tag:
refs/tags/v2.1.2 - Owner: https://github.com/Robertleoj
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pip_publish.yml@472e48ece5a4c2f183dc89a97ece83d55301ad27 -
Trigger Event:
release
-
Statement type:
File details
Details for the file slamd-2.1.2-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: slamd-2.1.2-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 67.8 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 |
1f0ccfcdcbca45927c3c2e23b2117b000c26d09371fe0713799a54d7ddd3514e
|
|
| MD5 |
3f640eb71f380242858c379f56f23ff9
|
|
| BLAKE2b-256 |
a1a9d893165699818c2b1ce394975ed7142f3d71dd3c401ad6f1ea38cafa14b6
|
Provenance
The following attestation bundles were made for slamd-2.1.2-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-2.1.2-cp311-cp311-manylinux_2_28_x86_64.whl -
Subject digest:
1f0ccfcdcbca45927c3c2e23b2117b000c26d09371fe0713799a54d7ddd3514e - Sigstore transparency entry: 206668307
- Sigstore integration time:
-
Permalink:
Robertleoj/slam_dunk@472e48ece5a4c2f183dc89a97ece83d55301ad27 -
Branch / Tag:
refs/tags/v2.1.2 - Owner: https://github.com/Robertleoj
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pip_publish.yml@472e48ece5a4c2f183dc89a97ece83d55301ad27 -
Trigger Event:
release
-
Statement type:
File details
Details for the file slamd-2.1.2-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: slamd-2.1.2-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 7.9 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
966c58b1a0dea49b4ac720650a44670cc69b50d21de557d5435cacc3045f41b1
|
|
| MD5 |
810d0e6c926d7291f681cc4722bf3f98
|
|
| BLAKE2b-256 |
3f2678c2066c68630f9471a9c500cf14be816f0101e9e8b1defbb403926e872a
|
Provenance
The following attestation bundles were made for slamd-2.1.2-cp311-cp311-macosx_11_0_arm64.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-2.1.2-cp311-cp311-macosx_11_0_arm64.whl -
Subject digest:
966c58b1a0dea49b4ac720650a44670cc69b50d21de557d5435cacc3045f41b1 - Sigstore transparency entry: 206668305
- Sigstore integration time:
-
Permalink:
Robertleoj/slam_dunk@472e48ece5a4c2f183dc89a97ece83d55301ad27 -
Branch / Tag:
refs/tags/v2.1.2 - Owner: https://github.com/Robertleoj
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pip_publish.yml@472e48ece5a4c2f183dc89a97ece83d55301ad27 -
Trigger Event:
release
-
Statement type: