本文整理汇总了C#中System.IO.BinaryReader.ReadVector3f方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryReader.ReadVector3f方法的具体用法?C# BinaryReader.ReadVector3f怎么用?C# BinaryReader.ReadVector3f使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.BinaryReader
的用法示例。
在下文中一共展示了BinaryReader.ReadVector3f方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
/// <summary>
/// Read the <see cref="Bounds"/> from the <paramref name="reader"/>.
/// </summary>
/// <param name="reader">The <see cref="BinaryReader"/> to read the <see cref="Bounds"/> from.</param>
/// <returns>The new <see cref="Bounds"/> object.</returns>
public static Bounds Read(BinaryReader reader)
{
return new Bounds() {
Box = new Box3f(reader.ReadVector3f(), reader.ReadVector3f()),
Valid = reader.ReadByte() != 0
};
}
示例2: MDXSubmesh
public MDXSubmesh(byte[] data)
{
using (MemoryStream ms = new MemoryStream(data))
{
using (BinaryReader br = new BinaryReader(ms))
{
this.PartID = br.ReadUInt32();
this.StartVertexIndex = br.ReadUInt16();
this.VertexCount = br.ReadUInt16();
this.StartTriangleIndex = br.ReadUInt16();
this.TriangleCount = br.ReadUInt16();
this.BoneCount = br.ReadUInt16();
this.StartBoneIndex = br.ReadUInt16();
this.InfluencingBonesIndex = br.ReadUInt16();
this.RootBoneIndex = br.ReadUInt16();
this.SubmeshMedianPoint = br.ReadVector3f();
if (br.BaseStream.Length > 32)
{
this.BoundingShellMedianPoint = br.ReadVector3f();
this.BoundingSphereRadius = br.ReadSingle();
}
}
}
}
示例3: MDXVertex
public MDXVertex(byte[] data)
{
using (MemoryStream ms = new MemoryStream(data))
{
using (BinaryReader br = new BinaryReader(ms))
{
this.Position = br.ReadVector3f();
this.BoneWeights = new List<byte>(br.ReadBytes(4));
this.BoneIndices = new List<byte>(br.ReadBytes(4));
this.Normal = br.ReadVector3f();
this.UVCoordinates_Channel1 = br.ReadVector2f();
this.UVCoordinates_Channel2 = br.ReadVector2f();
}
}
}
示例4: LoadBinaryData
public void LoadBinaryData(byte[] inData)
{
using (MemoryStream ms = new MemoryStream(inData))
{
using (BinaryReader br = new BinaryReader(ms))
{
this.WidthVertices = br.ReadUInt32();
this.HeightVertices = br.ReadUInt32();
this.WidthTileFlags = br.ReadUInt32();
this.HeightTileFlags = br.ReadUInt32();
this.Location = br.ReadVector3f();
this.MaterialIndex = br.ReadUInt16();
uint vertexCount = this.WidthVertices * this.HeightVertices;
for (int i = 0; i < vertexCount; ++i)
{
this.LiquidVertices.Add(new LiquidVertex(br.ReadBytes(LiquidVertex.GetSize())));
}
uint tileFlagCount = this.WidthTileFlags * this.HeightTileFlags;
for (int i = 0; i < tileFlagCount; ++i)
{
this.LiquidTileFlags.Add((LiquidFlags)br.ReadByte());
}
}
}
}
示例5: LoadBinaryData
public void LoadBinaryData(byte[] inData)
{
using (MemoryStream ms = new MemoryStream(inData))
{
using (BinaryReader br = new BinaryReader(ms))
{
while (ms.Position < ms.Length)
{
this.Normals.Add(br.ReadVector3f());
}
}
}
}
示例6: LoadBinaryData
public void LoadBinaryData(byte[] inData)
{
using (MemoryStream ms = new MemoryStream(inData))
{
using (BinaryReader br = new BinaryReader(ms))
{
int vertexCount = inData.Length / 12;
for (int i = 0; i < vertexCount; ++i)
{
this.VisibleVertices.Add(br.ReadVector3f());
}
}
}
}
示例7: FogInstance
public FogInstance(byte[] inData)
{
using (MemoryStream ms = new MemoryStream(inData))
{
using (BinaryReader br = new BinaryReader(ms))
{
this.Flags = (FogFlags) br.ReadUInt32();
this.Position = br.ReadVector3f();
this.GlobalStartRadius = br.ReadSingle();
this.GlobalEndRadius = br.ReadSingle();
this.LandFog = new FogDefinition(br.ReadBytes(FogDefinition.GetSize()));
this.UnderwaterFog = new FogDefinition(br.ReadBytes(FogDefinition.GetSize()));
}
}
}
示例8: DoodadInstance
public DoodadInstance(byte[] inData)
{
using (MemoryStream ms = new MemoryStream(inData))
{
using (BinaryReader br = new BinaryReader(ms))
{
byte[] finalNameBytes = new byte[4];
byte[] nameOffsetBytes = br.ReadBytes(3);
Buffer.BlockCopy(nameOffsetBytes, 0, finalNameBytes, 0, 3);
this.NameOffset= BitConverter.ToUInt32(finalNameBytes, 0);
this.Flags = (DoodadInstanceFlags) br.ReadByte();
this.Position = br.ReadVector3f();
// TODO: Investigate whether or not this is a Quat16 in >= BC
this.Orientation = br.ReadQuaternion32();
this.Scale = br.ReadSingle();
this.StaticLightingColour = br.ReadBGRA();
}
}
}
示例9: MapChunkHeader
public MapChunkHeader(byte[] data)
{
using (MemoryStream ms = new MemoryStream(data))
{
using (BinaryReader br = new BinaryReader(ms))
{
this.Flags = (MapChunkFlags)br.ReadUInt32();
this.MapIndexX = br.ReadUInt32();
this.MapIndexY = br.ReadUInt32();
this.TextureLayerCount = br.ReadUInt32();
this.ModelReferenceCount = br.ReadUInt32();
if (this.Flags.HasFlag(MapChunkFlags.UsesHighResHoles))
{
this.HighResHoles = br.ReadUInt64();
}
this.HeightmapOffset = br.ReadUInt32();
this.VertexNormalOffset = br.ReadUInt32();
this.TextureLayersOffset = br.ReadUInt32();
this.ModelReferencesOffset = br.ReadUInt32();
this.AlphaMapsOffset = br.ReadUInt32();
this.AlphaMapsSize = br.ReadUInt32();
this.BakedShadowsOffset = br.ReadUInt32();
this.BakedShadowsSize = br.ReadUInt32();
this.AreaID = br.ReadUInt32();
this.WorldModelObjectReferenceCount = br.ReadUInt32();
// TODO: Turn into bitmapped boolean field
if (!this.Flags.HasFlag(MapChunkFlags.UsesHighResHoles))
{
this.LowResHoles = br.ReadUInt16();
}
this.Unknown = br.ReadUInt16();
// TODO: This is a set of 8 by 8 2-bit integers. Shift and read into a byte array.
this.LowResTextureMap = br.ReadUInt16();
this.predTex = br.ReadUInt32();
this.noEffectDoodad = br.ReadUInt32();
this.SoundEmittersOffset = br.ReadUInt32();
this.SoundEmitterCount = br.ReadUInt32();
this.LiquidOffset = br.ReadUInt32();
this.LiquidSize = br.ReadUInt32();
this.MapTilePosition = br.ReadVector3f();
if (this.Flags.HasFlag(MapChunkFlags.HasVertexShading))
{
this.VertexShadingOffset = br.ReadUInt32();
}
}
}
}
示例10: MDX
public MDX(Stream MDXStream)
{
using (BinaryReader br = new BinaryReader(MDXStream))
{
// Read Wrath header or read pre-wrath header
WarcraftVersion Format = PeekFormat(br);
if (Format < WarcraftVersion.Wrath)
{
this.Header = new MDXHeader(br.ReadBytes(324));
}
else
{
ModelObjectFlags Flags = PeekFlags(br);
if (Flags.HasFlag(ModelObjectFlags.HasBlendModeOverrides))
{
this.Header = new MDXHeader(br.ReadBytes(308));
}
else
{
this.Header = new MDXHeader(br.ReadBytes(312));
}
}
// Seek and read model name
br.BaseStream.Position = this.Header.NameOffset;
this.Name = new string(br.ReadChars((int) this.Header.NameLength));
// Seek to Global Sequences
br.BaseStream.Position = this.Header.GlobalSequencesOffset;
for (int i = 0; i < this.Header.GlobalSequenceCount; ++i)
{
this.GlobalSequenceTimestamps.Add(br.ReadUInt32());
}
// Seek to Animation Sequences
br.BaseStream.Position = this.Header.AnimationSequencesOffset;
int sequenceSize = MDXAnimationSequence.GetSize();
for (int i = 0; i < this.Header.AnimationSequenceCount; ++i)
{
this.AnimationSequences.Add(new MDXAnimationSequence(br.ReadBytes(sequenceSize)));
}
// Seek to Animation Sequence Lookup Table
br.BaseStream.Position = this.Header.AnimationLookupTableOffset;
for (int i = 0; i < this.Header.AnimationLookupTableEntryCount; ++i)
{
this.AnimationSequenceLookupTable.Add(br.ReadInt16());
}
if (MDXHeader.GetModelVersion(this.Header.Version) < WarcraftVersion.Wrath)
{
// Seek to Playable Animations Lookup Table
br.BaseStream.Position = this.Header.PlayableAnimationLookupTableOffset;
for (int i = 0; i < this.Header.PlayableAnimationLookupTableEntryCount; ++i)
{
this.PlayableAnimationLookupTable.Add(new MDXPlayableAnimationLookupTableEntry(br.ReadBytes(4)));
}
}
// Seek to bone block
br.BaseStream.Position = this.Header.BonesOffset;
for (int i = 0; i < this.Header.BoneCount; ++i)
{
// TODO: properly skip to the next bone record, data is not aligned
MDXBone Bone = new MDXBone();
Bone.AnimationID = br.ReadInt32();
Bone.Flags = (MDXBoneFlags)br.ReadUInt32();
Bone.ParentBone = br.ReadInt16();
Bone.SubmeshID = br.ReadUInt16();
if (MDXHeader.GetModelVersion(this.Header.Version) >= WarcraftVersion.BurningCrusade)
{
Bone.Unknown1 = br.ReadUInt16();
Bone.Unknown1 = br.ReadUInt16();
}
// TODO: Rework animation track reading
// Read bone animation header block
//Bone.AnimatedTranslation = new MDXTrack<Vector3f>(br, MDXHeader.GetModelVersion(Header.Version));
//Bone.AnimatedRotation = new MDXTrack<Quaternion>(br, MDXHeader.GetModelVersion(Header.Version));
//Bone.AnimatedScale = new MDXTrack<Vector3f>(br, MDXHeader.GetModelVersion(Header.Version));
Bone.PivotPoint = br.ReadVector3f();
this.Bones.Add(Bone);
}
/*
// Read bone animation data
foreach (MDXBone Bone in Bones)
{
// Read animation translation block
br.BaseStream.Position = Bone.AnimatedTranslation.Values.ElementsOffset;
for (int j = 0; j < Bone.AnimatedTranslation.Values.Count; ++j)
{
Bone.AnimatedTranslation.Values.Add(br.ReadVector3f());
}
// Read animation rotation block
//.........这里部分代码省略.........
示例11: Read
public override object Read(object target, Package package, BinaryReader reader, long end)
{
return reader.ReadVector3f();
}
示例12: Read
/// <summary></summary>
public static Polygon Read(BinaryReader reader, Package package)
{
int vertexCount = UIndex.Read(reader);
Polygon result = new Polygon() {
Vertices = new Vector3f[vertexCount],
Base = reader.ReadVector3f(),
Normal = reader.ReadVector3f(),
TextureU = reader.ReadVector3f(),
TextureV = reader.ReadVector3f()
};
for (var index = 0; index < vertexCount; index++)
result.Vertices[index] = reader.ReadVector3f();
result.Flags = reader.ReadInt32();
result.ActorReference = package.ReadReference(reader);
result.TextureReference = package.ReadReference(reader);
result.ItemName = package.ReadNameValue(reader);
result.Link = UIndex.Read(reader);
result.BrushPolygon = UIndex.Read(reader);
result.PanU = reader.ReadUInt16();
result.PanV = reader.ReadUInt16();
return result;
}
示例13: ModelPlacementEntry
/// <summary>
/// Initializes a new instance of the <see cref="Warcraft.ADT.Chunks.ModelPlacementEntry"/> class.
/// </summary>
/// <param name="data">Data.</param>
public ModelPlacementEntry(byte[] data)
{
using (MemoryStream ms = new MemoryStream(data))
{
using (BinaryReader br = new BinaryReader(ms))
{
this.ModelEntryIndex = br.ReadUInt32();
this.UniqueID = br.ReadUInt32();
this.Position = br.ReadVector3f();
this.Rotation = br.ReadRotator();
this.ScalingFactor = br.ReadUInt16();
this.Flags = (ModelPlacementFlags)br.ReadUInt16();
}
}
}
示例14: StaticLight
public StaticLight(byte[] inData)
{
using (MemoryStream ms = new MemoryStream(inData))
{
using (BinaryReader br = new BinaryReader(ms))
{
this.Type = (LightType) br.ReadByte();
this.bUseAttenuation = br.ReadBoolean();
this.bUseUnknown1 = br.ReadBoolean();
this.bUseUnknown2 = br.ReadBoolean();
this.Colour = br.ReadBGRA();
this.Position = br.ReadVector3f();
this.Intensity = br.ReadSingle();
this.AttenuationStartRadius = br.ReadSingle();
this.AttenuationEndRadius = br.ReadSingle();
this.Unknown1StartRadius = br.ReadSingle();
this.Unknown1EndRadius = br.ReadSingle();
this.Unknown2StartRadius = br.ReadSingle();
this.Unknown2EndRadius = br.ReadSingle();
}
}
}