public void Read(EndianBinaryReader r) { r.AssertMagicText("skl" + AsciiUtil.GetChar(0x20)); this.chunkSize = r.ReadUInt32(); this.bones = new Bone[r.ReadUInt32()]; // M-1: Only value found is "2", possibly "IsTranslateAnimationEnabled" // flag (I can't find a change in-game) this.unkFlags = r.ReadUInt32(); for (var i = 0; i < this.bones.Length; ++i) { var bone = new Bone(); bone.Read(r); this.bones[i] = bone; } foreach (var bone in this.bones) { var parentId = bone.parentId; if (parentId != -1) { var parent = this.bones[parentId]; bone.parent = parent; parent.children.Add(bone); } } }
public void Read(EndianBinaryReader r) { r.AssertMagicText("cmb" + AsciiUtil.GetChar(0x20)); this.fileSize = r.ReadUInt32(); this.version = CmbHeader.Version = (CmbVersion)r.ReadUInt32(); Asserts.Equal(0, r.ReadInt32()); this.name = r.ReadString(16); this.faceIndicesCount = r.ReadUInt32(); this.sklOffset = r.ReadUInt32(); if (CmbHeader.Version > CmbVersion.OCARINA_OF_TIME_3D) { this.qtrsOffset = r.ReadUInt32(); } this.matsOffset = r.ReadUInt32(); this.texOffset = r.ReadUInt32(); this.sklmOffset = r.ReadUInt32(); this.lutsOffset = r.ReadUInt32(); this.vatrOffset = r.ReadUInt32(); this.faceIndicesOffset = r.ReadUInt32(); this.textureDataOffset = r.ReadUInt32(); if (this.version > CmbVersion.OCARINA_OF_TIME_3D) { this.unk0 = r.ReadUInt32(); } }
public ZarHeader(EndianBinaryReader er) { er.AssertMagicText("ZAR" + AsciiUtil.GetChar(1)); this.Size = er.ReadInt32(); this.FileTypeCount = er.ReadInt16(); this.FileCount = er.ReadInt16(); this.FileTypesOffset = er.ReadInt32(); this.FileMetadataOffset = er.ReadInt32(); this.DataOffset = er.ReadInt32(); }
public void Read(EndianBinaryReader r) { r.AssertMagicText("prm" + AsciiUtil.GetChar(0x20)); this.chunkSize = r.ReadUInt32(); this.isVisible = r.ReadUInt32() != 0; // Other modes don't exist in OoT3D's shader so we'd never know this.primitiveMode = (PrimitiveMode)r.ReadUInt32(); this.dataType = (DataType)r.ReadUInt32(); this.indicesCount = r.ReadUInt16(); this.offset = r.ReadUInt16(); }
public GarHeader(EndianBinaryReader er) { er.AssertMagicText("GAR"); this.Version = er.ReadByte(); Asserts.True(this.Version is 2 or 5); this.Size = er.ReadInt32(); this.FileTypeCount = er.ReadInt16(); this.FileCount = er.ReadInt16(); this.FileTypesOffset = er.ReadInt32(); this.FileMetadataOffset = er.ReadInt32(); this.DataOffset = er.ReadInt32(); }
public void Read(EndianBinaryReader r) { r.AssertMagicText("mats"); this.chunkSize = r.ReadUInt32(); this.materials = new Material[r.ReadUInt32()]; for (var i = 0; i < this.materials.Length; ++i) { var material = new Material(); material.Read(r); this.materials[i] = material; } var combiners = new List <Combiner>(); foreach (var material in this.materials) { for (var i = 0; i < material.texEnvStageCount; ++i) { var combiner = new Combiner(); combiner.Read(r); combiners.Add(combiner); } } foreach (var material in this.materials) { material.texEnvStages.Clear(); foreach (var i in material.texEnvStagesIndices) { if (i != -1) { material.texEnvStages.Add(combiners[i]); } } } }
public void Read(EndianBinaryReader r) { r.AssertMagicText("shp" + AsciiUtil.GetChar(0x20)); this.chunkSize = r.ReadUInt32(); this.shapes = new Sepd[r.ReadUInt32()]; this.flags = r.ReadUInt32(); for (var i = 0; i < this.shapes.Length; ++i) { r.ReadInt16(); // ShapeOffset(s) } r.Align(4); for (var i = 0; i < this.shapes.Length; ++i) { var shape = new Sepd(); shape.Read(r); this.shapes[i] = shape; } }
public void Read(EndianBinaryReader r) { var basePosition = r.Position; r.AssertMagicText("anod"); this.BoneIndex = r.ReadUInt16(); var isRotationShort = r.ReadUInt16() != 0; this.RotationX.AreRotationsShort = isRotationShort; this.RotationY.AreRotationsShort = isRotationShort; this.RotationZ.AreRotationsShort = isRotationShort; var translationXOffset = r.ReadUInt16(); var translationYOffset = r.ReadUInt16(); var translationZOffset = r.ReadUInt16(); var rotationXOffset = r.ReadUInt16(); var rotationYOffset = r.ReadUInt16(); var rotationZOffset = r.ReadUInt16(); var scaleXOffset = r.ReadUInt16(); var scaleYOffset = r.ReadUInt16(); var scaleZOffset = r.ReadUInt16(); r.AssertUInt16(0x00); if (translationXOffset != 0) { r.Subread(basePosition + translationXOffset, sr => this.TranslationX.Read(sr)); } if (translationYOffset != 0) { r.Subread(basePosition + translationYOffset, sr => this.TranslationY.Read(sr)); } if (translationZOffset != 0) { r.Subread(basePosition + translationZOffset, sr => this.TranslationZ.Read(sr)); } if (rotationXOffset != 0) { r.Subread(basePosition + rotationXOffset, sr => this.RotationX.Read(sr)); } if (rotationYOffset != 0) { r.Subread(basePosition + rotationYOffset, sr => this.RotationY.Read(sr)); } if (rotationZOffset != 0) { r.Subread(basePosition + rotationZOffset, sr => this.RotationZ.Read(sr)); } if (scaleXOffset != 0) { r.Subread(basePosition + scaleXOffset, sr => this.ScaleX.Read(sr)); } if (scaleYOffset != 0) { r.Subread(basePosition + scaleYOffset, sr => this.ScaleY.Read(sr)); } if (scaleZOffset != 0) { r.Subread(basePosition + scaleZOffset, sr => this.ScaleZ.Read(sr)); } }