27 lines
679 B
TypeScript
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'
|
|
}
|