This commit is contained in:
tresabhi committed 2026-06-13 20:26:43 -05:00
1 parent 028f4230e5
commit c6c0e02fea
3 files changed
+13 -11

No files matched your search

+10 -7
View File
@@ -34,11 +34,11 @@ public class MonoGltf
readonly MaterialBuilder emptyMaterial = new("empty_material");
readonly ExporterOptions options = new() { TextureFormat = ETextureFormat.Jpeg };
public static readonly Dictionary<string, KnownChannel> knownChannels = new()
public static readonly Dictionary<string, KnownChannel[]> knownChannels = new()
{
{ "BaseColor", KnownChannel.BaseColor },
{ "Normal", KnownChannel.Normal },
{ "RMAO", KnownChannel.MetallicRoughness },
{ "BaseColor", [KnownChannel.BaseColor] },
{ "Normal", [KnownChannel.Normal] },
{ "RMAO", [KnownChannel.MetallicRoughness, KnownChannel.Occlusion] },
// { "CDE", ?? },
};
readonly byte[] stubBytes = File.ReadAllBytes("../game/stub/small.png");
@@ -152,7 +152,7 @@ public class MonoGltf
foreach (var parameterTexture in materialData.Parameters.Textures)
{
if (knownChannels.TryGetValue(parameterTexture.Key, out var channel))
if (knownChannels.TryGetValue(parameterTexture.Key, out var channels))
{
var texture = parameterTexture.Value;
var name = Path.GetFileNameWithoutExtension(texture.GetPathName());
@@ -163,8 +163,11 @@ public class MonoGltf
var uniqueBytes = (byte[])stubBytes.Clone();
var stubImage = new MemoryImage(uniqueBytes);
materialBuilder.WithChannelImage(channel, stubImage);
materialBuilder.GetChannel(channel).Texture.PrimaryImage.Name = path;
foreach (var channel in channels)
{
materialBuilder.WithChannelImage(channel, stubImage);
materialBuilder.GetChannel(channel).Texture.PrimaryImage.Name = path;
}
}
}
}
@@ -18,6 +18,7 @@ export function TankopediaSandbox({ parameters }: TankopediaSandboxProps) {
<div className={styles.sandbox}>
<Canvas
// scene={{ fog: new FogExp2("black", 0.05) }}
camera={{ fov: 40 }}
shadows
className={styles.canvas}
frameloop="demand"
@@ -42,11 +43,11 @@ function Content({ parameters }: TankopediaSandboxProps) {
<primitive object={hull} />
</group>
<group position={[0, 0, 5]}>
<group position={[19.515463 / 100, 129.6958 / 100, 0.0039617573 / 100]}>
<primitive object={turret} />
</group>
<group position={[0, 0, -5]}>
<group position={[154.39078 / 100, 178.7401 / 100, 0.11611016 / 100]}>
<primitive object={gun} />
</group>
@@ -16,8 +16,6 @@ export function useTankModel(url: string, map: Record<string, boolean>) {
}
}
console.log(gltf.nodes);
for (const node of Object.values(gltf.nodes)) {
if (node instanceof Mesh) {
node.castShadow = true;