24 lines
566 B
TypeScript
24 lines
566 B
TypeScript
export type AssetCategory = 'color' | 'roughness' | 'normal' | 'metalness' | 'assets'
|
|
|
|
export function classifyAssetCategory(filename: string): AssetCategory {
|
|
const name = filename.toLowerCase().replace(/\.[^.]+$/, '')
|
|
|
|
if (name.includes('base_color') || name.includes('_color') || name === 'color') {
|
|
return 'color'
|
|
}
|
|
|
|
if (name.includes('roughness')) {
|
|
return 'roughness'
|
|
}
|
|
|
|
if (name.includes('normal')) {
|
|
return 'normal'
|
|
}
|
|
|
|
if (name.includes('metallic') || name.includes('metalness')) {
|
|
return 'metalness'
|
|
}
|
|
|
|
return 'assets'
|
|
}
|