public LgbEventObjectEntry(IO.PackCollection packs, byte[] buffer, int offset) { this.Header = buffer.ToStructure <HeaderData>(offset); this.Name = buffer.ReadString(offset + Header.NameOffset); if (Collection == null) { LoadSheets(packs); } foreach (Ex.IDataRow row in EventObjectSheet) { if (row.Key == this.Header.EventObjectId) { var sg = row.GetRaw(11); foreach (Ex.IDataRow row2 in ExportedSgSheet) { if (row2.Key == (ushort)sg) { var path = ((SaintCoinach.Text.XivString)row2.GetRaw(0)).ToString(); if (!string.IsNullOrEmpty(path)) { SaintCoinach.IO.File file; if (packs.TryGetFile(path, out file)) { this.Gimmick = new Sgb.SgbFile(file); } } break; } } break; } } }
public SgbGroup1CEntry(IO.PackCollection packs, byte[] buffer, int offset) { this.Header = buffer.ToStructure <HeaderData>(offset); this.Name = buffer.ReadString(offset + Header.NameOffset + 9); string mdlFilePath = buffer.ReadString(offset + Header.ModelFileOffset + 9); if (!string.IsNullOrWhiteSpace(mdlFilePath)) { SaintCoinach.IO.File file; if (mdlFilePath.Contains(".mdl")) { if (packs.TryGetFile(mdlFilePath, out file)) { this.Model = ((Graphics.ModelFile)file).GetModelDefinition().GetModel(ModelQuality.High); } } else if (mdlFilePath.Contains(".sgb")) { if (packs.TryGetFile(mdlFilePath, out file)) { this.Gimmick = new Sgb.SgbFile(file); } } } }
public LgbGimmickEntry(IO.PackCollection packs, byte[] buffer, int offset) { this.Header = buffer.ToStructure <HeaderData>(offset); byte[] Unknown = new byte[100]; System.Buffer.BlockCopy(buffer, offset + System.Runtime.InteropServices.Marshal.SizeOf <HeaderData>(), Unknown, 0, 100); foreach (var c in Unknown) { if (c == 101) { System.Diagnostics.Debugger.Break(); } } this.Name = buffer.ReadString(offset + Header.NameOffset); var gimmickFilePath = buffer.ReadString(offset + Header.GimmickFileOffset); if (!string.IsNullOrWhiteSpace(gimmickFilePath)) { SaintCoinach.IO.File file; if (packs.TryGetFile(gimmickFilePath, out file)) { this.Gimmick = new Sgb.SgbFile(file); } } }
public LgbGimmickEntry(IO.PackCollection packs, byte[] buffer, int offset) { this.Header = buffer.ToStructure <HeaderData>(offset); this.Name = buffer.ReadString(offset + Header.NameOffset); var gimmickFilePath = buffer.ReadString(offset + Header.GimmickFileOffset); if (!string.IsNullOrWhiteSpace(gimmickFilePath)) { var file = packs.GetFile(gimmickFilePath); this.Gimmick = new Sgb.SgbFile(file); } }
public LgbGimmickEntry(IO.PackCollection packs, byte[] buffer, int offset) { this.Header = buffer.ToStructure <HeaderData>(offset); this.Name = buffer.ReadString(offset + Header.NameOffset); string gimmickFilePath = buffer.ReadString(offset + Header.GimmickFileOffset); if (!string.IsNullOrWhiteSpace(gimmickFilePath)) { SaintCoinach.IO.File file; if (packs.TryGetFile(gimmickFilePath, out file)) { this.Gimmick = new Sgb.SgbFile(file); } } }
public ContentSgb(Engine engine, Sgb.SgbFile sgbFile, Data.ParametersBase parameters) : base(engine) { this.SgbFile = sgbFile; this.Parameters = parameters; this.Transformation = Matrix.Identity; foreach (var group in sgbFile.Data.OfType <Sgb.SgbGroup>()) { foreach (var mdl in group.Entries.OfType <Sgb.SgbModelEntry>()) { _Content.Add(new ContentModel(engine, mdl.Model) { Parameters = parameters }); } } }
public ContentSgb(Engine engine, Sgb.SgbFile sgbFile, Data.ParametersBase parameters) : base(engine) { this.SgbFile = sgbFile; this.Parameters = parameters; this.Transformation = Matrix.Identity; // todo: fixme! bool LoadModels(Sgb.SgbFile file, Matrix rootTransform, Matrix gimTransform) { if (file == null) { return(false); } foreach (var group in file.Data.OfType <Sgb.SgbGroup>()) { foreach (var mdl in group.Entries.OfType <Sgb.SgbModelEntry>()) { var content = new ContentModel(engine, mdl.Model) { Parameters = parameters }; content.Transformation = content.Transformation * gimTransform * rootTransform; _Content.Add(content); } } return(true); } Matrix CreateMatrix(Vector3 translation, Vector3 rotation, Vector3 scale) { return(Matrix.Scaling(scale.ToDx()) * Matrix.RotationX(rotation.X) * Matrix.RotationY(rotation.Y) * Matrix.RotationZ(rotation.Z) * Matrix.Translation(translation.ToDx())); } void LoadSgbFile(Sgb.SgbFile file) { if (LoadModels(file, Matrix.Identity, Matrix.Identity)) { foreach (var rootGimGroup in file.Data.OfType <Sgb.SgbGroup>()) { foreach (var rootGimEntry in rootGimGroup.Entries.OfType <Sgb.SgbGimmickEntry>()) { var rootGimTransform = CreateMatrix(rootGimEntry.Header.Translation, rootGimEntry.Header.Rotation, rootGimEntry.Header.Scale); if (LoadModels(rootGimEntry.Gimmick, rootGimTransform, Matrix.Identity)) { foreach (var subGimGroup in rootGimEntry.Gimmick.Data.OfType <Sgb.SgbGroup>()) { foreach (var subGim in subGimGroup.Entries.OfType <Sgb.SgbGimmickEntry>()) { var subGimTransform = CreateMatrix(subGim.Header.Translation, subGim.Header.Rotation, subGim.Header.Scale); LoadModels(subGim.Gimmick, rootGimTransform, subGimTransform); } } } } } } } LoadSgbFile(sgbFile); }
public ContentSgb(Engine engine, Sgb.SgbFile sgbFile) : this(engine, sgbFile, null) { }
public ContentSgb(Engine engine, Sgb.SgbFile sgbFile) : this(engine, sgbFile, null, Matrix.Identity) { }
public ContentSgb(Engine engine, Sgb.SgbFile sgbFile, Data.ParametersBase parameters) : this(engine, sgbFile, parameters, Matrix.Identity) { }