示例#1
0
        /// <summary>
        /// Instantiates the 
        /// </summary>
        public TerrainManager(Camera camera)
        {
            this.camera = camera;

            thread = new Thread(ThreadRefreshActiveChunks);
            thread.Start();
        }
示例#2
0
        public ModelDisplayWidget(SpriteBatch spriteBatch, string bg, int p_3, int p_4, int p_5, int p_6, Anchor anchor_2)
            : base(spriteBatch, bg, p_3, p_4, p_5, p_6, anchor_2)
        {
            camera = new Camera();

            BoundingSphere sphere = new BoundingSphere();
            float scale;
            /*Debug.WriteLine("Hey" + (
                (body.Left - (SettingsManager.GetInstance().ResolutionX/2.0f))
                / SettingsManager.GetInstance().ResolutionX));*/
            //translationAndScale = Matrix.Multiply(Matrix.CreateTranslation(translation), Matrix.CreateScale(new Vector3(0.5f,0.5f,0.5f)));

            //BoundingSphere will give us the size of the model, so we can scale accordingly
            foreach (ModelMesh mesh in myModel.Meshes)
            {
                if (sphere.Radius == 0)
                    sphere = mesh.BoundingSphere;
                else
                    sphere = BoundingSphere.
                             CreateMerged(sphere, mesh.BoundingSphere);
            }
            Debug.WriteLine(sphere.Radius);
            scale = 2.0f / sphere.Radius;
            translationAndScale = Matrix.Multiply(Matrix.CreateTranslation(translation), Matrix.CreateScale(new Vector3(scale, scale, scale)));
        }
示例#3
0
        public GameScreen(ScreenManager screenManager)
            : base(screenManager)
        {
            camera = new Camera();
            terrainManager = new TerrainManager(camera);

            terrainManager.GenerateTerrain("World 1");
        }