GUI-like events for Open Scene Graph nodes
OSGUIsh is a library that generates GUI-like events for nodes in an OSG scene graph. So, a programmer can install callbacks that are executed when the mouse moves over a node, or when it is clicked, or double-clicked, or the mouse wheel moves, or… you got the idea. The following snippet gives a taste of OSGUIsh:
// First you define a callback
void HandleClick(OSGUIsh::HandlerParams& params)
{
std::cout << "Click on node '" << params.node << "'!\n";
}
// Later, you connect the events to the callbacks
osgViewer::Viewer viewer;
osg::ref_ptr<OSGUIsh::EventHandler> guishEH(
new OSGUIsh::EventHandler());
viewer.addEventHandler(guishEH);
osg::ref_ptr<osg::Node> loadedModel =
osgDB::readNodeFile("Some3DModel.obj");
guishEH->addNode(loadedModel);
guishEH->getSignal(loadedModel, "Click")->connect(&HandleClick);
Some OSGUIsh features are:
- Support for the following events: “mouse enter”, “mouse leave”, “mouse move”, “mouse down”, “mouse up”, “click”, “double click”, “mouse wheel up”, “mouse wheel down”, “key up” and “key down”
- Supports differents policies to determine which node gets mouse wheel and keyboard events.
- Works even when using HUDs (node masks needs to be used in this case).
Assorted facts about OSGUIsh
OSGUIsh…
- Is somewhat documented, but there is no user’s guide yet. Take a look on the demos on the source distribution for some working examples.
- Is still in the early stages of development. I used it in a couple of small projects only, so it tends to not be updated very regularly. Anyway, the codebase is small, and should not be hard to understand.
- Was tested both under Linux with GCC 4.x and under Windows with Visual Studio 2008.
- Depends on the Open Scene Graph and Boost (it is based on Boost.Signals).
- Has a build system based on CMake, but I strongly recommend to add OSUIsh source files directly to your own projects.
- Is distributed under the OSGPL license (the same as the Open Scene Graph).
- Has one of the worst names I could think.
Latest release
OSGUIsh 0.3.1, released on 02010-07-22. Available here: OSGUIsh-0.3.1.tar.gz. Highlights of this release:
- This release brought OSGUIsh up-to-date with newer versions of the Open Scene Graph (2.8.x).
Donate
Liked OSGUIsh? What about a tip? Any amount will make my day. Donation is handled by PayPal. It is safe and you don’t need a PayPal account.
Old releases
OSGUIsh 0.2, released on 02006-10-20. Available here: OSGUIsh-0.2.tar.gz. Highlights of this release:
- Added a new picking scheme, with multiple “picking roots”. Can be used to fix problems with picking with multiple CameraNodes. That’s the case when using HUDs, for example.
- Added an option to ignore back faces when picking.
- Event handlers now take all their parameters as a single (struct) parameter. This will make the interface a little more stable, at least until I decide to make more radical changes to it.
- Added a quick and dirty Makefile for Linux systems using g++, just for convenience. The official build system is still based on SCons. This makefile will just compile the library (not the demos).
- Assorted code clean-ups, bug fixes, typo corrections and documentation improvements. (But still missing a user’s guide.
OSGUIsh 0.1, released on 02006-09-27. Available here: OSGUIsh-0.1.tar.gz. Highlights of this release:
- The first public release.
Contact
OSGUIsh is developed by Leandro Motta Barros. You can view my contact information in the About page.