本文整理汇总了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))
{
//.........这里部分代码省略.........
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}