Exemplo n.º 1
0
        internal static W3dCollection Parse(BinaryReader reader, W3dParseContext context)
        {
            return(ParseChunk(reader, context, header =>
            {
                var result = new W3dCollection();

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

                    case W3dChunkType.W3D_CHUNK_COLLECTION_OBJ_NAME:
                        result.ObjName = W3dCollectionObjName.Parse(reader, context);
                        break;

                    case W3dChunkType.W3D_CHUNK_PLACEHOLDER:
                        result.Placeholder = W3dCollectionPlaceholder.Parse(reader, context);
                        break;

                    case W3dChunkType.W3D_CHUNK_TRANSFORM_NODE:
                        result.TransformNode = W3dCollectionTransformNode.Parse(reader, context);
                        break;

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

                return result;
            }));
        }
Exemplo n.º 2
0
        internal static W3dCollectionTransformNode Parse(BinaryReader reader, W3dParseContext context)
        {
            return(ParseChunk(reader, context, header =>
            {
                var result = new W3dCollectionTransformNode
                {
                    Name = reader.ReadFixedLengthString((int)header.ChunkSize),
                };

                return result;
            }));
        }