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