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); }
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)); }
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)); }
public static string GetHashString(ForestInfo info) { return(info.Longitude.ToString() + "_" + info.Latitude.ToString() + "_" + info.Radius.ToString()); }
public static string GetHashString(ForestInfo info) { return info.Longitude.ToString() + "_" + info.Latitude.ToString() + "_" + info.Radius.ToString(); }