Class 2 - SLCtech.org

advertisement
OGRE 3D
OGRE Design


Use of design patterns

Observer

Singleton

Iterator

Visitor

Façade

Factory
Screen Graph decoupled from Scene
Contents
OGRE Design

Plug-in Architecture

Everything is a plug-in

Co-operating components

No re-building of the library required


“this is what I am called” – “this is what sort of
resource I am here to handle”
RUN-TIME LOADING
OGRE Design

Render Queue Architecture

Standard render order for game engines is fixed



Terrain,movable,effects,overlays,background, skyboxes
Ogre render order uses queues and is prioritized
Material usage

Uses powerful scripting

Allows many rendering passes

Automatic fallback design – Ogre will render as
required for multi-textures dependent on your
hardware
OGRE Design

Animation Flexibility

3 types supported


Skeletal, morph or pose
Compositor Framework

2D full-screen post processing
OGRE First Steps

Root

REQUIRED FOR ALL OGRE PROGRAMS

Allows initialization of config files

plugins.cnf



ogre.cnf


Define plugin folder and plugins
Render_System_Direct3D9 is example of one
Allows settings of plugins in name=value pairs
ogre.log


Provides dignostics and exception logging
Can be disk file, network or ignored
OGRE Render Window

“initialise” method

root->initialise(true, “My Render Window”);
RenderWindow *window =
root->getAutoCreatedWindow();
(will go and ask user to input in config dialog)
Add the viewport to the window
Viewport *vp= window->addViewport(camera);
OGRE Making a Camera

Camera *cam = sceneMgr->createCamera(“MainCamera”);
cam->setNearClipDistance(5);
cam->setFarClipDistance(1000);
cam->setAspectRatio(Real(1.333333));
for 4:3 non-hd display
ratio of far and near should be 1000 or less
OGRE Render Loop

root->startRendering();
causes Ogre to loop endlessly rendering whatever content in
your scene.

MAKE SURE THAT “framelisteners” are started before this!!!!
The MAIN LINKS

OGRE3D Web Site

Projects using OGRE

OGRE Wiki
Download