Coding and Design philosophy         A quick guide to some design issues. What to use when
Print

- A quick guide to some design issues. What to use when. Please contribute!

Class inheritence

  • http://www.users.on.net/~edan/misc/ogre_classviz_nodeps.gif(external link) Here's a diagram showing inheritance. Might make some things clearer.
  • Although Ogre is a SceneGraph, it's not a strict one. Light, Camera and few things aren't inherited from node. They don't need to be attached to a scenenode (although they can be). This is for convenience and speed.

 

Custom objects

- Use Movable Object Factories when creating reusable custom objects. eg Particle systems, water meshes (eg current water demo would be nice to rewrite as a movable)

  • this allows easy creation and management in Ogre
  • easy to modularise and reuse
  • please wiki any nice custom objects! :-)

 

Scene managers

- Write a custom scene manager when you require unique scene management.

  • eg existing BSP, Octree culling managers
  • custom SM's are rarely needed. Octree is a good default for alot of cases.
  • multiple scenemanagers can't be run in the same scene (eg terrain and bsp)

 

Scene definition

- Or level/scene design

  • common solution is the dotScene xml format (search wiki)
  • most modellers can export whole scenes to this format, while also exporting the actual meshes
  • example dotScene implementations are in 'ogreAddons' in CVS

 

Main loop/Initialisation

  • You don't need to use FrameListeners for updating every frame. You can call the render loop manually from a 'normal' while loop if you like.
  • You don't need to use ExampleApplication like all the demos use. This either helps or hinders new people. See these examples for alternatives and a clear understanding of what ogre needs to initialise.

Nice clean example. Uses Framelisteners for render updates
'Hello World' example(external link)
Manual render loop example - windows only
Replacement ExampleApp to inherit new apps from(external link)
A complete framework tying alot of libraries together(external link)


Alias: Coding&Design philosophy?


Contributors to this page: manski549 points  , rafa.gdev55 points  and jacmoe133512 points  .
Page last modified on Tuesday 06 of July, 2010 09:34:50 UTC by manski549 points .


The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.
As an exception, any source code contributed within the content is released into the Public Domain.