|
@@ -1166,6 +1166,7 @@
|
|
|
color.r = value;
|
|
|
color.g = value;
|
|
|
color.b = value;
|
|
|
+ color.a = 1;
|
|
|
break;
|
|
|
|
|
|
case TEXTURE_TYPE.INTENSITY_ALPHA:
|
|
@@ -1182,6 +1183,7 @@
|
|
|
color.r = parseInt( '0x' + hex.substring( 2, 4 ) );
|
|
|
color.g = parseInt( '0x' + hex.substring( 4, 6 ) );
|
|
|
color.b = parseInt( '0x' + hex.substring( 6, 8 ) );
|
|
|
+ color.a = 1;
|
|
|
break;
|
|
|
|
|
|
case TEXTURE_TYPE.RGBA:
|
|
@@ -1247,10 +1249,8 @@
|
|
|
const width = fieldValues[ 0 ];
|
|
|
const height = fieldValues[ 1 ];
|
|
|
const num_components = fieldValues[ 2 ];
|
|
|
- const useAlpha = num_components === 2 || num_components === 4;
|
|
|
const textureType = getTextureType( num_components );
|
|
|
- const size = ( useAlpha === true ? 4 : 3 ) * ( width * height );
|
|
|
- const data = new Uint8Array( size );
|
|
|
+ const data = new Uint8Array( 4 * width * height );
|
|
|
const color = {
|
|
|
r: 0,
|
|
|
g: 0,
|
|
@@ -1261,27 +1261,15 @@
|
|
|
for ( let j = 3, k = 0, jl = fieldValues.length; j < jl; j ++, k ++ ) {
|
|
|
|
|
|
parseHexColor( fieldValues[ j ], textureType, color );
|
|
|
-
|
|
|
- if ( useAlpha === true ) {
|
|
|
-
|
|
|
- const stride = k * 4;
|
|
|
- data[ stride + 0 ] = color.r;
|
|
|
- data[ stride + 1 ] = color.g;
|
|
|
- data[ stride + 2 ] = color.b;
|
|
|
- data[ stride + 3 ] = color.a;
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
- const stride = k * 3;
|
|
|
- data[ stride + 0 ] = color.r;
|
|
|
- data[ stride + 1 ] = color.g;
|
|
|
- data[ stride + 2 ] = color.b;
|
|
|
-
|
|
|
- }
|
|
|
+ const stride = k * 4;
|
|
|
+ data[ stride + 0 ] = color.r;
|
|
|
+ data[ stride + 1 ] = color.g;
|
|
|
+ data[ stride + 2 ] = color.b;
|
|
|
+ data[ stride + 3 ] = color.a;
|
|
|
|
|
|
}
|
|
|
|
|
|
- texture = new THREE.DataTexture( data, width, height, useAlpha === true ? THREE.RGBAFormat : THREE.RGBFormat );
|
|
|
+ texture = new THREE.DataTexture( data, width, height );
|
|
|
texture.needsUpdate = true;
|
|
|
texture.__type = textureType; // needed for material modifications
|
|
|
|