当前位置: 首页>>代码示例>>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;未经允许,请勿转载。