|
@@ -98,28 +98,19 @@ export class KHR_texture_transform implements IGLTFExporterExtensionV2 {
|
|
|
reject(`${context}: "scene" is not defined for Babylon texture ${babylonTexture.name}!`);
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- let transformIsRequired = false;
|
|
|
-
|
|
|
- if (babylonTexture.uOffset !== 0 || babylonTexture.vOffset !== 0) {
|
|
|
- transformIsRequired = true;
|
|
|
- }
|
|
|
-
|
|
|
- if (babylonTexture.uScale !== 1 || babylonTexture.vScale !== 1) {
|
|
|
- transformIsRequired = true;
|
|
|
- }
|
|
|
-
|
|
|
- if (babylonTexture.wAng !== 0) {
|
|
|
- transformIsRequired = true;
|
|
|
- }
|
|
|
-
|
|
|
- if (!transformIsRequired) {
|
|
|
- resolve(babylonTexture);
|
|
|
- return;
|
|
|
+ //
|
|
|
+ let bakeTextureTransform = false;
|
|
|
+
|
|
|
+ /*
|
|
|
+ * The KHR_texture_transform schema only supports rotation around the origin.
|
|
|
+ * the texture must be baked to preserve appearance.
|
|
|
+ * see: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_transform#gltf-schema-updates
|
|
|
+ */
|
|
|
+ if ( (babylonTexture.uAng !== 0 || babylonTexture.wAng !== 0 || babylonTexture.vAng !== 0) && (babylonTexture.uRotationCenter !== 0 || babylonTexture.vRotationCenter !== 0)) {
|
|
|
+ bakeTextureTransform = true;
|
|
|
}
|
|
|
|
|
|
- // Do we need to flatten the transform?
|
|
|
- if (babylonTexture.uRotationCenter === 0 && babylonTexture.vRotationCenter === 0) {
|
|
|
+ if (!bakeTextureTransform) {
|
|
|
resolve(babylonTexture);
|
|
|
return;
|
|
|
}
|