private static Visdata ReadVisDataLump(IntPtr ptr, LumpEntry def) { Visdata visData = new Visdata(); if (def.Length > 0) { IntPtr lumpPtr = ptr + def.Offset; visData.NumberVectors = Marshal.ReadInt32(lumpPtr); visData.VectorSize = Marshal.ReadInt32(lumpPtr + sizeof(int)); visData.Vectors = new byte[visData.NumberVectors * visData.VectorSize]; Marshal.Copy(lumpPtr + 2 * sizeof(int), visData.Vectors, 0, visData.Vectors.Length); } return(visData); }
public Bsp(string filepath) { Bsp bsp = BspReader.Read(filepath); Header = bsp.Header; Entity = bsp.Entity; Textures = bsp.Textures; Planes = bsp.Planes; Nodes = bsp.Nodes; Leafs = bsp.Leafs; LeafFaces = bsp.LeafFaces; LeafBrushs = bsp.LeafBrushs; Models = bsp.Models; Brushs = bsp.Brushs; BrushSides = bsp.BrushSides; Vertices = bsp.Vertices; MeshVerts = bsp.MeshVerts; Effects = bsp.Effects; Faces = bsp.Faces; LightMaps = bsp.LightMaps; LightVols = bsp.LightVols; Visdata = bsp.Visdata; }
private static byte[] GetVisdataBytes(Visdata visdata) { byte[] bytesNumVectors = BitConverter.GetBytes(visdata.NumberVectors); byte[] bytesVectorSize = BitConverter.GetBytes(visdata.VectorSize); return(Combine(bytesNumVectors, bytesVectorSize, visdata.Vectors)); }