public SgbVfxEntry(IO.PackCollection packs, byte[] buffer, int offset) { this.Header = buffer.ToStructure <HeaderData>(offset); this.Name = buffer.ReadString(offset + Header.NameOffset); this.AvfxFilePath = buffer.ReadString(offset + Header.AvfxFileOffset); if (!string.IsNullOrEmpty(AvfxFilePath)) { this.AvfxFile = packs.GetFile(AvfxFilePath); } }
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); } }
private void Build() { byte[] buffer = File.GetData(); int offset = 0; this.Header = buffer.ToStructure <MaterialHeader>(ref offset); int stringsStart = offset + (4 * (Header.TextureCount + Header.MapCount + Header.DataSetCount)); string[] texFileNames = ReadStrings(buffer, ref offset, stringsStart, Header.TextureCount); IO.PackCollection packs = File.Pack.Collection; this.TexturesFiles = new Imaging.ImageFile[Header.TextureCount]; for (int i = 0; i < Header.TextureCount; ++i) { string path = texFileNames[i]; if (path == DummyTextureInMaterial) { path = DummyTexturePath; } this.TexturesFiles[i] = (Imaging.ImageFile)packs.GetFile(path); } this.Maps = ReadStrings(buffer, ref offset, stringsStart, Header.MapCount); this.DataSets = ReadStrings(buffer, ref offset, stringsStart, Header.DataSetCount); this.Shader = buffer.ReadString(stringsStart + Header.ShaderOffset); offset = stringsStart + Header.StringsSize; this.Unknown = new byte[Header.UnknownSize]; Array.Copy(buffer, offset, this.Unknown, 0, Header.UnknownSize); offset += Header.UnknownSize; this.DataSetData = new byte[Header.DataSetSize]; Array.Copy(buffer, offset, this.DataSetData, 0, Header.DataSetSize); offset += Header.DataSetSize; this.MetadataHeader = buffer.ToStructure <MaterialMetadataHeader>(ref offset); this.UnknownStructs1 = buffer.ToStructures <Unknowns.MaterialStruct1>(MetadataHeader.UnknownStruct1Count, ref offset); this.UnknownStructs2 = buffer.ToStructures <Unknowns.MaterialStruct2>(MetadataHeader.UnknownStruct2Count, ref offset); this.TextureParameters = buffer.ToStructures <MaterialTextureParameter>(MetadataHeader.ParameterMappingCount, ref offset); this.Data = new byte[MetadataHeader.DataSize]; Array.Copy(buffer, offset, this.Data, 0, MetadataHeader.DataSize); }
public LgbModelEntry(IO.PackCollection packs, byte[] buffer, int offset) { this.Header = buffer.ToStructure <HeaderData>(offset); this.Name = buffer.ReadString(offset + Header.NameOffset); var mdlFilePath = buffer.ReadString(offset + Header.ModelFileOffset); if (!string.IsNullOrWhiteSpace(mdlFilePath)) { SaintCoinach.Graphics.ModelFile mdlFile = (SaintCoinach.Graphics.ModelFile)packs.GetFile(mdlFilePath); this.Model = new TransformedModel(mdlFile.GetModelDefinition(), Header.Translation, Header.Rotation, Header.Scale); } }
private Material Create(string path, ImcVariant variant) { IO.File file = _Packs.GetFile(path); return(new Material(this, file, variant)); }