/// <summary> /// Sets up the samples content /// </summary> protected override void SetupContent() { // set some ambient light SceneManager.AmbientLight = new ColorEx( 1.0f, 0.2f, 0.2f, 0.2f ); // create a skydome SceneManager.SetSkyDome( true, "Examples/CloudySky", 5, 8 ); // create a simple default point light Light light = SceneManager.CreateLight( "MainLight" ); light.Position = new Vector3( 20, 80, 50 ); // create a plane for the plane mesh Plane plane = new Plane(); plane.Normal = Vector3.UnitY; plane.D = 200; // create a plane mesh MeshManager.Instance.CreatePlane( "FloorPlane", ResourceGroupManager.DefaultResourceGroupName, plane, 200000, 200000, 20, 20, true, 1, 50, 50, Vector3.UnitZ ); // create an entity to reference this mesh Entity planeEntity = SceneManager.CreateEntity( "Floor", "FloorPlane" ); planeEntity.MaterialName = "Examples/RustySteel"; SceneManager.RootSceneNode.CreateChildSceneNode().AttachObject( planeEntity ); // create an entity to have follow the path Entity ogreHead = SceneManager.CreateEntity( "OgreHead", "ogrehead.mesh" ); // Load muiltiple heads for box select and demonstrating single select with stacked objects // create a scene node for each entity and attach the entity SceneNode ogreHead1Node; ogreHead1Node = SceneManager.RootSceneNode.CreateChildSceneNode( "OgreHeadNode", Vector3.Zero, Quaternion.Identity ); ogreHead1Node.AttachObject( ogreHead ); SceneNode ogreHead2Node; Entity ogreHead2 = SceneManager.CreateEntity( "OgreHead2", "ogrehead.mesh" ); ogreHead2Node = SceneManager.RootSceneNode.CreateChildSceneNode( "OgreHead2Node", new Vector3( -100, 0, 0 ), Quaternion.Identity ); ogreHead2Node.AttachObject( ogreHead2 ); SceneNode ogreHead3Node; Entity ogreHead3 = SceneManager.CreateEntity( "OgreHead3", "ogrehead.mesh" ); ogreHead3Node = SceneManager.RootSceneNode.CreateChildSceneNode( "OgreHead3Node", new Vector3( +100, 0, 0 ), Quaternion.Identity ); ogreHead3Node.AttachObject( ogreHead3 ); // make sure the camera tracks this node // set initial camera position CameraManager.setStyle( CameraStyle.FreeLook ); Camera.Position = new Vector3( 0, 0, 500 ); Camera.SetAutoTracking( true, ogreHead1Node, Vector3.Zero ); // create a scene node to attach the camera to SceneNode cameraNode = SceneManager.RootSceneNode.CreateChildSceneNode( "CameraNode" ); cameraNode.AttachObject( Camera ); // turn on some fog SceneManager.SetFog( FogMode.Exp, ColorEx.White, 0.0002f ); _MouseSelector = new MouseSelector( "MouseSelector", Camera, Window ); _MouseSelector.SelectionMode = MouseSelector.SelectionModeType.None; SetupGUI(); initialized = true; base.SetupContent(); }
/// <summary> /// Sets up the samples content /// </summary> protected override void SetupContent() { // set some ambient light SceneManager.AmbientLight = new ColorEx(1.0f, 0.2f, 0.2f, 0.2f); // create a skydome SceneManager.SetSkyDome(true, "Examples/CloudySky", 5, 8); // create a simple default point light Light light = SceneManager.CreateLight("MainLight"); light.Position = new Vector3(20, 80, 50); // create a plane for the plane mesh var plane = new Plane(); plane.Normal = Vector3.UnitY; plane.D = 200; // create a plane mesh MeshManager.Instance.CreatePlane("FloorPlane", ResourceGroupManager.DefaultResourceGroupName, plane, 200000, 200000, 20, 20, true, 1, 50, 50, Vector3.UnitZ); // create an entity to reference this mesh Entity planeEntity = SceneManager.CreateEntity("Floor", "FloorPlane"); planeEntity.MaterialName = "Examples/RustySteel"; SceneManager.RootSceneNode.CreateChildSceneNode().AttachObject(planeEntity); // create an entity to have follow the path Entity ogreHead = SceneManager.CreateEntity("OgreHead", "ogrehead.mesh"); // Load muiltiple heads for box select and demonstrating single select with stacked objects // create a scene node for each entity and attach the entity SceneNode ogreHead1Node; ogreHead1Node = SceneManager.RootSceneNode.CreateChildSceneNode("OgreHeadNode", Vector3.Zero, Quaternion.Identity); ogreHead1Node.AttachObject(ogreHead); SceneNode ogreHead2Node; Entity ogreHead2 = SceneManager.CreateEntity("OgreHead2", "ogrehead.mesh"); ogreHead2Node = SceneManager.RootSceneNode.CreateChildSceneNode("OgreHead2Node", new Vector3(-100, 0, 0), Quaternion.Identity); ogreHead2Node.AttachObject(ogreHead2); SceneNode ogreHead3Node; Entity ogreHead3 = SceneManager.CreateEntity("OgreHead3", "ogrehead.mesh"); ogreHead3Node = SceneManager.RootSceneNode.CreateChildSceneNode("OgreHead3Node", new Vector3(+100, 0, 0), Quaternion.Identity); ogreHead3Node.AttachObject(ogreHead3); // make sure the camera tracks this node // set initial camera position CameraManager.setStyle(CameraStyle.FreeLook); Camera.Position = new Vector3(0, 0, 500); Camera.SetAutoTracking(true, ogreHead1Node, Vector3.Zero); // create a scene node to attach the camera to SceneNode cameraNode = SceneManager.RootSceneNode.CreateChildSceneNode("CameraNode"); cameraNode.AttachObject(Camera); // turn on some fog SceneManager.SetFog(FogMode.Exp, ColorEx.White, 0.0002f); this._MouseSelector = new MouseSelector("MouseSelector", Camera, Window); this._MouseSelector.SelectionMode = MouseSelector.SelectionModeType.None; SetupGUI(); this.initialized = true; base.SetupContent(); }