コード例 #1
0
        public override bool Load(BinaryReader reader)
        {
            Faces    = new List <Face>();
            Vertices = new List <Vertex>();

            Start(reader);
            if (!ReadHeader(reader) || !IsValidVersion(1, 2))
            {
                return(false);
            }

            BoundingVolume = new BVOLChunk();
            if (!BoundingVolume.Load(reader))
            {
                return(false);
            }

            IndexCount  = reader.ReadUInt32();
            VertexCount = reader.ReadUInt32();

            LogInfo("vertices offset: " + reader.BaseStream.Position);
            for (UInt32 i = 0; i < VertexCount; i++)
            {
                Vertex vertex = reader.ReadVertex();
                Vertices.Add(vertex);
            }

            LogInfo("faces offset: " + reader.BaseStream.Position);
            for (UInt32 i = 0; i < IndexCount; i++)
            {
                Face face = reader.ReadFace();
                Faces.Add(face);
            }

            if (Header.Version == 2)
            {
                Unknown1 = reader.ReadBoolean();
            }

            LogInfo("face count: " + IndexCount);
            LogInfo("vertex count: " + VertexCount);
            LogInfo("unk1: " + Unknown1);

            End(reader);
            return(true);
        }
コード例 #2
0
ファイル: BVSPChunk.cs プロジェクト: Sadral/TRRM
        public override bool Load(BinaryReader reader)
        {
            Start(reader);
            if (!ReadHeader(reader) || !IsValidVersion(1))
            {
                return(false);
            }

            BoundingVolume = new BVOLChunk();
            if (!BoundingVolume.Load(reader))
            {
                return(false);
            }

            Vertex = reader.ReadVertex();
            Radius = reader.ReadSingle();

            End(reader);
            return(true);
        }