예제 #1
0
        /// <summary>
        /// Should do scene and object initialization
        /// </summary>
        public virtual void InitializeEnvironment()
        {
            bool useCustomTerrain = false;

            if (useCustomTerrain)
            {
                try
                {
                    terrain = new Terrain(new Vector3(0, -15, 0), // position
                        //new Vector3(100f, .1f, 100f),  // X with, possible y range, Z depth
                                            new Vector3(15000f, .55f, 15000f),  // X with, possible y range, Z depth
                                            100, 100, graphicsDevice, moon);

                    objectsToAdd.Add(terrain.ID, terrain);
                }
                catch (Exception E)
                {
                    System.Diagnostics.Debug.WriteLine(E.StackTrace);
                }
            }
            else
            {
                try
                {
                    // some video cards can't handle the >16 bit index type of the terrain
                    HeightmapObject heightmapObj = new HeightmapObject(terrainModel, Vector2.Zero, new Vector3(0, 0, 0));
                    objectsToAdd.Add(heightmapObj.ID, heightmapObj);
                }
                catch (Exception E)
                {
                    // if that happens just create a ground plane
                    planeObj = new PlaneObject(planeModel, 0.0f, new Vector3(0, -15, 0), 0);
                    objectsToAdd.Add(planeObj.ID, planeObj);
                    System.Diagnostics.Debug.WriteLine(E.StackTrace);
                }
            }
        }
예제 #2
0
        public override void InitializeEnvironment()
        {
            bool useCustomTerrain = false;

            if (useCustomTerrain)
            {
                try
                {
                    physicsManager.PhysicsSystem.Gravity = Vector3.Zero;
                    physicsManager.AddGravityController(new Vector3(0, -101, 0), 100, 10);
                    /*terrain = new Terrain(new Vector3(0, -15, 0), // position
                        //new Vector3(100f, .1f, 100f),  // X with, possible y range, Z depth
                                            new Vector3(15000f, .55f, 15000f),  // X with, possible y range, Z depth
                                            100, 100, graphicsDevice, moon);*/
                    planet = new Planet(new Vector3(0, -101, 0), // Position
                        new Vector3(100, 100, 100), // Radius
                        0, Math.PI / 8, 2, graphicsDevice, moon);

                    objectsToAdd.Add(planet.ID, planet);
                    //objectsToAdd.Add(terrain.ID, terrain);
                }
                catch (Exception E)
                {
                    System.Diagnostics.Debug.WriteLine(E.StackTrace);
                }
            }
            else
            {
                try
                {
                    // some video cards can't handle the >16 bit index type of the terrain
                    HeightmapObject heightmapObj = new HeightmapObject(terrainModel, Vector2.Zero, new Vector3(0, 0, 0));
                    objectsToAdd.Add(heightmapObj.ID, heightmapObj);
                }
                catch (Exception E)
                {
                    // if that happens just create a ground plane
                    //planeObj = new PlaneObject(planeModel, 0.0f, new Vector3(0, -15, 0), "");
                    //newObjects.Add(planeObj.ID, planeObj);
                    System.Diagnostics.Debug.WriteLine(E.StackTrace);
                }
            }
        }