Skip to content

Commit

Permalink
Allow GLTF Exporter to export WebP textures
Browse files Browse the repository at this point in the history
  • Loading branch information
christaggart committed Oct 5, 2022
1 parent 2411747 commit 6b57bf0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,9 @@ export class _GLTFMaterialExporter {
case "image/png":
mimeType = ImageMimeType.PNG;
break;
case "image/webp":
mimeType = ImageMimeType.WEBP;
break;
}
}

Expand Down Expand Up @@ -1209,7 +1212,7 @@ export class _GLTFMaterialExporter {
}

imageData[textureName] = imageValues;
if (mimeType === ImageMimeType.JPEG || mimeType === ImageMimeType.PNG) {
if (mimeType === ImageMimeType.JPEG || mimeType === ImageMimeType.PNG || mimeType === ImageMimeType.WEBP) {
const glTFImage: IImage = {
name: baseTextureName,
uri: textureName,
Expand Down
4 changes: 4 additions & 0 deletions packages/public/glTF2Interface/babylon.glTF2Interface.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ declare module BABYLON.GLTF2 {
* PNG Mime-type
*/
PNG = "image/png",
/**
* WEBP Mime-type
*/
WEBP = "image/webp",
}

/**
Expand Down

0 comments on commit 6b57bf0

Please sign in to comment.