mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: pbr
This commit is contained in:
1 parent
0627f678ea
commit
d60a102c0d
6 files changed
+201
-90
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import { existsSync } from 'fs';
|
||||
import { readDVPLFile } from '../blitz/readDVPLFile';
|
||||
import { ToJpgOptions, toJpg } from './toJpg';
|
||||
|
||||
export async function readTexture(
|
||||
path: string,
|
||||
options?: Partial<Omit<ToJpgOptions, 'format'>>,
|
||||
) {
|
||||
const ddsTexturePath = path.replace('.tex', '.dx11.dds.dvpl');
|
||||
const isDds = existsSync(ddsTexturePath);
|
||||
const resolvedTexturePath = isDds
|
||||
? ddsTexturePath
|
||||
: ddsTexturePath.replace('.dds', '.pvr');
|
||||
const decompressedTexture = await readDVPLFile(resolvedTexturePath);
|
||||
const jpg = await toJpg(decompressedTexture, {
|
||||
...options,
|
||||
format: isDds ? 'dds' : 'pvr',
|
||||
});
|
||||
|
||||
return jpg;
|
||||
}
|
||||
Reference in new issue
Block a user