Unbuffered Input Games generally use unbuffered Input Ogre provides FrameListeners – Ogre's main infinite loop → startRendering – Also called the render loop Render loop has three steps – 1. frameStarted(...) on all REGISTERED frame listeners – 2. Ogre renders one frame – 3. frameEnded(...) on all REGISTERED frame listeners How do you get out of the loop?
Render loop and FrameListeners FrameStarted must return True or False If frameStarted(...) returns False, exit render loop In C++: – bool frameStarted(ogre.FrameEvent); You can register multiple frame listeners with ogre. You cannot specify the order in which the frame listeners are called.
Registering an frame listener self.frameListener = TutorialFrameListener(self.renderWindow, self.camera, self.sceneManager) self.root.addFrameListener(self.frameListener)
SceneNode Position node.translate(ogre.Vector3(50, 50, 0)) yaw, roll, pitch, rotate(quaternion) → orientation Scale Attach/Detach Relative positioning
Entity/SceneNode Typical: Create One Entity, Attach to sceneNode Bike with two wheels? Relative positioning Create frame, wheel1, wheel2 Create sceneNode, n1, child of root n1 = sm.createChildSceneNode(...) Attach frame to n1 Create sceneNode, c1, child of n1 c1 = n1.createChildSceneNode(“RobotNode2”, (50, 0, 0)) Attach wheel1 to c1 c1.attachObject(wheel1) Create sceneNode, c2n1, child of n2 Attach wheel2 to c2n1
Lights, Cameras, Planes Camera is created by scene manager Since your tutorial code inherits from sample framework, you get a default camera in tutorial1 Cameras have a name! sm.getCamera(name) Cameras have a position Cameras have orientation (lookAt!) SceneNodes have lookAt!
Lights Point lights emit light in every direction Spotlight – flashlight/spotlight Directional – very long distance spotlight Light properties Diffuse (matte paint) Specular (glossy)