本文整理匯總了C#中System.IO.BinaryReader.ReadColor4方法的典型用法代碼示例。如果您正苦於以下問題:C# BinaryReader.ReadColor4方法的具體用法?C# BinaryReader.ReadColor4怎麽用?C# BinaryReader.ReadColor4使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.IO.BinaryReader
的用法示例。
在下文中一共展示了BinaryReader.ReadColor4方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Color4Key
/// <summary>
/// Initializes a new instance of the <see cref="Color4Key"/> class.
/// </summary>
/// <param name="reader">The reader.</param>
/// <param name="type">The type.</param>
/// <exception cref="Exception">Invalid eKeyType!</exception>
public Color4Key(BinaryReader reader, eKeyType type) : base(reader, type)
{
this.Time = reader.ReadSingle();
if (type < eKeyType.LINEAR_KEY || type > eKeyType.TBC_KEY)
{
throw new Exception("Invalid eKeyType!");
}
this.Value = reader.ReadColor4();
if (type == eKeyType.QUADRATIC_KEY)
{
this.Forward = reader.ReadColor4();
this.Backward = reader.ReadColor4();
}
}
示例2: LoadFrom
public new void LoadFrom(Stream stream)
{
base.LoadFrom(stream);
BinaryReader reader = new BinaryReader(stream);
m_Sprite = new PPtr<Sprite>(stream, file);
m_Color = reader.ReadColor4();
}
示例3: NiColorExtraData
/// <summary>
/// Initializes a new instance of the <see cref="NiColorExtraData" /> class.
/// </summary>
/// <param name="file">The file.</param>
/// <param name="reader">The reader.</param>
public NiColorExtraData(NiFile file, BinaryReader reader) : base(file, reader)
{
this.Data = reader.ReadColor4();
}
示例4: ReadMOCV2
static void ReadMOCV2(BinaryReader br, WMOGroup group, uint size)
{
// Vertex colors, 4 bytes per vertex (BGRA), for WMO groups using indoor lighting.
group.VertexColors2 = new Color4[size / 4];
for (int i = 0; i < group.VertexColors2.Length; i++)
{
group.VertexColors2[i] = br.ReadColor4();
}
}
示例5: ReadMFOG
static void ReadMFOG(BinaryReader br, WMORoot wmo, uint size)
{
wmo.Fogs = new Fog[size/48];
for (int i = 0; i < wmo.Fogs.Length; i++)
{
var fog = new Fog
{
Flags = (FogFlags)br.ReadUInt32(),
Position = br.ReadVector3(),
Start = br.ReadSingle(),
End = br.ReadSingle(),
FogInfo_FOG = new FogInfo
{
End = br.ReadSingle(),
StartScalar = br.ReadSingle(),
Color = br.ReadColor4()
},
FogInfo_UWFOG = new FogInfo
{
End = br.ReadSingle(),
StartScalar = br.ReadSingle(),
Color = br.ReadColor4()
}
};
wmo.Fogs[i] = fog;
}
}
示例6: ReadMODD
static void ReadMODD(BinaryReader br, WMORoot wmo, uint size)
{
// Why oh why is wmo.Header.DoodadCount wrong sometimes
// 40 is the size of DoodadDefinition
wmo.DoodadDefinitions = new DoodadDefinition[size / 40];
for (var i = 0; i < wmo.DoodadDefinitions.Length; i++)
{
var dd = new DoodadDefinition
{
NameIndex = br.ReadInt32(),
Position = br.ReadVector3(),
Rotation = br.ReadQuaternion(),
Scale = br.ReadSingle(),
Color = br.ReadColor4()
};
if (dd.NameIndex != -1)
{
if(!wmo.DoodadFiles.TryGetValue(dd.NameIndex, out dd.FilePath))
{
dd.FilePath = "";
log.Error(String.Format("Doodad File Path for index: {0} missing from the Dictionary!", dd.NameIndex));
}
}
wmo.DoodadDefinitions[i] = dd;
}
}
示例7: ReadMOLT
static void ReadMOLT(BinaryReader br, WMORoot wmo)
{
wmo.LightInfo = new LightInformation[wmo.Header.LightCount];
for (int i = 0; i < wmo.LightInfo.Length; i++)
{
var light = new LightInformation
{
Byte_1 = br.ReadByte(),
Byte_2 = br.ReadByte(),
Byte_3 = br.ReadByte(),
Byte_4 = br.ReadByte(),
Color = br.ReadColor4(),
Position = br.ReadVector3(),
Intensity = br.ReadSingle(),
AttenStart = br.ReadSingle(),
AttenEnd = br.ReadSingle(),
Float_4 = br.ReadSingle(),
Float_5 = br.ReadSingle(),
Float_6 = br.ReadSingle(),
Float_7 = br.ReadSingle()
};
//FixVector3(ref light.position);
wmo.LightInfo[i] = light;
}
}
示例8: ReadMOMT
static void ReadMOMT(BinaryReader br, WMORoot wmo)
{
wmo.Materials = new Material[wmo.Header.TextureCount];
for (int i = 0; i < wmo.Materials.Length; i++)
{
var mt = new Material
{
Flags = (MaterialFlags)br.ReadUInt32(),
Int_1 = br.ReadUInt32(),
BlendMode = br.ReadInt32(),
TextureNameStart = br.ReadInt32(),
SidnColor = br.ReadColor4(),
FrameSidnColor = br.ReadColor4(),
TextureNameEnd = br.ReadInt32(),
DiffColor = br.ReadColor4(),
GroundType = br.ReadInt32(),
Float_1 = br.ReadSingle(),
Float_2 = br.ReadSingle(),
Int_2 = br.ReadInt32(),
Int_3 = br.ReadInt32(),
Int_4 = br.ReadInt32()
};
// these 2 are set in RAM in the client to the associated HTEXTUREs
br.ReadUInt32();// 0x38
br.ReadUInt32();// 0x3C
wmo.Materials[i] = mt;
//if (mt.Flags != 0)
//Console.WriteLine();
}
}
示例9: ReadMOHD
/// <summary>
/// Reads the header for the root file
/// </summary>
static void ReadMOHD(BinaryReader br, WMORoot wmo)
{
wmo.Header.TextureCount = br.ReadUInt32();
wmo.Header.GroupCount = br.ReadUInt32();
wmo.Header.PortalCount = br.ReadUInt32();
wmo.Header.LightCount = br.ReadUInt32();
wmo.Header.ModelCount = br.ReadUInt32();
wmo.Header.DoodadCount = br.ReadUInt32();
wmo.Header.DoodadSetCount = br.ReadUInt32();
wmo.Header.AmbientColor = br.ReadColor4();
wmo.Header.WMOId = br.ReadUInt32();
wmo.Header.BoundingBox = new BoundingBox(br.ReadWMOVector3(), br.ReadWMOVector3());
wmo.Header.Flags = (WMORootHeaderFlags)br.ReadUInt32();
wmo.Groups = new WMOGroup[wmo.Header.GroupCount];
}
示例10: NiGeometryData
/// <summary>
/// Initializes a new instance of the <see cref="NiGeometryData" /> class.
/// </summary>
/// <param name="file">The file.</param>
/// <param name="reader">The reader.</param>
public NiGeometryData(NiFile file, BinaryReader reader) : base(file, reader)
{
if (base.Version >= eNifVersion.VER_10_2_0_0)
{
this.Unkown1 = reader.ReadUInt32();
}
this.NumVertices = (uint)reader.ReadUInt16();
if (base.Version >= eNifVersion.VER_10_1_0_0)
{
this.KeepFlags = reader.ReadByte();
this.CompressFlags = reader.ReadByte();
}
this.HasVertices = reader.ReadBoolean(Version);
if (this.HasVertices)
{
this.Vertices = new Vector3[this.NumVertices];
int num = 0;
while ((long)num < (long)((ulong)this.NumVertices))
{
this.Vertices[num] = reader.ReadVector3();
num++;
}
}
int numUvSets = 0;
if (base.Version >= eNifVersion.VER_10_0_1_0)
{
numUvSets = (int)reader.ReadByte();
this.TSpaceFlag = reader.ReadByte();
}
this.HasNormals = reader.ReadBoolean(Version);
if (this.HasNormals)
{
this.Normals = new Vector3[this.NumVertices];
int num3 = 0;
while ((long)num3 < (long)((ulong)this.NumVertices))
{
this.Normals[num3] = reader.ReadVector3();
num3++;
}
}
if (base.Version >= eNifVersion.VER_10_1_0_0)
{
this.Binormals = new Vector3[this.NumVertices];
this.Tangents = new Vector3[this.NumVertices];
if (this.HasNormals && (this.TSpaceFlag & 240) != 0)
{
int num4 = 0;
while ((long)num4 < (long)((ulong)this.NumVertices))
{
this.Binormals[num4] = reader.ReadVector3();
num4++;
}
int num5 = 0;
while ((long)num5 < (long)((ulong)this.NumVertices))
{
this.Tangents[num5] = reader.ReadVector3();
num5++;
}
}
}
this.Center = reader.ReadVector3();
this.Radius = reader.ReadSingle();
this.HasVertexColors = reader.ReadBoolean(Version);
if (this.HasVertexColors)
{
this.VertexColors = new Color4[this.NumVertices];
int num6 = 0;
while ((long)num6 < (long)((ulong)this.NumVertices))
{
this.VertexColors[num6] = reader.ReadColor4();
num6++;
}
}
if (base.Version <= eNifVersion.VER_4_2_2_0)
{
numUvSets = (int)reader.ReadByte();
this.TSpaceFlag = reader.ReadByte();
}
if (base.Version <= eNifVersion.VER_4_0_0_2)
{
this.HasUV = reader.ReadBoolean(Version);
}
int num7;
if (base.Version < eNifVersion.VER_20_2_0_7 || this.File.Header.UserVersion != 1u)
{
num7 = (numUvSets & 63);
}
else
{
//.........這裏部分代碼省略.........
示例11: ReadMODD
static void ReadMODD(BinaryReader br, WMORoot wmo, uint size)
{
// Why oh why is wmo.Header.DoodadCount wrong sometimes
// 40 is the size of DoodadDefinition
wmo.DoodadDefinitions = new DoodadDefinition[size / 40];
for (var i = 0; i < wmo.DoodadDefinitions.Length; i++)
{
var dd = new DoodadDefinition
{
NameIndex = br.ReadInt32(),
Position = br.ReadWMOVector3(),
Rotation = br.ReadQuaternion(),
Scale = br.ReadSingle(),
Color = br.ReadColor4()
};
if (dd.NameIndex != -1)
{
dd.FilePath = wmo.DoodadFiles[dd.NameIndex];
}
wmo.DoodadDefinitions[i] = dd;
}
}
示例12: NiParticleSystemController
/// <summary>
/// Initializes a new instance of the <see cref="NiParticleSystemController" /> class.
/// </summary>
/// <param name="file">The file.</param>
/// <param name="reader">The reader.</param>
public NiParticleSystemController(NiFile file, BinaryReader reader) : base(file, reader)
{
if (base.Version <= eNifVersion.VER_3_1)
{
this.OldSpeed = reader.ReadUInt32();
}
if (base.Version >= eNifVersion.VER_3_3_0_13)
{
this.Speed = reader.ReadSingle();
}
this.RandomSpeed = reader.ReadSingle();
this.VerticalDirection = reader.ReadSingle();
this.VerticalAngle = reader.ReadSingle();
this.HorizontalDirection = reader.ReadSingle();
this.HorizontalAngle = reader.ReadSingle();
this.UnkownNormal = reader.ReadVector3();
this.UnkownColor = reader.ReadColor4();
this.Size = reader.ReadSingle();
this.EmitStartTime = reader.ReadSingle();
this.EmitStopTime = reader.ReadSingle();
if (base.Version >= eNifVersion.VER_4_0_0_2)
{
this.UnkownByte = reader.ReadByte();
}
if (base.Version <= eNifVersion.VER_3_1)
{
this.OldEmitRate = reader.ReadUInt32();
}
if (base.Version >= eNifVersion.VER_3_3_0_13)
{
this.EmitRate = reader.ReadSingle();
}
this.Lifetime = reader.ReadSingle();
this.LifetimeRandom = reader.ReadSingle();
if (base.Version >= eNifVersion.VER_4_0_0_2)
{
this.EmitFlags = reader.ReadUInt16();
}
this.StartRandom = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
this.Emitter = new NiRef<NiObject>(reader);
if (base.Version >= eNifVersion.VER_4_0_0_2)
{
reader.ReadUInt16();
reader.ReadSingle();
reader.ReadUInt32();
reader.ReadUInt32();
reader.ReadUInt16();
}
if (base.Version <= eNifVersion.VER_3_1)
{
this.ParticleVelocity = reader.ReadVector3();
this.ParticleUnkownVector = reader.ReadVector3();
this.ParticleLifeTime = reader.ReadSingle();
this.ParticleLink = new NiRef<NiObject>(reader);
this.ParticleTimestamp = reader.ReadUInt32();
this.ParticleUnkownShort = reader.ReadUInt16();
this.ParticleVertexId = reader.ReadUInt16();
}
if (base.Version >= eNifVersion.VER_4_0_0_2)
{
this.NumParticles = reader.ReadUInt16();
this.NumValid = reader.ReadUInt16();
this.Particles = new Particle[(int)this.NumParticles];
for (int i = 0; i < (int)this.NumParticles; i++)
{
this.Particles[i] = new Particle(file, reader);
}
this.UnkownRef = new NiRef<NiObject>(reader);
}
this.ParticleExtra = new NiRef<NiParticleModifier>(reader);
this.UnkownRef2 = new NiRef<NiObject>(reader);
if (base.Version >= eNifVersion.VER_4_0_0_2)
{
this.Trailer = reader.ReadByte();
}
if (base.Version <= eNifVersion.VER_3_1)
{
this.ColorData = new NiRef<NiColorData>(reader);
this.UnkownFloat1 = reader.ReadSingle();
this.UnkownFloats2 = reader.ReadFloatArray((int)this.ParticleUnkownShort);
}
}
示例13: LoadFrom
public void LoadFrom(Stream stream)
{
BinaryReader reader = new BinaryReader(stream);
m_GameObject = new PPtr<GameObject>(stream, file);
m_Enabled = reader.ReadByte();
stream.Position += 3;
m_ClearFlags = reader.ReadUInt32();
m_BackGroundColor = reader.ReadColor4();
m_NormalizedViewPortRect = new Rectf(stream);
near_clip_plane = reader.ReadSingle();
far_clip_plane = reader.ReadSingle();
field_of_view = reader.ReadSingle();
orthographic = reader.ReadBoolean();
stream.Position += 3;
orthographic_size = reader.ReadSingle();
m_Depth = reader.ReadSingle();
m_CullingMask = new BitField(stream);
m_RenderingPath = reader.ReadInt32();
m_TargetTexture = new PPtr<Texture2D>(stream, file);
m_TargetDisplay = reader.ReadUInt32();
m_HDR = reader.ReadBoolean();
m_OcclusionCulling = reader.ReadBoolean();
stream.Position += 2;
m_StereoConvergence = reader.ReadSingle();
m_StereoSeparation = reader.ReadSingle();
}
示例14: LoadFrom
public void LoadFrom(Stream stream)
{
BinaryReader reader = new BinaryReader(stream);
m_GameObject = new PPtr<GameObject>(stream, file);
m_Enabled = reader.ReadByte();
reader.ReadBytes(3);
m_Type = reader.ReadInt32();
m_Color = reader.ReadColor4();
m_Intensity = reader.ReadSingle();
m_Range = reader.ReadSingle();
m_SpotAngle = reader.ReadSingle();
m_CookieSize = reader.ReadSingle();
m_Shadows = new ShadowSettings(stream);
m_Cookie = new PPtr<Texture2D>(stream, file);
m_DrawHalo = reader.ReadBoolean();
m_ActuallyLightmapped = reader.ReadBoolean();
reader.ReadBytes(2);
m_Flare = new PPtr<Flare>(stream, file);
m_RenderMode = reader.ReadInt32();
m_CullingMask = new BitField(stream);
m_Lightmapping = reader.ReadInt32();
}