-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
feat(webgl): add global property support for p5.strands #8211
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
Changes from 11 commits
0251a23
1641398
12a3f50
aa96ea9
9a185ad
ccd855c
c393374
1721497
df6cff1
30fcf4d
6e5bd17
3db94cd
2fdd571
c5f4665
edecbc1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -447,6 +447,28 @@ suite('p5.Shader', function() { | |
| }).not.toThrowError(); | ||
| }); | ||
|
|
||
| test('returns numbers for builtin globals outside hooks and a strandNode when called inside hooks', () => { | ||
| myp5.createCanvas(5, 5, myp5.WEBGL); | ||
| let mxInHook; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One last thing for this before merging, these variables don't get assigned to -- the callback in |
||
| let wInHook; | ||
| myp5.baseMaterialShader().modify(() => { | ||
| myp5.getPixelInputs(inputs => { | ||
| mxInHook = window.mouseX; | ||
| wInHook = window.width; | ||
| inputs.color = [1, 0, 0, 1]; | ||
| assert.isTrue(mxInHook.isStrandsNode); | ||
| assert.isTrue(wInHook.isStrandsNode); | ||
| return inputs; | ||
| }); | ||
| }, { myp5 }); | ||
|
|
||
| const mx = window.mouseX; | ||
| const w = window.width; | ||
| assert.isNumber(mx); | ||
| assert.isNumber(w); | ||
| assert.strictEqual(w, myp5.width); | ||
| }); | ||
|
|
||
| test('handle custom uniform names with automatic values', () => { | ||
| myp5.createCanvas(50, 50, myp5.WEBGL); | ||
| const testShader = myp5.baseMaterialShader().modify(() => { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this test enough? do you suggest adding unit tests as well? @davepagurek
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we could add a visual test that makes use of e.g. width and height?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aah yes, I mean visual tests.