def _createScene(self): sceneManager = self.sceneManager sceneManager.ambientLight = (1, 1, 1) self.surfaceHeight = 0 self.entityMgr = EntityMgr(sceneManager) self.entityMgr.createEntity(sceneManager, "sailboat", mesh="sailboat.mesh", vel=ogre.Vector3(0,0,0), pos=ogre.Vector3(0,3,0)) self.entityMgr.createEntity(sceneManager, "destroyer", mesh="sleek.mesh", vel=ogre.Vector3(0,0,0), pos=ogre.Vector3(0,3,100)) self.entityMgr.createEntity(sceneManager, "speedboat", mesh="5086_Boat.mesh", vel=ogre.Vector3(0,0,0), pos=ogre.Vector3(0,3,200)) self.entityMgr.createEntity(sceneManager, "scout", mesh="cigarette.mesh", vel=ogre.Vector3(0,0,0), pos=ogre.Vector3(0,3,300)) self.entityMgr.createEntity(sceneManager, "superspeedboat", mesh="boat.mesh", vel=ogre.Vector3(0,0,0), pos=ogre.Vector3(0,3,400)) self.entityMgr.createEntity(sceneManager, "alienship", mesh="alienship.mesh", vel=ogre.Vector3(0,0,0), pos=ogre.Vector3(0,3,500)) self.entityMgr.createEntity(sceneManager, "aircraftcarrier", mesh="cvn68.mesh", vel=ogre.Vector3(0,0,0), pos=ogre.Vector3(0,3,600)) self.entityMgr.createEntity(sceneManager, "gunship", mesh="sleek.mesh", vel=ogre.Vector3(0,0,0), pos=ogre.Vector3(0,3,700)) # self.ogreEntities[0].setMaterialName ('Examples/Rockwall') # Setup a ground plane. plane = ogre.Plane ((0, 1, 0), 0) meshManager = ogre.MeshManager.getSingleton () meshManager.createPlane ('Ground', 'General', plane, 10000, 10000, 20, 20, True, 1, 5, 5, (0, 0, 1)) groundPlane = sceneManager.createEntity('GroundEntity', 'Ground') groundNode = sceneManager.getRootSceneNode().createChildSceneNode('GroundPlane') groundNode.attachObject(groundPlane) groundNode.setPosition(0,self.surfaceHeight,0) groundPlane.setMaterialName ('Ocean2_Cg') # Setup the first camera node and pitch node and aim it. node = sceneManager.getRootSceneNode().createChildSceneNode('CamNode1', (-400, 200, 400)) node.yaw(ogre.Degree(-45)) node = node.createChildSceneNode('PitchNode1') node.attachObject(self.camera)
class MovingApplication(sf.Application): def _createScene(self): sceneManager = self.sceneManager sceneManager.ambientLight = (1, 1, 1) self.surfaceHeight = 0 self.entityMgr = EntityMgr(sceneManager) self.entityMgr.createEntity(sceneManager, "sailboat", mesh="sailboat.mesh", vel=ogre.Vector3(0,0,0), pos=ogre.Vector3(0,3,0)) self.entityMgr.createEntity(sceneManager, "destroyer", mesh="sleek.mesh", vel=ogre.Vector3(0,0,0), pos=ogre.Vector3(0,3,100)) self.entityMgr.createEntity(sceneManager, "speedboat", mesh="5086_Boat.mesh", vel=ogre.Vector3(0,0,0), pos=ogre.Vector3(0,3,200)) self.entityMgr.createEntity(sceneManager, "scout", mesh="cigarette.mesh", vel=ogre.Vector3(0,0,0), pos=ogre.Vector3(0,3,300)) self.entityMgr.createEntity(sceneManager, "superspeedboat", mesh="boat.mesh", vel=ogre.Vector3(0,0,0), pos=ogre.Vector3(0,3,400)) self.entityMgr.createEntity(sceneManager, "alienship", mesh="alienship.mesh", vel=ogre.Vector3(0,0,0), pos=ogre.Vector3(0,3,500)) self.entityMgr.createEntity(sceneManager, "aircraftcarrier", mesh="cvn68.mesh", vel=ogre.Vector3(0,0,0), pos=ogre.Vector3(0,3,600)) self.entityMgr.createEntity(sceneManager, "gunship", mesh="sleek.mesh", vel=ogre.Vector3(0,0,0), pos=ogre.Vector3(0,3,700)) # self.ogreEntities[0].setMaterialName ('Examples/Rockwall') # Setup a ground plane. plane = ogre.Plane ((0, 1, 0), 0) meshManager = ogre.MeshManager.getSingleton () meshManager.createPlane ('Ground', 'General', plane, 10000, 10000, 20, 20, True, 1, 5, 5, (0, 0, 1)) groundPlane = sceneManager.createEntity('GroundEntity', 'Ground') groundNode = sceneManager.getRootSceneNode().createChildSceneNode('GroundPlane') groundNode.attachObject(groundPlane) groundNode.setPosition(0,self.surfaceHeight,0) groundPlane.setMaterialName ('Ocean2_Cg') # Setup the first camera node and pitch node and aim it. node = sceneManager.getRootSceneNode().createChildSceneNode('CamNode1', (-400, 200, 400)) node.yaw(ogre.Degree(-45)) node = node.createChildSceneNode('PitchNode1') node.attachObject(self.camera) def _createCamera(self): self.camera = self.sceneManager.createCamera('PlayerCam') self.camera.nearClipDistance = 5 def _createViewports(self): viewport = self.renderWindow.addViewport (self.camera) viewport.backGroundColor = (0, 0, 0) self.camera.aspectRatio = float (viewport.actualWidth) / float (viewport.actualHeight) def _createFrameListener(self): self.inputframeListener = InputFrameListener(self.renderWindow, self.camera, self.sceneManager, self.entityMgr) self.root.addFrameListener(self.inputframeListener) self.entityFrameListener = EntityFrameListener(self.entityMgr) self.root.addFrameListener(self.entityFrameListener)