Esempio n. 1
0
 public OceanWaterData GetData(int size, float lat)
 {
     HashNode node = new HashNode(size, lat);
     OceanWaterData result;
     if (!dataTable.TryGetValue(node, out result))
     {
         result = new OceanWaterData(renderSystem, size, lat);
         dataTable.Add(node, result);
     }
     return result;
 }
Esempio n. 2
0
        public OceanWaterData GetData(int size, float lat)
        {
            HashNode       node = new HashNode(size, lat);
            OceanWaterData result;

            if (!dataTable.TryGetValue(node, out result))
            {
                result = new OceanWaterData(renderSystem, size, lat);
                dataTable.Add(node, result);
            }
            return(result);
        }
Esempio n. 3
0
        public OceanWaterTile(RenderSystem rs, OceanWaterDataManager manager, int @long, int lat)
            : base(false)
        {
            renderSystem = rs;

            PlanetEarth.TileCoord2CoordNew(@long, lat, out tileCol, out tileLat);

            material = new Material(rs);

            FileLocation             fl  = FileSystem.Instance.Locate("WaterNormal.tex", GameFileLocs.Nature);
            ResourceHandle <Texture> map = TextureManager.Instance.CreateInstance(fl);

            material.SetTexture(1, map);

            fl  = FileSystem.Instance.Locate("WaterDudv.tex", GameFileLocs.Nature);
            map = TextureManager.Instance.CreateInstance(fl);
            material.SetTexture(0, map);

            material.SetEffect(EffectManager.Instance.GetModelEffect(WaterEffectFactory.Name));
            material.IsTransparent = true;
            material.ZWriteEnabled = false;
            material.ZEnabled      = true;
            material.CullMode      = CullMode.CounterClockwise;
            material.PriorityHint  = RenderPriority.Third;

            data0 = manager.GetData(Lod0Size, tileLat);
            //data1 = manager.GetData(Lod1Size, tileLat);


            float radtc = MathEx.Degree2Radian(tileCol);
            float radtl = MathEx.Degree2Radian(tileLat);
            float rad5  = PlanetEarth.DefaultTileSpan * 0.5f;

            BoundingSphere.Center = PlanetEarth.GetPosition(radtc + rad5, radtl - rad5);
            BoundingSphere.Radius = PlanetEarth.GetTileHeight(rad5 * 2);

            Transformation = Matrix.RotationY(radtc);
        }
Esempio n. 4
0
        public OceanWaterTile(RenderSystem rs, OceanWaterDataManager manager, int @long, int lat)
            : base(false)
        {
            renderSystem = rs;

            PlanetEarth.TileCoord2CoordNew(@long, lat, out tileCol, out tileLat);

            material = new Material(rs);

            FileLocation fl = FileSystem.Instance.Locate("WaterNormal.tex", GameFileLocs.Nature);
            ResourceHandle<Texture> map = TextureManager.Instance.CreateInstance(fl);
            material.SetTexture(1, map);

            fl = FileSystem.Instance.Locate("WaterDudv.tex", GameFileLocs.Nature);
            map = TextureManager.Instance.CreateInstance(fl);
            material.SetTexture(0, map);

            material.SetEffect(EffectManager.Instance.GetModelEffect(WaterEffectFactory.Name));
            material.IsTransparent = true;
            material.ZWriteEnabled = false;
            material.ZEnabled = true;
            material.CullMode = CullMode.CounterClockwise;
            material.PriorityHint = RenderPriority.Third;

            data0 = manager.GetData(Lod0Size, tileLat);
            //data1 = manager.GetData(Lod1Size, tileLat);


            float radtc = MathEx.Degree2Radian(tileCol);
            float radtl = MathEx.Degree2Radian(tileLat);
            float rad5 = PlanetEarth.DefaultTileSpan * 0.5f;

            BoundingSphere.Center = PlanetEarth.GetPosition(radtc + rad5, radtl - rad5);
            BoundingSphere.Radius = PlanetEarth.GetTileHeight(rad5 * 2);

            Transformation = Matrix.RotationY(radtc);
        }