Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion examples/js/loaders/GLTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2170,8 +2170,14 @@ THREE.GLTFLoader = ( function () {

if ( source.mimeType === 'image/png' ) {

// Inspect the PNG 'IHDR' chunk to determine whether the image could have an
// alpha channel. This check is conservative — the image could have an alpha
// channel with all values == 1, and the indexed type (colorType == 3) only
// sometimes contains alpha.
//
// https://en.wikipedia.org/wiki/Portable_Network_Graphics#File_header
hasAlpha = new DataView( bufferView, 25, 1 ).getUint8( 0, false ) === 6;
var colorType = new DataView( bufferView, 25, 1 ).getUint8( 0, false );
hasAlpha = colorType === 6 || colorType === 4 || colorType === 3;

}

Expand Down
8 changes: 7 additions & 1 deletion examples/jsm/loaders/GLTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2233,8 +2233,14 @@ var GLTFLoader = ( function () {

if ( source.mimeType === 'image/png' ) {

// Inspect the PNG 'IHDR' chunk to determine whether the image could have an
// alpha channel. This check is conservative — the image could have an alpha
// channel with all values == 1, and the indexed type (colorType == 3) only
// sometimes contains alpha.
//
// https://en.wikipedia.org/wiki/Portable_Network_Graphics#File_header
hasAlpha = new DataView( bufferView, 25, 1 ).getUint8( 0, false ) === 6;
var colorType = new DataView( bufferView, 25, 1 ).getUint8( 0, false );
hasAlpha = colorType === 6 || colorType === 4 || colorType === 3;

}

Expand Down