當前位置: 首頁>>代碼示例>>C#>>正文


C# BinaryWriter.WriteIFFChunk方法代碼示例

本文整理匯總了C#中System.IO.BinaryWriter.WriteIFFChunk方法的典型用法代碼示例。如果您正苦於以下問題:C# BinaryWriter.WriteIFFChunk方法的具體用法?C# BinaryWriter.WriteIFFChunk怎麽用?C# BinaryWriter.WriteIFFChunk使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.IO.BinaryWriter的用法示例。


在下文中一共展示了BinaryWriter.WriteIFFChunk方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Serialize

        public byte[] Serialize()
        {
            using (MemoryStream ms = new MemoryStream())
            {
                using (BinaryWriter bw = new BinaryWriter(ms))
                {
                    bw.Write(this.GroupNameOffset);
                    bw.Write(this.DescriptiveGroupNameOffset);

                    // Set the flags according to present chunks
                    UpdateFlags();
                    bw.Write((uint)this.Flags);

                    bw.WriteBox(this.BoundingBox);

                    bw.Write(this.PortalReferenceStartingIndex);
                    bw.Write(this.PortalReferenceCount);

                    bw.Write(this.RenderBatchCountA);
                    bw.Write(this.RenderBatchCountInterior);
                    bw.Write(this.RenderBatchCountExterior);
                    bw.Write(this.Unknown);

                    foreach (byte fogIndex in this.FogIndices)
                    {
                        bw.Write(fogIndex);
                    }

                    bw.Write(this.LiquidType);
                    bw.Write(this.GroupID.Value);

                    bw.Write(this.UnknownFlags);
                    bw.Write(this.Unused);

                    // Write the mandatory chunks
                    bw.WriteIFFChunk(this.PolygonMaterials);
                    bw.WriteIFFChunk(this.VertexIndices);
                    bw.WriteIFFChunk(this.Vertices);
                    bw.WriteIFFChunk(this.Normals);
                    bw.WriteIFFChunk(this.TextureCoordinates);
                    bw.WriteIFFChunk(this.RenderBatches);

                    // Write the optional chunks based on flags
                    if (this.mobs != null)
                    {
                        bw.WriteIFFChunk(this.mobs);
                    }

                    if (this.Flags.HasFlag(GroupFlags.HasLights))
                    {
                        bw.WriteIFFChunk(this.LightReferences);
                    }

                    if (this.Flags.HasFlag(GroupFlags.HasDoodads))
                    {
                        bw.WriteIFFChunk(this.DoodadReferences);
                    }

                    if (this.Flags.HasFlag(GroupFlags.HasBSP))
                    {
                        bw.WriteIFFChunk(this.BSPNodes);
                        bw.WriteIFFChunk(this.BSPFaceIndices);
                    }

                    if (this.Flags.HasFlag(GroupFlags.UnknownLODRelated))
                    {
                        bw.WriteIFFChunk(this.mpbv);
                        bw.WriteIFFChunk(this.mpbp);
                        bw.WriteIFFChunk(this.mpbi);
                        bw.WriteIFFChunk(this.mpbg);
                    }

                    if (this.Flags.HasFlag(GroupFlags.HasVertexColours))
                    {
                        bw.WriteIFFChunk(this.VertexColours);
                    }

                    if (this.Flags.HasFlag(GroupFlags.HasLiquids))
                    {
                        bw.WriteIFFChunk(this.Liquids);
                    }

                    if (this.Flags.HasFlag(GroupFlags.HasTriangleStrips))
                    {
                        bw.WriteIFFChunk(this.TriangleStripIndices);
                        bw.WriteIFFChunk(this.TriangleStrips);
                    }

                    if (this.Flags.HasFlag(GroupFlags.HasTwoTextureCoordinateSets))
                    {
                        bw.WriteIFFChunk(this.AdditionalTextureCoordinates);
                    }

                    if (this.Flags.HasFlag(GroupFlags.HasTwoVertexShadingSets))
                    {
                        bw.WriteIFFChunk(this.AdditionalVertexColours);
                    }

                    if (this.Flags.HasFlag(GroupFlags.HasThreeTextureCoordinateSets))
                    {
//.........這裏部分代碼省略.........
開發者ID:Nihlus,項目名稱:libwarcraft,代碼行數:101,代碼來源:ModelGroupData.cs

示例2: Serialize

        public byte[] Serialize()
        {
            using (MemoryStream ms = new MemoryStream())
            {
                using (BinaryWriter bw = new BinaryWriter(ms))
                {
                    bw.WriteIFFChunk(this.Version);
                    bw.WriteIFFChunk(this.GroupData
                    );
                }

                return ms.ToArray();
            }
        }
開發者ID:Nihlus,項目名稱:libwarcraft,代碼行數:14,代碼來源:ModelGroup.cs

示例3: Serialize

        public byte[] Serialize()
        {
            using (MemoryStream ms = new MemoryStream())
            {
                using (BinaryWriter bw = new BinaryWriter(ms))
                {
                    bw.WriteIFFChunk(this.Version);
                    bw.WriteIFFChunk(this.Header);

                    bw.WriteIFFChunk(this.Textures);
                    bw.WriteIFFChunk(this.Materials);

                    bw.WriteIFFChunk(this.GroupNames);
                    bw.WriteIFFChunk(this.GroupInformation);

                    bw.WriteIFFChunk(this.Skybox);

                    bw.WriteIFFChunk(this.PortalVertices);
                    bw.WriteIFFChunk(this.Portals);
                    bw.WriteIFFChunk(this.PortalReferences);

                    bw.WriteIFFChunk(this.VisibleVertices);
                    bw.WriteIFFChunk(this.VisibleBlocks);

                    bw.WriteIFFChunk(this.StaticLighting);

                    bw.WriteIFFChunk(this.DoodadSets);
                    bw.WriteIFFChunk(this.DoodadPaths);
                    bw.WriteIFFChunk(this.DoodadInstances);

                    bw.WriteIFFChunk(this.Fog);

                    if (this.ConvexPlanes != null)
                    {
                        bw.WriteIFFChunk(this.ConvexPlanes);
                    }

                    if (this.GameObjectFileID != null)
                    {
                        bw.WriteIFFChunk(this.GameObjectFileID);
                    }
                }

                return ms.ToArray();
            }
        }
開發者ID:Nihlus,項目名稱:libwarcraft,代碼行數:46,代碼來源:ModelRoot.cs

示例4: Serialize

        public byte[] Serialize()
        {
            using (MemoryStream ms = new MemoryStream())
            {
                using (BinaryWriter bw = new BinaryWriter(ms))
                {
                    bw.WriteIFFChunk(this.Version);

                    // >= Wrath stores WMO data here as well
                    if (this.WorldModelObjects != null)
                    {
                        bw.WriteIFFChunk(this.WorldModelObjects);
                    }

                    if (this.WorldModelObjectIndices != null)
                    {
                        bw.WriteIFFChunk(this.WorldModelObjectIndices);
                    }

                    if (this.WorldModelObjectPlacementInfo != null)
                    {
                        bw.WriteIFFChunk(this.WorldModelObjectPlacementInfo);
                    }

                    // Populate the offset table
                    long writtenMapAreaSize = 0;
                    for (int y = 0; y < 64; ++y)
                    {
                        for (int x = 0; x < 64; ++x)
                        {
                            int mapAreaOffsetIndex = (y * 64) + x;
                            const uint offsetChunkHeaderSize = 8;

                            if (this.MapAreas[mapAreaOffsetIndex] != null)
                            {
                                // This tile is populated, so we update the offset table
                                uint newOffset = (uint) (ms.Position + offsetChunkHeaderSize + WorldLODMapAreaOffsets.GetSize() + writtenMapAreaSize);
                                this.MapAreaOffsets.MapAreaOffsets[mapAreaOffsetIndex] = newOffset;

                                writtenMapAreaSize += WorldLODMapArea.GetSize() + offsetChunkHeaderSize;
                            }

                            if (this.MapAreaHoles[mapAreaOffsetIndex] != null)
                            {
                                writtenMapAreaSize += WorldLODMapAreaHoles.GetSize() + offsetChunkHeaderSize;
                            }
                        }
                    }

                    // Write the offset table
                    bw.WriteIFFChunk(this.MapAreaOffsets);

                    // Write the valid entries
                    for (int y = 0; y < 64; ++y)
                    {
                        for (int x = 0; x < 64; ++x)
                        {
                            int mapAreaOffsetIndex = (y * 64) + x;

                            if (this.MapAreas[mapAreaOffsetIndex] != null)
                            {
                                bw.WriteIFFChunk(this.MapAreas[mapAreaOffsetIndex]);
                            }

                            if (this.MapAreaHoles[mapAreaOffsetIndex] != null)
                            {
                                bw.WriteIFFChunk(this.MapAreaHoles[mapAreaOffsetIndex]);
                            }
                        }
                    }
                }

                return ms.ToArray();
            }
        }
開發者ID:Nihlus,項目名稱:libwarcraft,代碼行數:75,代碼來源:WorldLOD.cs

示例5: Serialize

        public byte[] Serialize()
        {
            using (MemoryStream ms = new MemoryStream())
            {
                using (BinaryWriter bw = new BinaryWriter(ms))
                {
                    bw.WriteIFFChunk(this.Version);
                    bw.WriteIFFChunk(this.Header);
                    bw.WriteIFFChunk(this.AreaInfo);
                    bw.WriteIFFChunk(this.WorldModelObjects);

                    if (this.WorldModelObjects.Filenames.Count > 0 && this.WorldModelObjectPlacementInfo != null)
                    {
                        bw.WriteIFFChunk(this.WorldModelObjectPlacementInfo);
                    }
                }

                return ms.ToArray();
            }
        }
開發者ID:Nihlus,項目名稱:libwarcraft,代碼行數:20,代碼來源:WorldTable.cs


注:本文中的System.IO.BinaryWriter.WriteIFFChunk方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。