diff --git a/packages/game/JSExport/GameInterface.cs b/packages/game/JSExport/GameInterface.cs index a881da0b3..45271458d 100644 --- a/packages/game/JSExport/GameInterface.cs +++ b/packages/game/JSExport/GameInterface.cs @@ -233,7 +233,9 @@ public partial class GameInterface } catch (Exception e) { - throw new Exception($"Failed to export tank part: {part}", e); + Console.WriteLine(e); } + + return []; } } diff --git a/packages/game/Models/MonoGltf.cs b/packages/game/Models/MonoGltf.cs index cf5e6818f..a7d16212e 100644 --- a/packages/game/Models/MonoGltf.cs +++ b/packages/game/Models/MonoGltf.cs @@ -39,7 +39,7 @@ public class MonoGltf { "RMAO", KnownChannel.MetallicRoughness }, // { "CDE", ?? }, }; - readonly string stubTexture = "../../stub/stupid.png"; + readonly byte[] stubBytes = File.ReadAllBytes("../game/stub/small.png"); public MonoGltf(UStaticMesh staticMesh) { @@ -83,7 +83,16 @@ public class MonoGltf var name = Path.GetFileNameWithoutExtension(texture.GetPathName()); var path = $"../../../textures/{name}.webp"; - materialBuilder.WithChannelImage(channel, stubTexture); + var lastIndex = stubBytes.Length - 1; + stubBytes[lastIndex] = (byte)(++stubBytes[lastIndex] % 255); + var uniqueBytes = (byte[])stubBytes.Clone(); + var stubImage = new MemoryImage(uniqueBytes); + + // Console.WriteLine( + // $"created stub image {stubImage} @ {stubImage.SourcePath} w/ byte {uniqueBytes[lastIndex]}" + // ); + + materialBuilder.WithChannelImage(channel, stubImage); materialBuilder.GetChannel(channel).Texture.PrimaryImage.Name = path; } else @@ -126,8 +135,11 @@ public class MonoGltf var mappedTextures = new Dictionary(); + // Console.WriteLine($"found {model.LogicalImages.Count} logical images"); + foreach (var image in model.LogicalImages) { + // Console.WriteLine($"mapping {image.Content} ({image.Name})"); mappedTextures[image.Content] = image.Name!; image.Name = null; } @@ -141,6 +153,8 @@ public class MonoGltf ImageWriting = ResourceWriteMode.SatelliteFile, ImageWriteCallback = (context, assetName, image) => { + // Console.WriteLine($"got {image} -> {mappedTextures[image]}"); + return mappedTextures[image]; }, } diff --git a/packages/game/stub/small.png b/packages/game/stub/small.png new file mode 100644 index 000000000..1914264c0 Binary files /dev/null and b/packages/game/stub/small.png differ diff --git a/stub/stupid.png b/stub/stupid.png deleted file mode 100644 index 3b9d7830c..000000000 Binary files a/stub/stupid.png and /dev/null differ