The last days I have been working on getting a Graphics Environment for my Toy Physics Engine.
Last December and January I had already fiddled around with excellent engines Ogre (www.ogre3d.org) and Bullet (http://bulletphysics.org/wordpress/), trying to put them to work together.I have a post from february where some simulations on youtube can be seen and some preliminary introductions are made.
However, now I am starting to understand things, and whenever I have the drive to test them always encounter the problem on how visualize them.
So, I came across with Blender (www.blender.org), another fantastic tool, and got surprised to find their Google Summer of Code mentorship for 2010 (http://wiki.blender.org/index.php/Dev:Ref/GSoC/2010/Info).
I have applied for it. Deadline was 9th April, which meant preparing everything in a hurry and some embarrasing trouble with their wiki page (I have already apologised in their bf-commiters mailing list...ooops).
Here is my proposal for such an important event: (http://wiki.blender.org/index.php/User:Ndujar).
Hopefully they find it interesting and contact me to complete it!
In the meantime, I have prepared a short and basic Ogre framework to begin doing some tests.
It is composed of a few files and classes integrating Ogre.
I generated it basically copying, cutting and pasting from the very good tutorials available at the Ogre web page (http://www.ogre3d.org/wiki/index.php/Ogre_Tutorials).
It goes as follows:
The first step is to intall and cofigure Ogre in your computer. This is the best tutorial I found: http://ubuntuforums.org/archive/index.php/t-1148570.html.
Then, using whatever IDE of your taste (I am on EasyEclipse), just get the following files to compile.
The core of the application is the BaseApp object, from which I will later extend further as needed. It is basically in charge of doing everything Ogre requires to be done to put things up in a rendering window.
The BaseFrameListener is another very important piece of code that allows one to control the rendering flow.
In order to manage whatever happens on every rendering step, Ogre provides the FrameListener object.
With the installed package comes an ExampleFrameListener.h file, which overrides the basic Ogre FrameListener and allows for a fairly good control over the inputting devices such as keyboard and mouse.I have slightly customised it for my purposes.
It has been a bit tricky however, and has made my computer crash a few times.
Anyway, here it is, domesticated at last!
Once the beast is under control, the rest is a piece of cake...hehehe...
You can make as many instances of a FrameListener as you need in an Ogre application.
I have chosen to create a separate framelistener for managing whatever goes under the physics, to keep things up neat and tidy.
It is the PhysicsFrameListener class:
The elementary brick on which everything else will be constructed is likely to be called PhysicsEntity.
So I have defined my PhysicsEntity Class.
In this code is still at its very bones, just presenting a couple of functions to make things visible.
Hopefully in the near future some more flesh will get added on it!
Last, but not least, is the main.cpp file, where everything gets blended:
And this is it.Now...Let's get busy!