A thin abstraction layer to integrate Bullet and OpenSceneGraph.
btosg is aimed to ease building simple visual simulation applications integrating Bullet and OpenSceneGraph. btosg stands on top of these two APIs but does not try to hide them. Instead, in order to build a complete application, the programmer is able and usually needs to access directly the data structures from both Bullet and OpenSceneGraph. So, the use of btosg does not avoid the requirement to know and understand their APIs.
The use of btosg can help the programming task because it allows to create and position both the physical and graphics definitions of small objects in one step. It also keeps track of syncronizing the graphics definitions from the state of each physical object.
Dependencies can be installed on Fedora Linux using:
dnf install gcc-c++ mesa-libGL-devel
dnf install bullet bullet-devel OpenSceneGraph OpenSceneGraph-devel
Dependencies can be installed on Ubuntu using:
apt install libbullet-dev openscenegraph libopenscenegraph-dev
git clone https://github.com/miguelleitao/btosg.git
cd btosg
make
sudo make install
Look at provided examples. Prepare your application.cpp using
#include <btosg.h>
Compile using
g++ -c -I path/to/btosg/dir application.cpp g++ -o application -L path/to/btosg/dir/lib -l btosg application.o
Or, if you completed installation using make install
:
g++ -c `pkg-config --cflags btosg` application.cpp g++ -o application `pkg-config --libs btosg` application.o
The btosg reference documentation can be browsed online from both:
btosg is available with some working examples.
- ball.cpp implements a simple simulation of a ball with two planes.
- objects.cpp provides an example for creating a complete object (graphical and physical) from loading an external Wavefront OBJ file.
- car.cpp implements a basic vehicle with four wheels and suspensions. It can be compiled using a Z or Y pointing up vector.
- hpr_test.cpp test object orientation methods
- heighfield simple simulation using a heightfield colision structure. Usage instructions are provided in source files.
To compile and try the provided examples do:
make Examples
./examples/ball
./examples/objects
./examples/hpr_test
./examples/heightfield
./examples/heightfield img/spiral_c.png
./examples/carZ
./examples/carY
Set LD_LIBRARY_PATH if you did not install btosg libraries previously with make install
. Example:
LD_LIBRARY_PATH=. ./examples/ball
The release version can be referenced by either http://doi.org/ctz5 or doi:10.5281/zenodo.1283484.