Esempio n. 1
0
        public AtomicSector_0009 Read(BinaryReader binaryReader)
        {
            sectionIdentifier = Section.AtomicSector;
            sectionSize       = binaryReader.ReadInt32();
            renderWareVersion = binaryReader.ReadInt32();

            long startSectionPosition = binaryReader.BaseStream.Position;

            Section atomicStructSection = (Section)binaryReader.ReadInt32();

            if (atomicStructSection != Section.Struct)
            {
                throw new Exception();
            }
            atomicSectorStruct = new AtomicSectorStruct_0001().Read(binaryReader);

            Section atomicExtensionSection = (Section)binaryReader.ReadInt32();

            if (atomicExtensionSection != Section.Extension)
            {
                throw new Exception();
            }
            atomicSectorExtension = new Extension_0003().Read(binaryReader);

            binaryReader.BaseStream.Position = startSectionPosition + sectionSize;

            return(this);
        }
Esempio n. 2
0
        public TextureNative_0015 FromBytes(byte[] data)
        {
            BinaryReader binaryReader = new BinaryReader(new MemoryStream(data));

            sectionIdentifier = (Section)binaryReader.ReadInt32();
            if (sectionIdentifier != Section.TextureNative)
            {
                throw new Exception(binaryReader.BaseStream.Position.ToString());
            }

            sectionSize       = binaryReader.ReadInt32();
            renderWareVersion = binaryReader.ReadInt32();

            Section textureNativeStructSection = (Section)binaryReader.ReadInt32();

            if (textureNativeStructSection != Section.Struct)
            {
                throw new Exception(binaryReader.BaseStream.Position.ToString());
            }
            textureNativeStruct = new TextureNativeStruct_0001().Read(binaryReader);

            Section textureNativeExtensionSection = (Section)binaryReader.ReadInt32();

            if (textureNativeExtensionSection == Section.Extension)
            {
                textureNativeExtension = new Extension_0003().Read(binaryReader);
            }

            return(this);
        }
Esempio n. 3
0
        public Material_0007 Read(BinaryReader binaryReader)
        {
            sectionIdentifier = Section.Material;
            sectionSize       = binaryReader.ReadInt32();
            renderWareVersion = binaryReader.ReadInt32();

            Section materialListStructSection = (Section)binaryReader.ReadInt32();

            if (materialListStructSection != Section.Struct)
            {
                throw new Exception();
            }
            materialStruct = new MaterialStruct_0001().Read(binaryReader);

            if (materialStruct.isTextured != 0)
            {
                Section textureSection = (Section)binaryReader.ReadInt32();
                if (textureSection != Section.Texture)
                {
                    throw new Exception();
                }
                texture = new Texture_0006().Read(binaryReader);
            }

            Section materialExtensionSection = (Section)binaryReader.ReadInt32();

            if (materialExtensionSection != Section.Extension)
            {
                throw new Exception();
            }
            materialExtension = new Extension_0003().Read(binaryReader);

            return(this);
        }
Esempio n. 4
0
 public Texture_0006()
 {
     textureStruct      = new TextureStruct_0001();
     diffuseTextureName = new String_0002();
     alphaTextureName   = new String_0002();
     textureExtension   = new Extension_0003();
 }
Esempio n. 5
0
        public Clump_0010 Read(BinaryReader binaryReader)
        {
            sectionIdentifier = Section.Clump;
            sectionSize       = binaryReader.ReadInt32();
            renderWareVersion = binaryReader.ReadInt32();

            long startSectionPosition = binaryReader.BaseStream.Position;

            Section clumpStructSection = (Section)binaryReader.ReadInt32();

            if (clumpStructSection != Section.Struct)
            {
                throw new Exception(binaryReader.BaseStream.ToString());
            }
            clumpStruct = new ClumpStruct_0001().Read(binaryReader);

            Section frameListSection = (Section)binaryReader.ReadInt32();

            if (frameListSection != Section.FrameList)
            {
                throw new Exception(binaryReader.BaseStream.ToString());
            }
            frameList = new FrameList_000E().Read(binaryReader);

            Section geometryListSection = (Section)binaryReader.ReadInt32();

            if (geometryListSection != Section.GeometryList)
            {
                throw new Exception(binaryReader.BaseStream.ToString());
            }
            geometryList = new GeometryList_001A().Read(binaryReader);

            atomicList = new List <Atomic_0014>();
            for (int i = 0; i < clumpStruct.atomicCount; i++)
            {
                Section atomicListSection = (Section)binaryReader.ReadInt32();
                if (atomicListSection != Section.Atomic)
                {
                    throw new Exception(binaryReader.BaseStream.Position.ToString());
                }
                atomicList.Add(new Atomic_0014().Read(binaryReader, atomicListSection));
            }

            Section clumpExtensionSection = (Section)binaryReader.ReadInt32();

            if (clumpExtensionSection == Section.Extension)
            {
                clumpExtension = new Extension_0003().Read(binaryReader);
            }

            //binaryReader.BaseStream.Position = startSectionPosition + sectionSize;

            return(this);
        }
