예제 #1
0
        internal static W3dAnimation Parse(BinaryReader reader, W3dParseContext context)
        {
            return(ParseChunk(reader, context, header =>
            {
                var result = new W3dAnimation();

                ParseChunks(reader, context.CurrentEndPosition, chunkType =>
                {
                    switch (chunkType)
                    {
                    case W3dChunkType.W3D_CHUNK_ANIMATION_HEADER:
                        result.Header = W3dAnimationHeader.Parse(reader, context);
                        break;

                    case W3dChunkType.W3D_CHUNK_ANIMATION_CHANNEL:
                        result.Channels.Add(W3dAnimationChannel.Parse(reader, context));
                        break;

                    case W3dChunkType.W3D_CHUNK_BIT_CHANNEL:
                        result.Channels.Add(W3dBitChannel.Parse(reader, context));
                        break;

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

                return result;
            }));
        }