Пример #1
0
 void ReadVisibility(Header header, BinaryReader br)
 {
     // Read Vis
     br.BaseStream.Seek(header.lumps[4].fileofs, SeekOrigin.Begin);
     int nVis = header.lumps[4].filelen / 68;
     if (nVis > 0)
     {
         vis = new dvis_t();
         vis.numclusters = br.ReadInt32();
         vis.byteofs = new int[vis.numclusters][];
         for (int j = 0; j < vis.numclusters; j++)
         {
             vis.byteofs[j] = new int[] { br.ReadInt32(), br.ReadInt32() };
         }
         numClusters = vis.numclusters;
         // VisData
         br.BaseStream.Seek(header.lumps[4].fileofs, SeekOrigin.Begin);
         int nVisData = (int)(header.lumps[4].filelen);
         visibility = new byte[nVisData];
         for (int i = 0; i < nVisData; i++)
         {
             visibility[i] = br.ReadByte();
         }
         vised = true;
     }
     else
     {
         int clusterBytes = (numClusters +31 )& ~31;
         visibility = new byte[clusterBytes];
         for (int i = 0; i < clusterBytes; i++)
         {
             visibility[i] = 255;
         }
     }
 }
Пример #2
0
        public void clear()
        {
            this.name = "";
            this.registration_sequence = 0;

            // was enum modtype_t
            this.type      = 0;
            this.numframes = 0;
            this.flags     = 0;

            //
            // volume occupied by the model graphics
            //
            Math3D.VectorClear(this.mins);
            Math3D.VectorClear(this.maxs);
            this.radius = 0;

            //
            // solid volume for clipping
            //
            this.clipbox = false;
            Math3D.VectorClear(this.clipmins);
            Math3D.VectorClear(this.clipmaxs);

            //
            // brush model
            //
            this.firstmodelsurface = this.nummodelsurfaces = 0;
            this.lightmap          = 0;    // only for submodels

            this.numsubmodels = 0;
            this.submodels    = null;

            this.numplanes = 0;
            this.planes    = null;

            this.numleafs = 0;             // number of visible leafs, not counting 0
            this.leafs    = null;

            this.numvertexes = 0;
            this.vertexes    = null;

            this.numedges = 0;
            this.edges    = null;

            this.numnodes  = 0;
            this.firstnode = 0;
            this.nodes     = null;

            this.numtexinfo = 0;
            this.texinfo    = null;

            this.numsurfaces = 0;
            this.surfaces    = null;

            this.numsurfedges = 0;
            this.surfedges    = null;

            this.nummarksurfaces = 0;
            this.marksurfaces    = null;

            this.vis = null;

            this.lightdata = null;

            // for alias models and skins
            // was image_t *skins[]; (array of pointers)
            Array.Fill(this.skins, null);

            this.extradatasize = 0;

            // or whatever
            this.extradata = null;
        }
Пример #3
0
 public void ClearMap()
 {
     name = null;
     numBrushSides = 0;
     brushsides = new List<dbrushside_t>();
     planes = new List<cplane_t>();
     numNodes = 0;
     nodes = null;
     numLeafs = 0;
     leafs = null;
     numLeafBrushes = 0;
     leafbrushes = new List<int>();
     leafFaces = new List<int>();
     numSubModels = 0;
     cmodels = null;
     brushes = new List<dbrush_t>();
     numClusters = 0;
     clusterBytes = 0;
     visibility = null;
     vised = false;			// if false, visibility is just a single cluster of ffs
     entityString = null;
     numAreas = 0;
     numSurfaces = 0;
     floodvalid = 0;
     checkcount = 0;					// incremented on each trace
     c_traces = 0;
     c_brush_traces = 0;
     texinfos = null;
     box_model = new cmodel_t();
     box_planes = new List<cplane_t>();
     box_brush = new dbrush_t();
     vis = new dvis_t();
     edges  = null;
     DispIndexToFaceIndex  = null;
     ddispinfos  = null;
     dispLightmapSamples  = null;
     dispVerts  = null;
     dispTris  = null;
     dispCollTrees  = null;
     surfEdges = null;
 }