示例#1
0
        /// <summary>
        /// The dispose.
        /// </summary>
        /// <remarks></remarks>
        public void Dispose()
        {
            foreach (IntPtr ip in bitmPtrs)
            {
                Marshal.FreeHGlobal(ip);
            }

            bitmPtrs.Clear();

            for (int i = 0; i < this.LightMapBitmap.Length; i++)
            {
                if (this.LightMapBitmap[i] != null)
                {
                    this.LightMapBitmap[i].Dispose();
                    this.LightMapBitmap[i] = null;
                }
            }

            for (int i = 0; i < this.SceneryLightMapBitmap.Length; i++)
            {
                if (this.SceneryLightMapBitmap[i] != null)
                {
                    this.SceneryLightMapBitmap[i].Dispose();
                }
            }

            this.BSPPermutationRawDataMetaChunks = null;
            this.PermutationInfo = null;
            this.BSPRawDataMetaChunks = null;
            this.Display = null;

            this.Shaders = null;
            this.SkyBox = null;
            this.Spawns = null;
            GC.SuppressFinalize(this);
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BSPModel"/> class.
        /// </summary>
        /// <param name="meta">The meta.</param>
        /// <remarks></remarks>
        public BSPModel(ref Meta meta)
        {
            if (meta == null)
            {
                MessageBox.Show("ERROR: NO SBSP tag selected!");
                this.BspNumber = -1;
                return;
            }

            this.map = meta.Map;

            string[] temps = meta.name.Split('\\');
            Name = temps[temps.Length - 1];
            BspNumber = map.BSP.FindBSPNumberByBSPIdent(meta.ident);

            switch (map.HaloVersion)
            {
                case HaloVersionEnum.Halo2:
                case HaloVersionEnum.Halo2Vista:
                    // 10x 0.0000010
                    LoadModelStructure(ref meta);
                    // 5x 0.0000010
                    LoadPermutations(ref meta);
                    // Load Decorators
                    LoadUnknowns(ref meta);
                    // 5x 0.0000010
                    Shaders = new BSPShaderContainer(this, ref meta);
                    Display = new BSPDisplayedInfo();
                    // 2x 0.0000010
                    LoadLightmaps();
                    sky = new Sky();
                    LoadSky(ref meta);
                    Spawns = new SpawnInfo(map);
                    // 1x 0.0000010
                    ClusterInfo = ClustersPVS.GetClustersPVSInfo(ref meta);
                    break;
                case HaloVersionEnum.Halo1:
                case HaloVersionEnum.HaloCE:
                    Shaders = new BSPShaderContainer();
                    this.BSPPermutationRawDataMetaChunks = new BSPPermutationRawDataMetaChunk[0];
                    this.LightMapBitmap = new Bitmap[0];
                    this.SceneryLightMapBitmap = new Bitmap[0];
                    this.PermutationInfo = new PermutationPlacement[0];
                    LoadModelStructure(ref meta);

                    Display = new BSPDisplayedInfo();
                    Spawns = new SpawnInfo(map);
                    sky = new Sky();
                    break;
            }
        }