feat: jpg texture files

This commit is contained in:
TrèsAbhi committed 2024-03-16 15:34:48 -05:00
1 parent d2977182d9
commit 9e492015ff
3 files changed
+12 -12

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "blitzkrieg",
"version": "1.17.0",
"version": "1.17.1",
"description": "🎉 Tools for everything World of Tanks Blitz",
"main": "src/server.ts",
"type": "module",
+4 -4
View File
@@ -57,7 +57,7 @@ export async function extractModel(data: string, path: string) {
material.setBaseColorTexture(
document
.createTexture(node.materialName)
.setMimeType('image/png')
.setMimeType('image/jpeg')
.setImage(
await readTexture(
`${data}/3d/${dirname(path)}/${textures.albedo}`,
@@ -70,7 +70,7 @@ export async function extractModel(data: string, path: string) {
material.setMetallicRoughnessTexture(
document
.createTexture(node.materialName)
.setMimeType('image/png')
.setMimeType('image/jpeg')
.setImage(
await readTexture(
`${data}/3d/${dirname(path)}/${textures.baseRMMap}`,
@@ -86,7 +86,7 @@ export async function extractModel(data: string, path: string) {
material.setNormalTexture(
document
.createTexture(node.materialName)
.setMimeType('image/png')
.setMimeType('image/jpeg')
.setImage(
await readTexture(
`${data}/3d/${dirname(path)}/${
@@ -102,7 +102,7 @@ export async function extractModel(data: string, path: string) {
material.setOcclusionTexture(
document
.createTexture(node.materialName)
.setMimeType('image/png')
.setMimeType('image/jpeg')
.setImage(
await readTexture(
`${data}/3d/${dirname(path)}/${textures.miscMap}`,
+7 -7
View File
@@ -36,7 +36,7 @@ export async function readTexture(path: string, mutation?: TextureMutation) {
raw.data[index + 3] = 255;
}
return await sharp(raw.data, { raw }).png().toBuffer();
return await sharp(raw.data, { raw }).jpeg().toBuffer();
}
case TextureMutation.RoughnessMetallicness: {
@@ -45,16 +45,16 @@ export async function readTexture(path: string, mutation?: TextureMutation) {
});
const metallicness = sharp(raw.data, { raw })
.extractChannel('green')
.png()
.jpeg()
.toBuffer();
const roughness = sharp(raw.data, { raw })
.extractChannel('alpha')
.png()
.jpeg()
.toBuffer();
return await newImage
.joinChannel(await Promise.all([roughness, metallicness]))
.png()
.jpeg()
.toBuffer();
}
@@ -65,15 +65,15 @@ export async function readTexture(path: string, mutation?: TextureMutation) {
*/
return await sharp(raw.data, { raw })
.extractChannel('alpha')
.png()
.jpeg()
.toBuffer();
}
case TextureMutation.Albedo: {
return await sharp(raw.data, { raw }).removeAlpha().png().toBuffer();
return await sharp(raw.data, { raw }).removeAlpha().jpeg().toBuffer();
}
default:
return await sharp(raw.data, { raw }).png().toBuffer();
return await sharp(raw.data, { raw }).jpeg().toBuffer();
}
}