private void SetUpGameWorld() { //Sky dome first (depth buffer will be disabled on draw for this) var skyDome = new GradientSkyDome(Color.MediumBlue, Color.LightCyan); int patchSize = 100; int widthInTerrainPatches = 1; int heightInTerrainPatches = 1; CreateIsland(patchSize, widthInTerrainPatches, heightInTerrainPatches, Vector3.Zero); CreateIsland(patchSize, widthInTerrainPatches, heightInTerrainPatches, new Vector3(100, 0, 100)); CreateIsland(patchSize, widthInTerrainPatches, heightInTerrainPatches, new Vector3(130, 0, 0)); CreateIsland(patchSize, widthInTerrainPatches, heightInTerrainPatches, new Vector3(0, 0, 170)); //temporary water Heightmap seaHeightMap = new Heightmap(patchSize / 4 * widthInTerrainPatches, 1); var seaObject = seaHeightMap.CreateRenderableHeightMap(Color.Blue, EffectLoader.LoadSM5Effect("flatshaded")); seaObject.Transform.SetPosition(new Vector3(-50, 0, -50)); seaObject.Transform.Scale = 20; SystemCore.GameObjectManager.AddAndInitialiseGameObject(seaObject); }
public override void OnInitialise() { base.OnInitialise(); SystemCore.Game.Window.Title = "Conway's Game of Life"; mouseCamera = new MouseFreeCamera(new Vector3(0, 0, 0)); SystemCore.SetActiveCamera(mouseCamera); mouseCamera.moveSpeed = 0.01f; mouseCamera.SetPositionAndLook(new Vector3(50, 30, -20), (float)Math.PI, (float)-Math.PI / 5); SystemCore.ActiveScene.SetUpAmbientAndFullLightingRig(); SystemCore.ActiveScene.AmbientLight.LightIntensity = 0.075f; SystemCore.ActiveScene.GetBackLight().LightIntensity = 0f; SystemCore.ActiveScene.GetFillLight().LightIntensity = 0.1f; SystemCore.ActiveScene.FogEnabled = false; SystemCore.CursorVisible = true; //fpsLabel.Visible = true; skyDome = new GradientSkyDome(Color.LightGray, Color.DarkGray); simulationTickTimer = new XNATimer(tickFrequency, x => RunSimulationTick(x)); simulationTickTimer.Enabled = true; AddInputBindings(); // var heightMapObject = CreateHeightMapGameObject(); //SystemCore.GameObjectManager.AddAndInitialiseGameObject(heightMapObject); CreateGameOfLifeBoard(); cameraGameObject = new GameObject("camera"); cameraGameObject.AddComponent(new ComponentCamera()); cameraGameObject.Transform.SetPosition(new Vector3(50, 15, 50)); Vector3 lookAt = Vector3.Normalize(boardMidpoint - cameraGameObject.Position); cameraGameObject.Transform.SetLookAndUp(lookAt, Vector3.Up); SystemCore.GameObjectManager.AddAndInitialiseGameObject(cameraGameObject); SystemCore.SetActiveCamera(cameraGameObject.GetComponent <ComponentCamera>()); //var sphere = GameObjectFactory.CreateRenderableGameObjectFromShape(new ProceduralSphere(10, 10), EffectLoader.LoadSM5Effect("flatshaded")); //sphere.Transform.SetPosition(boardMidpoint); //sphere.Transform.Scale = 5f; //SystemCore.GameObjectManager.AddAndInitialiseGameObject(sphere); AddGUI(); }
public override void OnInitialise() { base.OnInitialise(); SystemCore.ActiveScene.SetUpBasicAmbientAndKey(); SystemCore.ActiveScene.SetDiffuseLightDir(0, new Vector3(1, 1, 1)); SystemCore.ActiveScene.FogEnabled = true; skyDome = new GradientSkyDome(Color.MediumBlue, Color.LightCyan); mouseCamera.moveSpeed = 0.01f; mouseCamera.SetPositionAndLook(new Vector3(50, 30, -20), (float)Math.PI, (float)-Math.PI / 5); for (int i = 0; i < 50; i++) { AddPhysicsCube(); } var heightMapObject = CreateHeightMapGameObject(); SystemCore.GameObjectManager.AddAndInitialiseGameObject(heightMapObject); SystemCore.PhysicsSimulation.ForceUpdater.Gravity = new BEPUutilities.Vector3(0, -9.81f, 0); //Heightmap heightMap = new Heightmap(100, 1); //var seaObject = heightMap.CreateRenderableHeightMap(Color.Blue, EffectLoader.LoadSM5Effect("water")); //seaObject.Transform.SetPosition(new Vector3(0, 10, 0)); //SystemCore.GameObjectManager.AddAndInitialiseGameObject(seaObject); //SetupVehicle(); }