/////////PARENTS FUNCTION////////// public override void Load(BinaryReader reader, int size) { if (size < 20) { isEmpty = true; return; } someNumber = reader.ReadUInt32(); uint triggerCount = reader.ReadUInt32(); uint groupCount = reader.ReadUInt32(); uint triCount = reader.ReadUInt32(); uint vertexCount = reader.ReadUInt32(); Triggers.Clear(); Groups.Clear(); Tris.Clear(); Vertices.Clear(); for (int i = 0; i < triggerCount; i++) { Trigger trg = new Trigger { X1 = reader.ReadSingle(), Y1 = reader.ReadSingle(), Z1 = reader.ReadSingle(), Flag1 = reader.ReadInt32(), X2 = reader.ReadSingle(), Y2 = reader.ReadSingle(), Z2 = reader.ReadSingle(), Flag2 = reader.ReadInt32() }; Triggers.Add(trg); } for (int i = 0; i < groupCount; i++) { GroupInfo grp = new GroupInfo { Size = reader.ReadUInt32(), Offset = reader.ReadUInt32() }; Groups.Add(grp); } for (int i = 0; i < triCount; i++) { ColTri tri = new ColTri(); ulong legacy = reader.ReadUInt64(); tri.Vert1 = (int)(legacy & mask); tri.Vert2 = (int)((legacy >> 18 * 1) & mask); tri.Vert3 = (int)((legacy >> 18 * 2) & mask); tri.Surface = (int)(legacy >> (18 * 3)); Tris.Add(tri); } for (int i = 0; i < vertexCount; i++) { Pos vtx = new Pos(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); Vertices.Add(vtx); } }
private void StartTubeSegment() { currentSegmentLength = 0; Verts.Clear(); Tris.Clear(); UVs.Clear(); CurrentSegment = new GameObject(); CurrentSegment.AddComponent <MeshFilter>(); CurrentSegment.AddComponent <MeshRenderer>(); Mesh = CurrentSegment.GetComponent <MeshFilter>().mesh; Mesh.MarkDynamic(); CurrentSegment.GetComponent <Renderer>().material = Material; Mesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32; UpdateVertsAndUVs(); Mesh.RecalculateNormals(); LoopCount = 1; }