Esempio n. 6
0
        public World_000B Read(BinaryReader binaryReader)
        {
            sectionIdentifier = Section.World;
            sectionSize       = binaryReader.ReadInt32();
            renderWareVersion = binaryReader.ReadInt32();

            long startSectionPosition = binaryReader.BaseStream.Position;

            Section worldStructSection = (Section)binaryReader.ReadInt32();

            if (worldStructSection != Section.Struct)
            {
                throw new Exception(binaryReader.BaseStream.Position.ToString());
            }
            worldStruct = new WorldStruct_0001().Read(binaryReader);

            Section materialListSection = (Section)binaryReader.ReadInt32();

            if (materialListSection != Section.MaterialList)
            {
                throw new Exception();
            }
            materialList = new MaterialList_0008().Read(binaryReader);

            Section firstWorldChunkSection = (Section)binaryReader.ReadInt32();

            if (firstWorldChunkSection == Section.AtomicSector)
            {
                firstWorldChunk = new AtomicSector_0009().Read(binaryReader);
            }
            else if (firstWorldChunkSection == Section.PlaneSector)
            {
                firstWorldChunk = new PlaneSector_000A().Read(binaryReader);
            }
            else
            {
                throw new Exception();
            }

            Section worldExtensionSection = (Section)binaryReader.ReadInt32();

            if (worldExtensionSection == Section.Extension)
            {
                worldExtension = new Extension_0003().Read(binaryReader);
            }

            binaryReader.BaseStream.Position = startSectionPosition + sectionSize;

            return(this);
        }
Esempio n. 7
0
        public Texture_0006 Read(BinaryReader binaryReader)
        {
            sectionIdentifier = Section.Texture;
            sectionSize       = binaryReader.ReadInt32();
            renderWareVersion = binaryReader.ReadInt32();

            Section textureStructSection = (Section)binaryReader.ReadInt32();

            if (textureStructSection != Section.Struct)
            {
                throw new Exception();
            }
            textureStruct = new TextureStruct_0001().Read(binaryReader);

            Section diffuseTextureNameSection = (Section)binaryReader.ReadInt32();

            if (diffuseTextureNameSection != Section.String)
            {
                throw new Exception();
            }
            diffuseTextureName = new String_0002().Read(binaryReader);

            Section alphaTextureNameSection = (Section)binaryReader.ReadInt32();

            if (alphaTextureNameSection != Section.String)
            {
                throw new Exception();
            }
            alphaTextureName = new String_0002().Read(binaryReader);

            Section textureExtensionSection = (Section)binaryReader.ReadInt32();

            if (textureExtensionSection != Section.Extension)
            {
                throw new Exception();
            }
            textureExtension = new Extension_0003().Read(binaryReader);

            return(this);
        }
Esempio n. 8
0
        public TextureDictionary_0016 Read(BinaryReader binaryReader)
        {
            sectionIdentifier = Section.TextureDictionary;
            sectionSize       = binaryReader.ReadInt32();
            renderWareVersion = binaryReader.ReadInt32();

            long startSectionPosition = binaryReader.BaseStream.Position;

            Section textureDictionaryStructSection = (Section)binaryReader.ReadInt32();

            if (textureDictionaryStructSection != Section.Struct)
            {
                throw new Exception(binaryReader.BaseStream.Position.ToString());
            }
            textureDictionaryStruct = new TextureDictionaryStruct_0001().Read(binaryReader);

            textureNativeList = new List <TextureNative_0015>();

            for (int i = 0; i < textureDictionaryStruct.textureCount; i++)
            {
                Section textureNativeSection = (Section)binaryReader.ReadInt32();
                if (textureNativeSection != Section.TextureNative)
                {
                    throw new Exception(binaryReader.BaseStream.Position.ToString());
                }
                textureNativeList.Add(new TextureNative_0015().Read(binaryReader));
            }

            Section textureDictionaryExtensionSection = (Section)binaryReader.ReadInt32();

            if (textureDictionaryExtensionSection == Section.Extension)
            {
                textureDictionaryExtension = new Extension_0003().Read(binaryReader);
            }

            binaryReader.BaseStream.Position = startSectionPosition + sectionSize;

            return(this);
        }
Esempio n. 9
0
        public TextureNative_0015 Read(BinaryReader binaryReader)
        {
            sectionIdentifier = Section.TextureNative;
            sectionSize       = binaryReader.ReadInt32();
            renderWareVersion = binaryReader.ReadInt32();

            Section textureNativeStructSection = (Section)binaryReader.ReadInt32();

            if (textureNativeStructSection != Section.Struct)
            {
                throw new Exception(binaryReader.BaseStream.Position.ToString());
            }
            textureNativeStruct = new TextureNativeStruct_0001().Read(binaryReader);

            Section textureNativeExtensionSection = (Section)binaryReader.ReadInt32();

            if (textureNativeExtensionSection == Section.Extension)
            {
                textureNativeExtension = new Extension_0003().Read(binaryReader);
            }

            return(this);
        }
Esempio n. 10
0
        public Geometry_000F Read(BinaryReader binaryReader)
        {
            sectionIdentifier = Section.Geometry;
            sectionSize       = binaryReader.ReadInt32();
            renderWareVersion = binaryReader.ReadInt32();

            long startSectionPosition = binaryReader.BaseStream.Position;

            Section geometryStructSection = (Section)binaryReader.ReadInt32();

            if (geometryStructSection != Section.Struct)
            {
                throw new Exception(binaryReader.BaseStream.Position.ToString());
            }
            geometryStruct = new GeometryStruct_0001().Read(binaryReader);

            Section materialListSection = (Section)binaryReader.ReadInt32();

            if (materialListSection != Section.MaterialList)
            {
                throw new Exception(binaryReader.BaseStream.Position.ToString());
            }
            materialList = new MaterialList_0008().Read(binaryReader);

            Section geometryExtensionSection = (Section)binaryReader.ReadInt32();

            if (geometryExtensionSection != Section.Extension)
            {
                throw new Exception(binaryReader.BaseStream.Position.ToString());
            }
            geometryExtension = new Extension_0003().Read(binaryReader);

            binaryReader.BaseStream.Position = startSectionPosition + sectionSize;

            return(this);
        }