Пример #1
0
 public VertexMapPoint(VertexMap vertex_map, uint index)
 {
     VertexMap = vertex_map; Index = index;
 }
Пример #2
0
        public static VertexMap ReadVertexMap(ChunkReader reader, bool perpoly)
        {
            var type		= reader.ReadID<VertexMapType>();
            var dimensions	= reader.ReadUInt16();
            var name		= reader.ReadString();

            var vertex_map	= new VertexMap(type, name, perpoly);

            var vertex_indices	= new List<uint>();
            var polygon_indices	= new List<uint>();
            var values			= new List<float[]>();

            // fill in the vertex-map values
            while (reader.BytesLeft > 0)
            {
                vertex_indices.Add(reader.ReadVariableLengthIndex());
                if (perpoly)
                    polygon_indices.Add(reader.ReadVariableLengthIndex());

                var pointValues = new float[dimensions];
                for (var j = 0; j < dimensions; j++)
                    pointValues[j] = reader.ReadSingle();
                values.Add(pointValues);
            }
            vertex_map.Values = values.ToArray();
            vertex_map.vertex_index = vertex_indices.ToArray();
            if (perpoly)
                vertex_map.polygon_index = polygon_indices.ToArray();
            return vertex_map;
        }