Пример #1
0
        internal static W3dTexture Parse(BinaryReader reader, W3dParseContext context)
        {
            return(ParseChunk(reader, context, header =>
            {
                var result = new W3dTexture();

                ParseChunks(reader, context.CurrentEndPosition, chunkType =>
                {
                    switch (chunkType)
                    {
                    case W3dChunkType.W3D_CHUNK_TEXTURE_NAME:
                        result.Name = W3dTextureName.Parse(reader, context);
                        break;

                    case W3dChunkType.W3D_CHUNK_TEXTURE_INFO:
                        result.TextureInfo = W3dTextureInfo.Parse(reader, context);
                        break;

                    default:
                        throw CreateUnknownChunkException(chunkType);
                    }
                });

                return result;
            }));
        }
Пример #2
0
        public static W3dTexture Parse(BinaryReader reader, uint chunkSize)
        {
            return(ParseChunk <W3dTexture>(reader, chunkSize, (result, header) =>
            {
                switch (header.ChunkType)
                {
                case W3dChunkType.W3D_CHUNK_TEXTURE_NAME:
                    result.Name = reader.ReadFixedLengthString((int)header.ChunkSize);
                    break;

                case W3dChunkType.W3D_CHUNK_TEXTURE_INFO:
                    result.TextureInfo = W3dTextureInfo.Parse(reader);
                    break;

                default:
                    throw CreateUnknownChunkException(header);
                }
            }));
        }