示例#1
0
        internal LodCollection(OptReader reader) : base()
        {
            int lodChildCount      = reader.ReadInt32();
            int lodChildOffset     = reader.ReadInt32();
            int lodThresholdCount  = reader.ReadInt32();
            int lodThresholdOffset = reader.ReadInt32();

            // No idea why this would happen, but my understanding of this block is wrong if it does.
            if (lodChildCount != lodThresholdCount)
            {
                reader.logger?.Invoke(String.Format(CultureInfo.CurrentCulture, "Not the same number of LOD meshes ({0}) as LOD offsets ({1}) at {2:X}", lodChildCount, lodThresholdCount, reader.BaseStream.Position));
            }

            reader.Seek(lodChildOffset);
            ReadChildren(reader, lodChildCount, lodChildOffset);

            reader.Seek(lodThresholdOffset);
            MaxRenderDistance.Clear();
            for (int i = 0; i < lodChildCount; i++)
            {
                float distance = reader.ReadSingle();
                MaxRenderDistance.Add(distance);
                // A distance of 0 represents infinate draw distance
                // Converting to PositiveInfinity sorts it correctly.
                distance = distance == 0 ? float.PositiveInfinity : distance;
            }
        }
示例#2
0
        internal NamedNodeCollection(OptReader reader, int nameOffset) : base()
        {
            var child_pp = reader.ReadInt32();

            reader.Seek(nameOffset);
            // arbitrary length null-terminated string
            Name = reader.ReadString(maxLen: 32);

            ReadChildren(reader, 1, child_pp);
        }