Skip to content

Commit

Permalink
Merge b599c3b into f1f7119
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress committed Nov 22, 2019
2 parents f1f7119 + b599c3b commit aa4d745
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
12 changes: 12 additions & 0 deletions docs/upgrade-guide.md
Expand Up @@ -18,6 +18,18 @@ The module structure has been significantly changed for v8.0 with the intention
| debug | Debug tooling for the other modules | Same as before |
| test-utils | Test tooling for the other modules | Same as before |

### Breaking changes

- `Texture2D`'s `unpackFlipY` option is removed. This change ensures that all data sources (Image, ImageBitmap, typed array) are treated consistently. As a result, textures created from Image objects and URL strings are now y-flipped from the v7.3 default. To get the old behavior, specify the `pixelStore` option:

```js
new Texture2D({
data,
pixelStore: {
[GL.UNPACK_FLIP_Y_WEBGL]: true
}
});
```

### Smaller changes

Expand Down
3 changes: 0 additions & 3 deletions modules/addons/src/gltf/gltf-environment.js
Expand Up @@ -73,9 +73,6 @@ export default class GLTFEnvironment {
[GL.TEXTURE_MIN_FILTER]: GL.LINEAR,
[GL.TEXTURE_MAG_FILTER]: GL.LINEAR
},
pixelStore: {
[this.gl.UNPACK_FLIP_Y_WEBGL]: false
},
// Texture2D accepts a promise that returns an image as data (Async Textures)
data: loadImage(this.brdfLutUrl)
});
Expand Down
14 changes: 2 additions & 12 deletions modules/webgl/src/classes/texture.js
Expand Up @@ -93,9 +93,7 @@ export default class Texture extends Resource {
recreate = false,
parameters = {},
pixelStore = {},
textureUnit = undefined,
// Deprecated parameters
unpackFlipY = true
textureUnit = undefined
} = props;

let {mipmaps = true} = props;
Expand Down Expand Up @@ -137,14 +135,6 @@ export default class Texture extends Resource {
this.gl.bindTexture(this.target, this.handle);
}

// Note: luma.gl defaults to GL.UNPACK_FLIP_Y_WEBGL = true;
// TODO - compare v4 and v3
const DEFAULT_TEXTURE_SETTINGS = {
// Pixel store
[GL.UNPACK_FLIP_Y_WEBGL]: unpackFlipY
};
const glSettings = Object.assign({}, DEFAULT_TEXTURE_SETTINGS, pixelStore);

if (mipmaps && this._isNPOT()) {
log.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaping`)();
mipmaps = false;
Expand All @@ -164,7 +154,7 @@ export default class Texture extends Resource {
dataFormat,
border,
mipmaps,
parameters: glSettings
parameters: pixelStore
});

if (mipmaps) {
Expand Down

0 comments on commit aa4d745

Please sign in to comment.