상속: ForeignKey
예제 #1
0
        public void LoadBinaryData(byte[] inData)
        {
            using (MemoryStream ms = new MemoryStream(inData))
            {
                using (BinaryReader br = new BinaryReader(ms))
                {
                    this.GroupNameOffset = br.ReadUInt32();
                    this.DescriptiveGroupNameOffset = br.ReadUInt32();

                    this.Flags = (GroupFlags) br.ReadUInt32();

                    this.BoundingBox = br.ReadBox();

                    this.PortalReferenceStartingIndex = br.ReadUInt16();
                    this.PortalReferenceCount = br.ReadUInt16();

                    this.RenderBatchCountA = br.ReadUInt16();
                    this.RenderBatchCountInterior = br.ReadUInt16();
                    this.RenderBatchCountExterior = br.ReadUInt16();
                    this.Unknown = br.ReadUInt16();

                    for (int i = 0; i < 4; ++i)
                    {
                        this.FogIndices.Add(br.ReadByte());
                    }

                    this.LiquidType = br.ReadUInt32();
                    this.GroupID = new UInt32ForeignKey("WMOAreaTable", "WMOGroupID", br.ReadUInt32());

                    this.UnknownFlags = br.ReadUInt32();
                    this.Unused = br.ReadUInt32();

                    // Required subchunks
                    this.PolygonMaterials = br.ReadIFFChunk<ModelPolygonMaterials>();
                    this.VertexIndices = br.ReadIFFChunk<ModelVertexIndices>();
                    this.Vertices = br.ReadIFFChunk<ModelVertices>();
                    this.Normals = br.ReadIFFChunk<ModelNormals>();
                    this.TextureCoordinates = br.ReadIFFChunk<ModelTextureCoordinates>();
                    this.RenderBatches = br.ReadIFFChunk<ModelRenderBatches>();

                    // Optional chunks
                    if (br.PeekChunkSignature() == MOBS.Signature)
                    {
                        this.mobs = br.ReadIFFChunk<MOBS>();
                    }

                    if (this.Flags.HasFlag(GroupFlags.HasLights))
                    {
                        this.LightReferences = br.ReadIFFChunk<ModelLightReferences>();
                    }

                    if (this.Flags.HasFlag(GroupFlags.HasDoodads))
                    {
                        this.DoodadReferences = br.ReadIFFChunk<ModelDoodadReferences>();
                    }

                    if (this.Flags.HasFlag(GroupFlags.HasBSP))
                    {
                        this.BSPNodes = br.ReadIFFChunk<ModelBSPNodes>();
                        this.BSPFaceIndices = br.ReadIFFChunk<ModelBSPFaceIndices>();
                    }

                    if (this.Flags.HasFlag(GroupFlags.UnknownLODRelated))
                    {
                        this.mpbv = br.ReadIFFChunk<MPBV>();
                        this.mpbp = br.ReadIFFChunk<MPBP>();
                        this.mpbi = br.ReadIFFChunk<MPBI>();
                        this.mpbg = br.ReadIFFChunk<MPBG>();
                    }

                    if (this.Flags.HasFlag(GroupFlags.HasVertexColours))
                    {
                        this.VertexColours = br.ReadIFFChunk<ModelVertexColours>();
                    }

                    if (this.Flags.HasFlag(GroupFlags.HasLiquids))
                    {
                        this.Liquids = br.ReadIFFChunk<ModelLiquids>();
                    }

                    if (this.Flags.HasFlag(GroupFlags.HasTriangleStrips))
                    {
                        this.TriangleStripIndices = br.ReadIFFChunk<ModelTriangleStripIndices>();
                        this.TriangleStrips = br.ReadIFFChunk<ModelTriangleStrips>();
                    }

                    if (this.Flags.HasFlag(GroupFlags.HasTwoTextureCoordinateSets))
                    {
                        this.AdditionalTextureCoordinates = br.ReadIFFChunk<ModelTextureCoordinates>();
                    }

                    if (this.Flags.HasFlag(GroupFlags.HasTwoVertexShadingSets))
                    {
                        this.AdditionalVertexColours = br.ReadIFFChunk<ModelVertexColours>();
                    }

                    if (this.Flags.HasFlag(GroupFlags.HasThreeTextureCoordinateSets))
                    {
                        this.SecondAddtionalTextureCoordinates = br.ReadIFFChunk<ModelTextureCoordinates>();
                    }
                }
            }
        }
