keskiviikko 7. maaliskuuta 2012

camera class.. and the tools

Development of bolt has slowed down a bit, as I've been busy at work, and pondering and prototyping the tools (mainly the map editor). I am using Trolltech QT.. some impressive extension to c++, tools and abstractions for fast development for the map tool. First thing I did was the main UI, that is just opengl canvas + a toolbar, Afterwards came the sketching of world classes (World + Tile), which encapsulates the vertexes and polygons for each grid. Each grid stores the polygon & vertex data, created with tools (heightmap tools etc, to ease the sketching of landscape).

At the moment I am trying to solve the camera abstraction.. Many have solved it with using gluLookAt style solutions ( LeoLol java engine, camera class , three.js src ), one UP vector, one FORWARD vector and one RIGHT vector, that can be easily used to rotate and move the camera. The nice thing about these vectors is, that strafing the camera, is as easy as to add the result from multiplying RIGHT vector with the strafing movement speed. This solution seems to be quite popular, it is even directly in some graphics api (M3G , glut) and, it works.. But for my needs, I see this kind of structure, too complicated.. 
First I was going to just store the camera as position (Vector3D) + orientation(Quaternion) + projection(Matrix4x4), this approach would make the properties self explanatory, no scaling, no skew, nothing complicated.. but after further analysis, Quaternion needs to be converted into matrix representation for camera strafe/view based movement and for almost everything, the only benefits for Quaternions are size and unbeatable rotation calculations. So because of this, I am leaning on to use of position(Matrix4x4) + projection(Matrix4x4), so that the position will save orientation and location for the camera.

Ei kommentteja:

Lähetä kommentti