Skip to content

Commit

Permalink
Resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Xintong Xia committed Jun 21, 2019
1 parent cdf33e2 commit a7629a8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
6 changes: 1 addition & 5 deletions modules/webgl/src/classes/texture.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,7 @@ export default class Texture extends Resource {
// Call to regenerate mipmaps after modifying texture(s)
generateMipmap(params = {}) {
if (!this.mipmaps) {
if (this._isNPOT()) {
log.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaping`)();
} else {
log.warn('mipmaps is not enabled.');
}
log.warn('mipmaps is not enabled.');
return this;
}

Expand Down
17 changes: 12 additions & 5 deletions modules/webgl/test/classes/texture.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,14 @@ test('WebGL2#Texture2D resize', t => {
height: 4
});

t.ok(texture.mipmaps, 'mipmaps should be the same as before resizing for POT texture.');
t.ok(texture.mipmaps, 'mipmaps:true should be the same as before resizing to POT.');

texture.resize({
width: 3,
height: 3
});

t.notOk(texture.mipmaps, 'mipmaps:true should set to false when resizing tp NPOT.');

texture = new Texture2D(gl, {
data: null,
Expand All @@ -603,14 +610,14 @@ test('WebGL2#Texture2D resize', t => {
height: 4
});

t.notOk(texture.mipmaps, 'mipmaps should be the same as before resizing for POT texture.');
t.notOk(texture.mipmaps, 'mipmaps:false should be the same as before resizing to POT.');

texture.resize({
width: 1,
height: 1
width: 3,
height: 3
});

t.notOk(texture.mipmaps, 'mipmaps should set to false when resizing for NPOT texture.');
t.notOk(texture.mipmaps, 'mipmaps:false should set to false when resizing to NPOT.');

// data: typed array
t.end();
Expand Down

0 comments on commit a7629a8

Please sign in to comment.