예제 #2
0
        public ModelMaterial(byte[] inData)
        {
            using (MemoryStream ms = new MemoryStream(inData))
            {
                using (BinaryReader br = new BinaryReader(ms))
                {
                    this.Flags = (MaterialFlags) br.ReadUInt32();
                    this.Shader = (ShaderTypes) br.ReadUInt32();
                    this.BlendMode = (BlendingMode) br.ReadUInt32();

                    this.FirstTextureOffset = br.ReadUInt32();
                    this.FirstColour = br.ReadRGBA();
                    this.FirstFlags  = (MaterialFlags)br.ReadUInt32();

                    this.SecondTextureOffset = br.ReadUInt32();
                    this.SecondColour = br.ReadRGBA();

                    this.GroundType = new UInt32ForeignKey("TerrainType", "ID", br.ReadUInt32());
                    this.ThirdTextureOffset = br.ReadUInt32();
                    this.BaseDiffuseColour = br.ReadRGBA();
                    this.ThirdFlags = (MaterialFlags)br.ReadUInt32();

                    this.RuntimeData1 = br.ReadUInt32();
                    this.RuntimeData2 = br.ReadUInt32();
                    this.RuntimeData3 = br.ReadUInt32();
                    this.RuntimeData4 = br.ReadUInt32();
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Loads and parses the provided data.
        /// </summary>
        /// <param name="data">Data.</param>
        public override void LoadData(byte[] data)
        {
            if (this.Version == WarcraftVersion.Unknown)
            {
                throw new InvalidOperationException("The record data cannot be loaded before SetVersion has been called.");
            }

            using (MemoryStream ms = new MemoryStream(data))
            {
                using (BinaryReader br = new BinaryReader(ms))
                {
                    this.ID = br.ReadUInt32();
                    this.Name = new StringReference(br.ReadUInt32());

                    this.Type = (LiquidType)br.ReadInt32();

                    this.SpellEffect = new UInt32ForeignKey(SpellRecord.RecordName, "ID", br.ReadUInt32());
                }
            }
        }
예제 #4
0
        public void LoadBinaryData(byte[] inData)
        {
            using (MemoryStream ms = new MemoryStream(inData))
            {
                using (BinaryReader br = new BinaryReader(ms))
                {
                    this.TextureCount = br.ReadUInt32();
                    this.GroupCount = br.ReadUInt32();
                    this.PortalCount = br.ReadUInt32();
                    this.LightCount = br.ReadUInt32();
                    this.DoodadNameCount = br.ReadUInt32();
                    this.DoodadDefinitionCount = br.ReadUInt32();
                    this.DoodadSetCount = br.ReadUInt32();

                    this.BaseAmbientColour = br.ReadRGBA();
                    this.AreaTableID = new UInt32ForeignKey("WMOAreaTable", "WMOID", br.ReadUInt32());
                    this.BoundingBox = br.ReadBox();
                    this.Flags = (RootFlags) br.ReadUInt32();
                }
            }
        }
예제 #5
0
        /// <summary>
        /// Loads and parses the provided data.
        /// </summary>
        /// <param name="data">Data.</param>
        public override void LoadData(byte[] data)
        {
            if (this.Version == WarcraftVersion.Unknown)
            {
                throw new InvalidOperationException("The record data cannot be loaded before SetVersion has been called.");
            }

            using (MemoryStream ms = new MemoryStream(data))
            {
                using (BinaryReader br = new BinaryReader(ms))
                {
                    this.ID = br.ReadUInt32();
                    this.Name = new StringReference(br.ReadUInt32());

                    if (this.Version >= WarcraftVersion.Warlords)
                    {
                        this.WeaponFlags = (WeaponAnimationFlags)br.ReadUInt32();
                        this.BodyFlags = br.ReadUInt32();
                    }

                    this.Flags = br.ReadUInt32();

                    this.FallbackAnimation = new UInt32ForeignKey(RecordName, "ID", br.ReadUInt32());
                    this.BehaviourAnimation = new UInt32ForeignKey(RecordName, "ID", br.ReadUInt32());

                    if (this.Version >= WarcraftVersion.Wrath)
                    {
                        this.BehaviourTier = br.ReadUInt32();
                    }
                }
            }
        }