
[StructLayout(LayoutKind.Sequential)] private struct PerModelPassBuffer { public Matrix uvAnimMatrix1; public Matrix uvAnimMatrix2; public Matrix uvAnimMatrix3; public Matrix uvAnimMatrix4; // public Vector4 modelPassParams: public float LightCoefficient; public float FogCoefficient; private float __unused0; public float AlphaRef; public Vector4 animatedColor; public float transparency1; public float transparency2; public float transparency3; public float transparency4; // Used for attachments mostly public Matrix modelPosition; }
Wow @RyanNegri got stranded in the middle of nowhere with a Tesla because it couldn't start without cell service ? https://t.co/GfzSm6A6FK pic.twitter.com/gBd5Scty86
— Internet of Shit (@internetofshit) January 14, 2017
public sealed class MCNK : ChunkReader<BinaryReader>
{
public MCNK(Chunk<BinaryReader> chunk, uint headerSize, bool read = true) : base(chunk, headerSize, read) { }
public MCNK(Chunk<BinaryReader> chunk, bool read = true) : base(chunk, read) { }
public struct HeaderFlags
{
private BitSet<uint> _value;
public uint Value => _value.Value;
public bool HasMCSH => _value[0];
public bool Impass => _value[1];
public bool IsLiquidRiver => _value[2];
public bool IsLiquidOcean => _value[3];
public bool IsLiquidMagma => _value[4];
public bool IsLiquidSlime => _value[5];
public bool HasMCCV => _value[6];
public bool DoNotFixMCAL => _value[15];
public bool HighResolutionHoles => _value[16];
}
public HeaderFlags Flags { get; private set; }
public uint X { get; private set; }
public uint Y { get; private set; }
public uint LayerCount { get; private set; }
public uint DoodadRefCount { get; private set; }
public ulong HighResolutionHoles { get; private set; }
public uint AreaID { get; private set; }
public uint MapObjRefCount { get; private set; }
public ushort Holes { get; private set; }
public ushort[] LowQualityTexturingMap { get; private set; }
public Vector3 Position { get; private set; }
public ulong EffectDoodadCount { get; private set; }
public MCVT MCVT { get; private set; }
public MCCV MCCV { get; private set; }
public MCNR MCNR { get; private set; }
public MCLY MCLY { get; private set; }
public override void Read()
{
Flags = Chunk.Reader.ReadStruct<HeaderFlags>();
X = Chunk.Reader.ReadUInt32();
Y = Chunk.Reader.ReadUInt32();
LayerCount = Chunk.Reader.ReadUInt32();
DoodadRefCount = Chunk.Reader.ReadUInt32();
HighResolutionHoles = Chunk.Reader.ReadUInt64();
Chunk.Reader.BaseStream.Position += 6 * 4;
AreaID = Chunk.Reader.ReadUInt32();
MapObjRefCount = Chunk.Reader.ReadUInt32();
Holes = Chunk.Reader.ReadUInt16();
Chunk.Reader.BaseStream.Position += 2; // In alpha: padding
LowQualityTexturingMap = Chunk.Reader.ReadArray<ushort>(8);
EffectDoodadCount = Chunk.Reader.ReadUInt64();
Chunk.Reader.BaseStream.Position += 4 * 4;
Position = Chunk.Reader.ReadStruct<Vector3>();
Chunk.Reader.BaseStream.Position += 4 * 4;
var chunks = new ChunkData<BinaryReader>(Chunk.Reader, true, (uint)(Chunk.Size - Chunk.Reader.BaseStream.Position));
foreach (var subChunk in chunks.Chunks)
{
switch (subChunk.Name)
{
case "MCVT":
MCVT = new MCVT(subChunk);
break;
// case "MCLV":
// MCLV = new MCLV(subChunk);
// break;
case "MCCV":
MCCV = new MCCV(subChunk);
break;
case "MCNR":
MCNR = new MCNR(subChunk);
break;
case "MCLY":
MCLY = new MCLY(subChunk);
break;
}
}
}
}