-
-
Notifications
You must be signed in to change notification settings - Fork 35.8k
Texture: Add setValues. #31087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Texture: Add setValues. #31087
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* global QUnit */ | ||
|
||
import { NearestFilter } from '../../../../src/constants.js'; | ||
import { RenderTarget } from '../../../../src/core/RenderTarget.js'; | ||
|
||
export default QUnit.module( 'Core', () => { | ||
|
||
QUnit.module( 'RenderTarget', () => { | ||
|
||
// Constructor options | ||
QUnit.test( 'Constructor', ( assert ) => { | ||
|
||
const empty = new RenderTarget(); | ||
assert.ok( empty.width != null && empty.height != null && empty.textures.length === 1, 'Can instantiate a RenderTarget with no arguments.' ); | ||
|
||
const sized = new RenderTarget( 1, 1 ); | ||
assert.ok( sized.width === 1 && sized.height === 1 && sized.textures.length === 1, 'Can instantiate a RenderTarget with custom size.' ); | ||
|
||
const mrt = new RenderTarget( 1, 1, { count: 2 } ); | ||
assert.ok( mrt.width === 1 && mrt.height === 1 && mrt.textures.length === 2, 'Can instantiate a RenderTarget with custom count (MRT).' ); | ||
|
||
const options = new RenderTarget( 1, 1, { magFilter: NearestFilter } ); | ||
assert.ok( options.width === 1 && options.height === 1 && options.texture.magFilter === NearestFilter, 'Can instantiate a RenderTarget with texture options.' ); | ||
|
||
} ); | ||
|
||
// PROPERTIES | ||
QUnit.todo( 'texture', ( assert ) => { | ||
|
||
assert.ok( false, 'everything\'s gonna be alright' ); | ||
|
||
} ); | ||
|
||
QUnit.todo( 'depthTexture', ( assert ) => { | ||
|
||
assert.ok( false, 'everything\'s gonna be alright' ); | ||
|
||
} ); | ||
|
||
// PUBLIC | ||
QUnit.test( 'setSize', ( assert ) => { | ||
|
||
const renderTarget = new RenderTarget(); | ||
renderTarget.setSize( 128, 128 ); | ||
assert.ok( renderTarget.width === 128 && renderTarget.height === 128, 'Sets a size with width and height' ); | ||
assert.ok( renderTarget.texture.image.width === 128 && renderTarget.texture.image.height === 128, 'Texture image is updated on resize' ); | ||
assert.ok( renderTarget.viewport.width === 128 && renderTarget.viewport.height === 128, 'Viewport is updated on resize' ); | ||
assert.ok( renderTarget.scissor.width === 128 && renderTarget.scissor.height === 128, 'Scissor is updated on resize' ); | ||
|
||
const mrt = new RenderTarget( 0, 0, { count: 2 } ); | ||
mrt.setSize( 128, 128 ); | ||
assert.ok( mrt.width === 128 && mrt.height === 128, 'Sets a size with width and height' ); | ||
assert.ok( mrt.textures[ 0 ].image.width === 128 && mrt.textures[ 0 ].image.height === 128 && mrt.textures[ 1 ].image.width === 128 && mrt.textures[ 1 ].image.height === 128, 'Texture images are updated on resize' ); | ||
assert.ok( mrt.viewport.width === 128 && mrt.viewport.height === 128, 'Viewport is updated on resize' ); | ||
assert.ok( mrt.scissor.width === 128 && mrt.scissor.height === 128, 'Scissor is updated on resize' ); | ||
|
||
const renderTarget3D = new RenderTarget(); | ||
renderTarget3D.setSize( 128, 128, 16 ); | ||
assert.ok( renderTarget3D.width === 128 && renderTarget3D.height === 128 && renderTarget3D.depth === 16, 'Sets a size with width, height, and depth' ); | ||
assert.ok( renderTarget3D.texture.image.width === 128 && renderTarget3D.texture.image.height === 128 && renderTarget3D.texture.image.depth === 16, 'Texture image is updated on resize' ); | ||
assert.ok( renderTarget3D.viewport.width === 128 && renderTarget3D.viewport.height === 128, 'Viewport is updated on resize' ); | ||
assert.ok( renderTarget3D.scissor.width === 128 && renderTarget3D.scissor.height === 128, 'Scissor is updated on resize' ); | ||
|
||
} ); | ||
|
||
} ); | ||
|
||
} ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* global QUnit */ | ||
|
||
import { RenderTarget3D } from '../../../../src/core/RenderTarget3D.js'; | ||
|
||
import { EventDispatcher } from '../../../../src/core/EventDispatcher.js'; | ||
import { NearestFilter, RepeatWrapping } from '../../../../src/constants.js'; | ||
|
||
export default QUnit.module( 'Core', () => { | ||
|
||
QUnit.module( 'RenderTarget3D', () => { | ||
|
||
// INHERITANCE | ||
QUnit.test( 'Extending', ( assert ) => { | ||
|
||
const object = new RenderTarget3D(); | ||
assert.strictEqual( | ||
object instanceof EventDispatcher, true, | ||
'RenderTarget3D extends from EventDispatcher' | ||
); | ||
|
||
const options = new RenderTarget3D( 1, 1, 1, { magFilter: NearestFilter, wrapR: RepeatWrapping } ); | ||
assert.ok( options.width === 1 && options.height === 1 && options.depth === 1 && options.texture.magFilter === NearestFilter && options.texture.wrapR === RepeatWrapping, 'Can instantiate a RenderTarget3D with texture options.' ); | ||
|
||
} ); | ||
|
||
} ); | ||
|
||
} ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.