public ResourceHandle<TreeBatchModel> CreateInstance(RenderSystem rs, ForestInfo info)
 {
     Resource retrived = base.Exists(TreeBatchModel.GetHashString(info));
     if (retrived == null)
     {
         TreeBatchModel mdl = new TreeBatchModel(rs, info);
         base.NotifyResourceNew(mdl);
         retrived = mdl;
     }
     else
     {
         retrived.Use();
     }
     return new ResourceHandle<TreeBatchModel>((TreeBatchModel)retrived);
 }
Beispiel #2
0
        public TreeBatchModel(RenderSystem rs, ForestInfo info)
            : base(TreeBatchModelManager.Instance,
                   GetHashString(info))
        {
            this.info      = info;
            this.renderSys = rs;

            float radlng = MathEx.Degree2Radian(info.Longitude);
            float radlat = MathEx.Degree2Radian(info.Latitude);

            Transformation = Matrix.Identity;// PlanetEarth.GetOrientation(radlng, radlat);
            //Transformation.TranslationValue = PlanetEarth.GetPosition(radlng, radlat);

            BoundingVolume.Center = PlanetEarth.GetPosition(radlng, radlat);
            BoundingVolume.Radius = PlanetEarth.GetTileArcLength(MathEx.Degree2Radian(info.Radius));
        }
Beispiel #3
0
        public ResourceHandle <TreeBatchModel> CreateInstance(RenderSystem rs, ForestInfo info)
        {
            Resource retrived = base.Exists(TreeBatchModel.GetHashString(info));

            if (retrived == null)
            {
                TreeBatchModel mdl = new TreeBatchModel(rs, info);
                base.NotifyResourceNew(mdl);
                retrived = mdl;
            }
            else
            {
                retrived.Use();
            }
            return(new ResourceHandle <TreeBatchModel>((TreeBatchModel)retrived));
        }
Beispiel #4
0
 public static string GetHashString(ForestInfo info)
 {
     return(info.Longitude.ToString() + "_" + info.Latitude.ToString() + "_" + info.Radius.ToString());
 }
Beispiel #5
0
        public TreeBatchModel(RenderSystem rs, ForestInfo info)
            : base(TreeBatchModelManager.Instance,
            GetHashString(info))
        {
            this.info = info;
            this.renderSys = rs;

            float radlng = MathEx.Degree2Radian(info.Longitude);
            float radlat = MathEx.Degree2Radian(info.Latitude);

            Transformation = Matrix.Identity;// PlanetEarth.GetOrientation(radlng, radlat);
            //Transformation.TranslationValue = PlanetEarth.GetPosition(radlng, radlat);

            BoundingVolume.Center = PlanetEarth.GetPosition(radlng, radlat);
            BoundingVolume.Radius = PlanetEarth.GetTileArcLength(MathEx.Degree2Radian(info.Radius));
        }
Beispiel #6
0
 public static string GetHashString(ForestInfo info)
 {
     return info.Longitude.ToString() + "_" + info.Latitude.ToString() + "_" + info.Radius.ToString();
 }