Exemplo n.º 1
0
        public void UnPack(BinaryReader reader)
        {
            CellStructId    = reader.ReadUInt32();
            Polygons        = new CPolygon[reader.ReadUInt32()];
            PhysicsPolygons = new CPolygon[reader.ReadUInt32()];
            Portals         = new CPolygon[reader.ReadUInt32()];

            VertexArray.UnPack(reader);

            for (int i = 0; i < Polygons.Length; i++)
            {
                Polygons[i] = new CPolygon();
                Polygons[i].UnPack(reader);
            }

            for (int i = 0; i < Portals.Length; i++)
            {
                Portals[i] = Polygons[reader.ReadUInt16()];
            }

            reader.Align();

            BspNode.PackPolys    = Polygons;
            BspNode.PackTreeType = BspTreeType.Cell;
            CellBsp.UnPack(reader);

            for (int i = 0; i < PhysicsPolygons.Length; i++)
            {
                PhysicsPolygons[i] = new CPolygon();
                PhysicsPolygons[i].UnPack(reader);
            }

            BspNode.PackPolys    = PhysicsPolygons;
            BspNode.PackTreeType = BspTreeType.Physics;
            PhysicsBsp.UnPack(reader);

            if (reader.ReadUInt32() != 0u)
            {
                BspNode.PackPolys    = Polygons;
                BspNode.PackTreeType = BspTreeType.Drawing;
                DrawingBsp.UnPack(reader);
            }

            reader.Align();
        }
Exemplo n.º 2
0
 public bool PointInCell(Vector3 origin)
 {
     return(CellBsp.PointInsideCellBsp(origin));
 }