public GfxObj(DatLoader.FileTypes.GfxObj gfxObj) { if (gfxObj == null) { return; } ID = gfxObj.Id; VertexArray = gfxObj.VertexArray; Polygons = new Dictionary <ushort, Polygon>(); foreach (var kvp in gfxObj.Polygons) { Polygons.Add(kvp.Key, PolygonCache.Get(new Polygon(kvp.Value, gfxObj.VertexArray))); } if (gfxObj.PhysicsPolygons.Count > 0) { PhysicsPolygons = new Dictionary <ushort, Polygon>(); foreach (var kvp in gfxObj.PhysicsPolygons) { PhysicsPolygons.Add(kvp.Key, PolygonCache.Get(new Polygon(kvp.Value, gfxObj.VertexArray))); } PhysicsBSP = BSPCache.Get(gfxObj.PhysicsBSP, gfxObj.PhysicsPolygons, gfxObj.VertexArray); PhysicsSphere = PhysicsBSP.GetSphere(); } SortCenter = gfxObj.SortCenter; DrawingBSP = BSPCache.Get(gfxObj.DrawingBSP, gfxObj.Polygons, gfxObj.VertexArray); DrawingSphere = DrawingBSP.GetSphere(); Init(); }
public GfxObj(DatLoader.FileTypes.GfxObj gfxObj) { if (gfxObj == null) { return; } ID = gfxObj.Id; SurfaceIDs = gfxObj.Surfaces; NumSurfaces = SurfaceIDs != null ? SurfaceIDs.Count : 0; VertexArray = CreateMutable(gfxObj.VertexArray); NumPhysicsPolygons = gfxObj.PhysicsPolygons.Count; PhysicsPolygons = new Dictionary <ushort, Polygon>(); foreach (var kvp in gfxObj.PhysicsPolygons) { PhysicsPolygons.Add(kvp.Key, new Polygon(kvp.Value, gfxObj.VertexArray)); } PhysicsBSP = new BSP.BSPTree(gfxObj.PhysicsBSP, gfxObj.PhysicsPolygons, gfxObj.VertexArray); PhysicsSphere = PhysicsBSP.GetSphere(); SortCenter = gfxObj.SortCenter; NumPolygons = gfxObj.Polygons.Count; Polygons = new Dictionary <ushort, Polygon>(); foreach (var kvp in gfxObj.Polygons) { Polygons.Add(kvp.Key, new Polygon(kvp.Value, gfxObj.VertexArray)); } // usebuiltmesh DrawingBSP = new BSP.BSPTree(gfxObj.DrawingBSP, gfxObj.Polygons, gfxObj.VertexArray); DrawingSphere = DrawingBSP.GetSphere(); }