private Mesh loadCameraSpawn(SpawnInfo.BaseSpawn spawn) { SpawnInfo.CameraSpawn tempbox; tempbox = spawn as SpawnInfo.CameraSpawn; try { return (Mesh.Cylinder(render.device, 0.1f, 2.0f, 10f, 10, 10)); } catch (Exception ex) { Global.ShowErrorMsg("Failure to create Bounding Box Mesh for [" + tempbox.TagType + "] " + tempbox.TagPath, ex); } return null; }
private Mesh loadBoundingBoxSpawn(SpawnInfo.BaseSpawn spawn) { SpawnInfo.BoundingBoxSpawn tempbox; tempbox = spawn as SpawnInfo.BoundingBoxSpawn; try { return (Mesh.Box(render.device, tempbox.width, tempbox.height, tempbox.length)); } catch (Exception ex) { Global.ShowErrorMsg("Failure to create Bounding Box Mesh for [" + tempbox.TagType + "] " + tempbox.TagPath + "\nWidth : " + tempbox.width.ToString() + "\nHeight: " + tempbox.height.ToString() + "\nLength: " + tempbox.length.ToString(), ex); } return null; }
private Mesh loadSoundSpawn(SpawnInfo.BaseSpawn spawn) { SpawnInfo.SoundSpawn tempbox; tempbox = spawn as SpawnInfo.SoundSpawn; switch (tempbox.VolumeType) { case 0: // Sphere if (tempbox.DistanceBoundsLower < 30) { return (Mesh.Sphere( render.device, tempbox.DistanceBoundsLower, 10 + (int)tempbox.DistanceBoundsLower, 10 + (int)tempbox.DistanceBoundsLower)); } else { return (Mesh.Sphere(render.device, tempbox.DistanceBoundsLower, 30, 30)); } case 1: // Cylinder return (Mesh.Cylinder( render.device, tempbox.DistanceBoundsLower, tempbox.DistanceBoundsUpper, 10 + tempbox.Height, 10, 10)); default: return (Mesh.Cylinder( render.device, tempbox.DistanceBoundsLower, tempbox.DistanceBoundsUpper, tempbox.Height, 10, 10)); } }
/// <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); }
/// <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; } }
private Mesh loadSpawnZone(SpawnInfo.BaseSpawn spawn) { SpawnInfo.SpawnZone tempCylinder = spawn as SpawnInfo.SpawnZone; // Used for fixing position of bounding boxes tempCylinder.bbXDiff = 0; tempCylinder.bbYDiff = 0; tempCylinder.bbZDiff = tempCylinder.UpperHeight - (tempCylinder.UpperHeight - tempCylinder.LowerHeight) / 2; return (Mesh.Cylinder( render.device, tempCylinder.InnerRadius, tempCylinder.OuterRadius, tempCylinder.UpperHeight - tempCylinder.LowerHeight, 32, 5 )); }