Esempio n. 1
0
        internal static W3dHModelAuxData Parse(BinaryReader reader, W3dParseContext context)
        {
            return(ParseChunk(reader, context, header =>
            {
                var result = new W3dHModelAuxData
                {
                    Attributes = reader.ReadUInt32(),
                    MeshCount = reader.ReadUInt32(),
                    CollisionCount = reader.ReadUInt32(),
                    SkinCount = reader.ReadUInt32(),
                    FutureCounts = new uint[8]
                };

                for (int i = 0; i < 8; i++)
                {
                    result.FutureCounts[i] = reader.ReadUInt32();
                }

                result.LodMin = reader.ReadSingle();
                result.LodMax = reader.ReadSingle();

                result.FutureUse = reader.ReadBytes((int)context.CurrentEndPosition - (int)reader.BaseStream.Position);

                // TODO: Determine If FutureUse are used anywhere or are different between games?

                return result;
            }));
        }
Esempio n. 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;
            }));
        }