示例#1
0
        internal static W3dMeshAabTree Parse(BinaryReader reader, W3dParseContext context)
        {
            return(ParseChunk <W3dMeshAabTree>(reader, context, header =>
            {
                var result = new W3dMeshAabTree();
                ParseChunks(reader, context.CurrentEndPosition, chunkType =>
                {
                    switch (chunkType)
                    {
                    case W3dChunkType.W3D_CHUNK_AABTREE_HEADER:
                        result.Header = W3dMeshAabTreeHeader.Parse(reader, context);
                        break;

                    case W3dChunkType.W3D_CHUNK_AABTREE_POLYINDICES:
                        result.PolygonIndices = W3dMeshAabTreePolyIndices.Parse(reader, context);
                        break;

                    case W3dChunkType.W3D_CHUNK_AABTREE_NODES:
                        result.Nodes = W3dMeshAabTreeNodes.Parse(reader, context);
                        break;

                    default:
                        throw CreateUnknownChunkException(chunkType);
                    }
                });
                return result;
            }));
        }
示例#2
0
        internal static W3dMeshAabTreeHeader Parse(BinaryReader reader, W3dParseContext context)
        {
            return(ParseChunk(reader, context, header =>
            {
                var result = new W3dMeshAabTreeHeader
                {
                    NodeCount = reader.ReadUInt32(),
                    PolyCount = reader.ReadUInt32()
                };

                reader.ReadBytes(6 * sizeof(uint)); // Padding

                return result;
            }));
        }