Skip to content

Commit

Permalink
Change behaviour of setPackState when passed undefined options to avo…
Browse files Browse the repository at this point in the history
…id confusion

This prevents calls to setPackState from influencing the packing state of all subsequently-loaded textures.
  • Loading branch information
jthistle committed Sep 6, 2024
1 parent a662680 commit f841cad
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 68 deletions.
13 changes: 4 additions & 9 deletions dist/5.x/twgl-full.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/5.x/twgl-full.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/5.x/twgl-full.min.js

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions dist/5.x/twgl-full.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -5600,15 +5600,9 @@ function setDefaults$1(newDefaults) {
* @private
*/
function setPackState(gl, options) {
if (options.colorspaceConversion !== undefined) {
gl.pixelStorei(UNPACK_COLORSPACE_CONVERSION_WEBGL, options.colorspaceConversion);
}
if (options.premultiplyAlpha !== undefined) {
gl.pixelStorei(UNPACK_PREMULTIPLY_ALPHA_WEBGL, options.premultiplyAlpha);
}
if (options.flipY !== undefined) {
gl.pixelStorei(UNPACK_FLIP_Y_WEBGL, options.flipY);
}
gl.pixelStorei(UNPACK_COLORSPACE_CONVERSION_WEBGL, options.colorspaceConversion ?? 0);
gl.pixelStorei(UNPACK_PREMULTIPLY_ALPHA_WEBGL, options.premultiplyAlpha ?? 0);
gl.pixelStorei(UNPACK_FLIP_Y_WEBGL, options.flipY ?? 0);
}

/**
Expand Down
13 changes: 4 additions & 9 deletions dist/5.x/twgl.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/5.x/twgl.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/5.x/twgl.min.js

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions dist/5.x/twgl.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -1694,15 +1694,9 @@ function setDefaults$1(newDefaults) {
* @private
*/
function setPackState(gl, options) {
if (options.colorspaceConversion !== undefined) {
gl.pixelStorei(UNPACK_COLORSPACE_CONVERSION_WEBGL, options.colorspaceConversion);
}
if (options.premultiplyAlpha !== undefined) {
gl.pixelStorei(UNPACK_PREMULTIPLY_ALPHA_WEBGL, options.premultiplyAlpha);
}
if (options.flipY !== undefined) {
gl.pixelStorei(UNPACK_FLIP_Y_WEBGL, options.flipY);
}
gl.pixelStorei(UNPACK_COLORSPACE_CONVERSION_WEBGL, options.colorspaceConversion ?? 0);
gl.pixelStorei(UNPACK_PREMULTIPLY_ALPHA_WEBGL, options.premultiplyAlpha ?? 0);
gl.pixelStorei(UNPACK_FLIP_Y_WEBGL, options.flipY ?? 0);
}

/**
Expand Down
13 changes: 4 additions & 9 deletions npm/base/dist/5.x/twgl.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion npm/base/dist/5.x/twgl.js.map

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions npm/base/dist/5.x/twgl.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -1694,15 +1694,9 @@ function setDefaults$1(newDefaults) {
* @private
*/
function setPackState(gl, options) {
if (options.colorspaceConversion !== undefined) {
gl.pixelStorei(UNPACK_COLORSPACE_CONVERSION_WEBGL, options.colorspaceConversion);
}
if (options.premultiplyAlpha !== undefined) {
gl.pixelStorei(UNPACK_PREMULTIPLY_ALPHA_WEBGL, options.premultiplyAlpha);
}
if (options.flipY !== undefined) {
gl.pixelStorei(UNPACK_FLIP_Y_WEBGL, options.flipY);
}
gl.pixelStorei(UNPACK_COLORSPACE_CONVERSION_WEBGL, options.colorspaceConversion ?? 0);
gl.pixelStorei(UNPACK_PREMULTIPLY_ALPHA_WEBGL, options.premultiplyAlpha ?? 0);
gl.pixelStorei(UNPACK_FLIP_Y_WEBGL, options.flipY ?? 0);
}

/**
Expand Down
12 changes: 3 additions & 9 deletions src/textures.js
Original file line number Diff line number Diff line change
Expand Up @@ -616,15 +616,9 @@ function setDefaults(newDefaults) {
* @private
*/
function setPackState(gl, options) {
if (options.colorspaceConversion !== undefined) {
gl.pixelStorei(UNPACK_COLORSPACE_CONVERSION_WEBGL, options.colorspaceConversion);
}
if (options.premultiplyAlpha !== undefined) {
gl.pixelStorei(UNPACK_PREMULTIPLY_ALPHA_WEBGL, options.premultiplyAlpha);
}
if (options.flipY !== undefined) {
gl.pixelStorei(UNPACK_FLIP_Y_WEBGL, options.flipY);
}
gl.pixelStorei(UNPACK_COLORSPACE_CONVERSION_WEBGL, options.colorspaceConversion ?? 0);
gl.pixelStorei(UNPACK_PREMULTIPLY_ALPHA_WEBGL, options.premultiplyAlpha ?? 0);
gl.pixelStorei(UNPACK_FLIP_Y_WEBGL, options.flipY ?? 0);
}

/**
Expand Down

0 comments on commit f841cad

Please sign in to comment.