Files
upload-gltf/lib/asset-classification.ts
T
2026-04-27 23:29:47 +02:00

27 lines
679 B
TypeScript

import { getAssetFamily } from './asset-naming'
export type AssetCategory = 'color' | 'roughness' | 'normal' | 'metalness' | 'assets'
export function classifyAssetCategory(filename: string): AssetCategory {
const name = filename.replace(/\.[^.]+$/, '')
const family = getAssetFamily(name.split('_')[0])
if (family === 'baseColor' || family === 'color') {
return 'color'
}
if (family === 'roughness' || family === 'occlusionRoughnessMetallic') {
return 'roughness'
}
if (family === 'normal' || family === 'normalOpengl') {
return 'normal'
}
if (family === 'metallic' || family === 'metalness') {
return 'metalness'
}
return 'assets'
}