Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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, CreateMutable(kvp.Value));
            }
            // usebuiltmesh
            // physicssphere
            PhysicsBSP = CreateMutable(gfxObj.PhysicsBSP);  // not mutable,
            // but still has non-unpack methods associated with it
            SortCenter  = gfxObj.SortCenter;
            NumPolygons = gfxObj.Polygons.Count;
            Polygons    = new Dictionary <ushort, Polygon>();
            foreach (var kvp in gfxObj.Polygons)
            {
                Polygons.Add(kvp.Key, CreateMutable(kvp.Value));
            }
            // drawing sphere/bsp
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
 public static GfxObj Get(DatLoader.FileTypes.GfxObj gfxObj)
 {
     return(Get(new GfxObj(gfxObj)));
 }