Exemple #1
0
        internal static W3dCollisionNode Parse(BinaryReader reader, W3dParseContext context)
        {
            return(ParseChunk(reader, context, header =>
            {
                var result = new W3dCollisionNode
                {
                    UnknownBytes = reader.ReadBytes((int)context.CurrentEndPosition - (int)reader.BaseStream.Position)
                };

                // TODO: Determine W3dCollisionNode UnknownBytes

                return result;
            }));
        }
Exemple #2
0
        internal static W3dHModel Parse(BinaryReader reader, W3dParseContext context)
        {
            return(ParseChunk(reader, context, header =>
            {
                var result = new W3dHModel();

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

                    case W3dChunkType.W3D_CHUNK_NODE:
                        result.Node = W3dNode.Parse(reader, context);
                        break;

                    case W3dChunkType.W3D_CHUNK_COLLISION_NODE:
                        result.CollisionNode = W3dCollisionNode.Parse(reader, context);
                        break;

                    case W3dChunkType.W3D_CHUNK_SKIN_NODE:
                        result.SkinNode = W3dSkinNode.Parse(reader, context);
                        break;

                    case W3dChunkType.OBSOLETE_W3D_CHUNK_HMODEL_AUX_DATA:
                        result.AuxData = W3dHModelAuxData.Parse(reader, context);
                        break;

                    case W3dChunkType.OBSOLETE_W3D_CHUNK_SHADOW_NODE:
                        result.ShadowNode = W3dShadowNode.Parse(reader, context);
                        break;

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

                return result;
            }));
        }