3dmr: a lightweight 3D renderer
3dmr is a general-purpose, lightweight 3D renderer on top of openGL3. It supports many features commonly found in 3D engines such as hierarchical scene layout, custom shaders and materials, partial gltf and openGEX support, keyframed animations with linear and Bézier interpolation, linear transition between animations, character skinning and rigging, etc.
It is written with an emphasis on clarity and transparency. There is no data structure hidden from the user, who is free to tweak the behaviour of the engine down to the openGL calls.
Requirements
OpenGL3 or greater is required. Some additional backends might be added in the future (such as Vulkan and openGL2 for compatibility with older devices), but this is not a priority.
3dmr uses glfw as a backend for window creation/mangement and input handling, although nothing would prevent the user from implementing a different Viewer.
Additionally, if you want to build with openGEX support, you will need liboddl, and if you want to build with glTF support you will need the jansson JSON parsing library.
Install
You can clone the repository here.
You can find various build-time options in the config.mk
file. Comment out the
lines with OPENGEX
and GLTF
to disable their respective support. You can
also change the installation prefix.
Once you’ve configured everything to your needs, type:
make install
By default, 3dmr will be installed in your $HOME/.local
. Since 3dmr
declares itself to the system with the use of pkg-config
, make sure to amend
your $PKG_CONFIG_PATH
to make it aware of the location of 3dmr.pc
. By
default, this will be $HOME/.local/lib
.
Usage
Once properly installed, you can include the headers you need with
#include <3dmr/[header]>
in your source files, and build with
-L<installprefix> -l3dmr
(or whatever the output of pkg-config --libs 3dmr
is).
As is customary with our software, “the code is the documentation”. The header files are kept readable and of reasonable length so that anyone with good notions of C can figure out how to use it.
Looking at examples such as weiqi, 3dsh or
3dmrview
(included in 3dmr) might also help a lot.