예제 #1
0
        public void Read(BinaryReader reader, TTMHeader header,
                         TriVertices vertices, TTMTriangles triangles, int TriNumber)
        {
            for (int i = 0; i < 3; i++)
            {
                int VertIndex = Utilities.ReadInteger(reader, header.VertexNumberSize);

                Vertices[i] = (VertIndex <1 || VertIndex> vertices.Count) ? null : vertices[VertIndex - 1];

                //{$ifdef LoadTTMIndices}
                //VertexIndices[i] := VertexIndex;
                //{$endif}
            }

            for (int i = 0; i < 3; i++)
            {
                int NeighbourIndex = Utilities.ReadInteger(reader, header.TriangleNumberSize);

                Neighbours[i] = (NeighbourIndex <1 || NeighbourIndex> triangles.Count) ? null : triangles[NeighbourIndex - 1];

                //{$ifdef LoadTTMIndices}
                //NeighbourIndices[i] := NeighbourIndex;
                //{$endif}
            }
        }
예제 #2
0
 protected override void CreateLists(out TriVertices vertices, out Triangles triangles)
 {
   // Note : Do NOT call inherited here, doing so will cause a memory leak as the
   //        Vertices and Triangles lists create in the inherited method are then lost
   //        by being overwritten here.  
   vertices = new TTMVertices();
   triangles = new TTMTriangles();
 }
예제 #3
0
        public void Read(BinaryReader reader, TTMHeader header, TriVertices vertices)
        {
            Capacity = header.NumberOfTriangles;

            // Create objects first as we need neighbour triangles to exist
            for (int i = 0; i < header.NumberOfTriangles; i++)
            {
                Add(new TTMTriangle(null, null, null));
            }

            NumberTriangles();

            for (int i = 0; i < Count; i++)
            {
                long RecPos = reader.BaseStream.Position;
                (this[i] as TTMTriangle).Read(reader, header, vertices, this, i + 1);
                reader.BaseStream.Position = RecPos + header.TriangleRecordSize;
            }
        }
예제 #4
0
 protected virtual void CreateLists(out TriVertices _vertices, out Triangles _triangles)
 {
     _vertices  = new TriVertices();
     _triangles = new Triangles();
 }