Skip to content

A thin abstraction layer to integrate Bullet and OpenSceneGraph

License

Notifications You must be signed in to change notification settings

miguelleitao/btosg

Repository files navigation

Build Status Documentation DOI

btosg

A thin abstraction layer to integrate Bullet and OpenSceneGraph.

Description

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

OpenSceneGraph:

Bullet:

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

Build

git clone https://github.com/miguelleitao/btosg.git
cd btosg
make
sudo make install

Usage

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

Documentation

The btosg reference documentation can be browsed online from both:

Examples

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

Referencing

The release version can be referenced by either http://doi.org/ctz5 or doi:10.5281/zenodo.1283484.