public override void CleanUp()
 {
     if (object3d != null)
     {
         object3d.Dispose();
         GC.SuppressFinalize(object3d);
     }
     object3d = null;
     dirty = true;
 }
        public override void LoadData(string path)
        {
            // ObjType = true;

            if (path.ToLower().EndsWith(".obj"))
            {
                ObjType = true;
            }

            if (lightID == 0)
            {
                if (ObjType)
                {
                    object3d = new Object3d(path.Replace(".txt", ".obj"), FlipV, flipHandedness, true, Color);
                }
                else
                {
                    object3d = new Object3d(path.Replace(".txt", ".3ds"), FlipV, flipHandedness, true, Color);
                }
            }
        }
        public static void LoadBackground()
        {
            if (loading)
            {
                return;
            }

            loading = true;
            string path = Properties.Settings.Default.CahceDirectory + @"\mdl\155\";
            string filename = path + "mdl.zip";
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            if (!File.Exists(filename))
            {
                DataSetManager.DownloadFile("http://www.worldwidetelescope.org/data/iss.zip", filename, false, true);

            }

            using (Stream s = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                ZipArchive zip = new ZipArchive(s);
                foreach (ZipEntry zFile in zip.Files)
                {
                    Stream output = File.Open(path+zFile.Filename, FileMode.Create, FileAccess.ReadWrite, FileShare.None);
                    Stream input = zFile.GetFileStream();
                    CopyStream(input, output);
                    input.Close();
                    output.Close();
                }
            }

            filename = path + "mdl.3ds";
            if (File.Exists(filename))
            {
                Object3d o3d = new Object3d(filename, true, false, true, System.Drawing.Color.White);
                if (o3d != null)
                {
                    o3d.ISSLayer = true;
                    issmodel = o3d;
                }
            }
        }