Esempio n. 1
0
        public override void InitalizeGraphics(RenderSystem rs)
        {
            ForestInfo info;

            info.Latitude  = Latitude;
            info.Longitude = Longitude;
            info.Radius    = Radius;

            info.Amount = CurrentAmount;

            //info.Plants = TreeModelLibrary.Instance.Get(0);

            model = TreeBatchModelManager.Instance.CreateInstance(rs, info);

            model.Touch();

            Transformation = model.GetWeakResource().Transformation;
            BoundingSphere = model.GetWeakResource().BoundingVolume;

            sound          = SoundManager.Instance.MakeSoundObjcet("forest", null, BoundingSphere.Radius);
            sound.Position = BoundingSphere.Center;

            {
                float radLng = MathEx.Degree2Radian(Longitude);
                float radLat = MathEx.Degree2Radian(Latitude);

                float alt = TerrainData.Instance.QueryHeight(radLng, radLat);

                stdPosition = PlanetEarth.GetPosition(radLng, radLat, alt * TerrainMeshManager.PostHeightScale + PlanetEarth.PlanetRadius);

                stdTransform = PlanetEarth.GetOrientation(radLng, radLat);
                stdTransform.TranslationValue = stdPosition;


                selectionSphere.Center = stdPosition;
                selectionSphere.Radius = 200;
            }

            FileLocation fl = FileSystem.Instance.Locate("wooden_board_green.mesh", GameFileLocs.Model);

            board = new Model(ModelManager.Instance.CreateInstance(rs, fl));
            board.CurrentAnimation.Clear();
            board.CurrentAnimation.Add(
                new NoAnimaionPlayer(
                    Matrix.Translation(0, 0, 25) *
                    Matrix.Scaling(2.7f, 2.7f, 2.7f) *
                    Matrix.RotationX(-MathEx.PiOver2) *
                    Matrix.RotationY((-MathEx.PIf * 7.0f) / 8.0f)
                    ));
        }
Esempio n. 2
0
        public TerrainTile(RenderSystem rs, int col, int lat)
            : base(true)
        {
            terrain0 = TerrainMeshManager.Instance.CreateInstance(rs, col, lat, 17);
            terrain0.Touch();
            //terrain1 = TerrainMeshManager.Instance.CreateInstance(rs, col, lat, 17);
            //terrain1.Touch();
            Transformation = terrain0.GetWeakResource().Transformation;
            BoundingSphere = terrain0.GetWeakResource().BoundingSphere;

            //Transformation = terrain0.GetWeakResource().Transformation;
            //BoundingSphere = terrain0.GetWeakResource().BoundingSphere;

            //terrain0.GetWeakResource().ObjectSpaceChanged += TerrainMesh_ObjectSpaceChanged;
            //terrain1.GetWeakResource().ObjectSpaceChanged += TerrainMesh_ObjectSpaceChanged;
        }
Esempio n. 3
0
        public TerrainTile(RenderSystem rs, int col, int lat)
            : base(true)
        {
            terrain0 = TerrainMeshManager.Instance.CreateInstance(rs, col, lat, 17);
            terrain0.Touch();
            //terrain1 = TerrainMeshManager.Instance.CreateInstance(rs, col, lat, 17);
            //terrain1.Touch();
            Transformation = terrain0.GetWeakResource().Transformation;
            BoundingSphere = terrain0.GetWeakResource().BoundingSphere;

            //Transformation = terrain0.GetWeakResource().Transformation;
            //BoundingSphere = terrain0.GetWeakResource().BoundingSphere;

            //terrain0.GetWeakResource().ObjectSpaceChanged += TerrainMesh_ObjectSpaceChanged;
            //terrain1.GetWeakResource().ObjectSpaceChanged += TerrainMesh_ObjectSpaceChanged;
        }
Esempio n. 4
0
        public override void InitalizeGraphics(RenderSystem rs)
        {

            ForestInfo info;
            info.Latitude = Latitude;
            info.Longitude = Longitude;
            info.Radius = Radius;

            info.Amount = CurrentAmount;

            //info.Plants = TreeModelLibrary.Instance.Get(0);

            model = TreeBatchModelManager.Instance.CreateInstance(rs, info);

            model.Touch();

            Transformation = model.GetWeakResource().Transformation;
            BoundingSphere = model.GetWeakResource().BoundingVolume;

            sound = SoundManager.Instance.MakeSoundObjcet("forest", null, BoundingSphere.Radius);
            sound.Position = BoundingSphere.Center;

            {
                float radLng = MathEx.Degree2Radian(Longitude);
                float radLat = MathEx.Degree2Radian(Latitude);

                float alt = TerrainData.Instance.QueryHeight(radLng, radLat);

                stdPosition = PlanetEarth.GetPosition(radLng, radLat, alt * TerrainMeshManager.PostHeightScale + PlanetEarth.PlanetRadius);

                stdTransform = PlanetEarth.GetOrientation(radLng, radLat);
                stdTransform.TranslationValue = stdPosition;


                selectionSphere.Center = stdPosition;
                selectionSphere.Radius = 200;
            }

            FileLocation fl = FileSystem.Instance.Locate("wooden_board_green.mesh", GameFileLocs.Model);

            board = new Model(ModelManager.Instance.CreateInstance(rs, fl));
            board.CurrentAnimation.Clear();
            board.CurrentAnimation.Add(
                new NoAnimaionPlayer(
                    Matrix.Translation(0, 0, 25) *
                    Matrix.Scaling(2.7f, 2.7f, 2.7f) *
                    Matrix.RotationX(-MathEx.PiOver2) *
                    Matrix.RotationY((-MathEx.PIf * 7.0f) / 8.0f)
                    ));

        }
Esempio n. 5
0
 public override void Update(GameTime dt)
 {
     BoundingSphere = terrain0.GetWeakResource().BoundingSphere;
 }