public override void SaveAsset(BinaryWriter writer) { base.SaveAsset(writer); int i; writer.Write(FileScale); writer.Write(SerializeBlock.GetBytes(Pivot)); writer.Write(Vertices.Length); for (i = 0; i < Vertices.Length; i++) { byte[] bytes = SerializeBlock.GetBytes(Vertices[i]); writer.Write(bytes); } writer.Write(Indexes.Length); for (i = 0; i < Indexes.Length; i++) { writer.Write(Indexes[i]); } writer.Write(SerializeBlock.GetBytes(BoundingMinimum)); writer.Write(SerializeBlock.GetBytes(BoundingMaximum)); if (subAssets == null) { return; } foreach (MeshAsset subAsset in subAssets) { AssetsManagerInstance.GetManager().FSWorker.CreateAssetFile(subAsset, true); } }
public override bool LoadAsset(BinaryReader reader) { if (!base.LoadAsset(reader)) { return(false); } int i, n; FileScale = reader.ReadSingle(); Pivot = SerializeBlock.FromBytes <Vector3>(reader.ReadBytes(12)); n = reader.ReadInt32(); this.Vertices = new VertexStruct[n]; for (i = 0; i < n; i++) { byte[] arr = reader.ReadBytes(96); this.Vertices[i] = SerializeBlock.FromBytes <VertexStruct>(arr); } n = reader.ReadInt32(); this.Indexes = new int[n]; for (i = 0; i < n; i++) { this.Indexes[i] = reader.ReadInt32(); } BoundingMinimum = SerializeBlock.FromBytes <Vector3>(reader.ReadBytes(12)); BoundingMaximum = SerializeBlock.FromBytes <Vector3>(reader.ReadBytes(12)); return(true); }
public override void SaveAsset(BinaryWriter writer) { base.SaveAsset(writer); writer.Write(SerializeBlock.GetBytes(AlbedoColor)); writer.Write(AlphaValue); writer.Write(RoughnessValue); writer.Write(MetallicValue); writer.Write(SerializeBlock.GetBytes(Tile)); writer.Write(SerializeBlock.GetBytes(Shift)); writer.Write(AlbedoMapAsset); writer.Write(NormalMapAsset); writer.Write(RoughnessMapAsset); writer.Write(MetallicMapAsset); writer.Write(OcclusionMapAsset); }
public override bool LoadAsset(BinaryReader reader) { if (!base.LoadAsset(reader)) { return(false); } AlbedoColor = SerializeBlock.FromBytes <Vector3>(reader.ReadBytes(12)); AlphaValue = reader.ReadSingle(); RoughnessValue = reader.ReadSingle(); MetallicValue = reader.ReadSingle(); Tile = SerializeBlock.FromBytes <Vector2>(reader.ReadBytes(8)); Shift = SerializeBlock.FromBytes <Vector2>(reader.ReadBytes(8)); AlbedoMapAsset = reader.ReadString(); NormalMapAsset = reader.ReadString(); RoughnessMapAsset = reader.ReadString(); MetallicMapAsset = reader.ReadString(); OcclusionMapAsset = reader.ReadString(); return(true); }