|
@@ -15,7 +15,6 @@ import {
|
|
NearestMipmapNearestFilter,
|
|
NearestMipmapNearestFilter,
|
|
PropertyBinding,
|
|
PropertyBinding,
|
|
RGBAFormat,
|
|
RGBAFormat,
|
|
- RGBFormat,
|
|
|
|
RepeatWrapping,
|
|
RepeatWrapping,
|
|
Scene,
|
|
Scene,
|
|
Vector3
|
|
Vector3
|
|
@@ -962,7 +961,7 @@ class GLTFWriter {
|
|
/**
|
|
/**
|
|
* Process image
|
|
* Process image
|
|
* @param {Image} image to process
|
|
* @param {Image} image to process
|
|
- * @param {Integer} format of the image (e.g. RGBFormat, RGBAFormat etc)
|
|
|
|
|
|
+ * @param {Integer} format of the image (RGBAFormat)
|
|
* @param {Boolean} flipY before writing out the image
|
|
* @param {Boolean} flipY before writing out the image
|
|
* @return {Integer} Index of the processed texture in the "images" array
|
|
* @return {Integer} Index of the processed texture in the "images" array
|
|
*/
|
|
*/
|
|
@@ -1011,9 +1010,9 @@ class GLTFWriter {
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
- if ( format !== RGBAFormat && format !== RGBFormat ) {
|
|
|
|
|
|
+ if ( format !== RGBAFormat ) {
|
|
|
|
|
|
- console.error( 'GLTFExporter: Only RGB and RGBA formats are supported.' );
|
|
|
|
|
|
+ console.error( 'GLTFExporter: Only RGBAFormat is supported.' );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1025,27 +1024,12 @@ class GLTFWriter {
|
|
|
|
|
|
const data = new Uint8ClampedArray( image.height * image.width * 4 );
|
|
const data = new Uint8ClampedArray( image.height * image.width * 4 );
|
|
|
|
|
|
- if ( format === RGBAFormat ) {
|
|
|
|
|
|
+ for ( let i = 0; i < data.length; i += 4 ) {
|
|
|
|
|
|
- for ( let i = 0; i < data.length; i += 4 ) {
|
|
|
|
-
|
|
|
|
- data[ i + 0 ] = image.data[ i + 0 ];
|
|
|
|
- data[ i + 1 ] = image.data[ i + 1 ];
|
|
|
|
- data[ i + 2 ] = image.data[ i + 2 ];
|
|
|
|
- data[ i + 3 ] = image.data[ i + 3 ];
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- for ( let i = 0, j = 0; i < data.length; i += 4, j += 3 ) {
|
|
|
|
-
|
|
|
|
- data[ i + 0 ] = image.data[ j + 0 ];
|
|
|
|
- data[ i + 1 ] = image.data[ j + 1 ];
|
|
|
|
- data[ i + 2 ] = image.data[ j + 2 ];
|
|
|
|
- data[ i + 3 ] = 255;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ data[ i + 0 ] = image.data[ i + 0 ];
|
|
|
|
+ data[ i + 1 ] = image.data[ i + 1 ];
|
|
|
|
+ data[ i + 2 ] = image.data[ i + 2 ];
|
|
|
|
+ data[ i + 3 ] = image.data[ i + 3 ];
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|