From 4d13803b0c2a94f08c98c93b4fbd043a402e7452 Mon Sep 17 00:00:00 2001 From: GonnaHetzMe Date: Sun, 12 Apr 2026 22:35:55 +0200 Subject: [PATCH] feat: culling --- .../src/core/blitz/extractModel/index.ts | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/scripts/src/core/blitz/extractModel/index.ts b/packages/scripts/src/core/blitz/extractModel/index.ts index a2e9da9f8..5f835b7da 100644 --- a/packages/scripts/src/core/blitz/extractModel/index.ts +++ b/packages/scripts/src/core/blitz/extractModel/index.ts @@ -75,9 +75,26 @@ export async function extractModel(vfs: AbstractVFS, path: string) { .setImage(baseColor), ); + const defaultConfigArchive = + typeof node.configCount === "number" + ? (times( + node.configCount, + (index) => node[`configArchive_${index}`], + ).find((archive) => archive.configName === "Default") ?? + node.configArchive_0) + : undefined; + const customCullMode = + node.customCullMode ?? defaultConfigArchive?.customCullMode; + + if (customCullMode === 0) { + material.setDoubleSided(true); + } else if (customCullMode !== undefined) { + material.setDoubleSided(false); + } + if ( node.enabledPresets?.AlphaTest && - node.properties.alphatestThreshold + node.properties?.alphatestThreshold ) { const view = new DataView(node.properties.alphatestThreshold); const alphaCutoff = @@ -98,7 +115,8 @@ export async function extractModel(vfs: AbstractVFS, path: string) { if ( archive.configName !== "Default" || - !archive.enabledPresets?.AlphaTest + !archive.enabledPresets?.AlphaTest || + !archive.properties?.alphatestThreshold ) { continue; }