-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Limit Scope of Default Uniforms #5280
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
Open
JetStarBlues
wants to merge
4
commits into
processing:main
Choose a base branch
from
JetStarBlues:limitUniformScope
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
5c5bf08
Limit scope of default fill shader uniforms.
JetStarBlues bac793a
Limit scope of default stroke shader uniforms.
JetStarBlues f1c72ce
Move declaration of `uViewPort` uniform to same location
JetStarBlues 1b43c48
Move declaration of `uPerspective` uniform to same location
JetStarBlues 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -209,8 +209,6 @@ p5.Shader.prototype.bindShader = function() { | |
this._bound = true; | ||
|
||
this._setMatrixUniforms(); | ||
|
||
this.setUniform('uViewport', this._renderer._viewport); | ||
} | ||
}; | ||
|
||
|
@@ -262,15 +260,6 @@ p5.Shader.prototype.unbindTextures = function() { | |
|
||
p5.Shader.prototype._setMatrixUniforms = function() { | ||
this.setUniform('uProjectionMatrix', this._renderer.uPMatrix.mat4); | ||
if (this.isStrokeShader()) { | ||
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. I think moving this to the set stroke uniforms makes sense! |
||
if (this._renderer._curCamera.cameraType === 'default') { | ||
// strokes scale up as they approach camera, default | ||
this.setUniform('uPerspective', 1); | ||
} else { | ||
// strokes have uniform scale regardless of distance from camera | ||
this.setUniform('uPerspective', 0); | ||
} | ||
} | ||
this.setUniform('uModelViewMatrix', this._renderer.uMVMatrix.mat4); | ||
this.setUniform('uViewMatrix', this._renderer._curCamera.cameraMatrix.mat4); | ||
if (this.uniforms.uNormalMatrix) { | ||
|
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.
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.
Wouldn't this prevent people from using the uSampler uniform? For instance, at the moment, you can use uSampler as a uniform in your shader and have p5 send you whatever texture was bound with the texture() function. I think we wouldn't want to take that functionality away.
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.
Just based off of the code, I think if a user has set
texture(someTexture)
, thenthis._tex
will be set, and theuSampler
uniform will still get set for you here. A test to confirm that would be great though