270 likes | 497 Views
Building Blocks. SceneManager (sm) Track everything on screen. Implication: Must create everything through sm Must have methods for creating objects Entity – renderable on screen (a mesh), created by calling method on sm SceneNode – created by calling method on the sm
E N D
Building Blocks • SceneManager (sm) • Track everything on screen. Implication: • Must create everything through sm • Must have methods for creating objects • Entity – renderable on screen (a mesh), created by calling method on sm • SceneNode – created by calling method on the sm • Camera – created by calling a method on the sm
Vectors and Colour • ogre.Vector3(x, y, z)) • (x, y, z) in pythonOgre • ogre.ColourValue(R, G, B) • (R, G, B) in pythonOgre
Entity • Visibility • setVisible(False) • Bool isVisible() … • Name • getName() - readOnly, cannot change after creation • getParentSceneNode() - what scene node am I attached to
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)