未验证 提交 9c2ba55a 编写于 作者: M Michael Herzog 提交者: GitHub

GLTFExporter: Fix support for RGBA textures. (#21888)

上级 71c8b3f6
......@@ -890,11 +890,20 @@
}
let data = image.data;
const data = new Uint8ClampedArray( image.height * image.width * 4 );
if ( format === THREE.RGBFormat ) {
if ( format === THREE.RGBAFormat ) {
data = new Uint8ClampedArray( image.height * image.width * 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 ) {
......
......@@ -986,11 +986,20 @@ class GLTFWriter {
}
let data = image.data;
const data = new Uint8ClampedArray( image.height * image.width * 4 );
if ( format === RGBFormat ) {
if ( format === RGBAFormat ) {
data = new Uint8ClampedArray( image.height * image.width * 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 ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册