-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Fix WebGL vertex property issue #7605
Fix WebGL vertex property issue #7605
Conversation
docs: add thrly as a contributor for doc, and code
docs: add lirenjie95 as a contributor for doc, and code
docs: add philyawj as a contributor for doc
docs: add akkarn1689 as a contributor for code
docs: add xinemata as a contributor for eventOrganizing, tutorial, and 3 more
…at2244 docs: add Vaivaswat2244 as a contributor for code
docs: add dkessner as a contributor for example
…Sinha1309 docs: add AnimeshSinha1309 as a contributor for example
…yank docs: add webermayank as a contributor for code
src/webgl/p5.Geometry.js
Outdated
for (const { point, dir, color } of potentialCaps.values()) { | ||
this._addCap(point, dir, color); | ||
this._addCap(point, dir, color); |
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.
Similar to how functions like addCap
, addSegment
, etc copy the positions and colors into new buffers, I think we'd have to do the same for vertex properties. The reason for this is that while the data is initially recorded per point on the line, those points then get turned into triangles to give the line thickness, so we end up having to repeat the data a few times for each point in the triangle.
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.
I'll update the implementation
Could you explain a bit what the the projectionMatrix, viewMatrix, and modelMatrix changes are? I didn't see code in the Files Changed tab relating to those at first glance. |
Fix endShape() to Properly Close Paths and Prevent Shape Merging
You're right, I mistakenly mentioned those matrices in the PR description, but they weren’t actually changed. The focus of this PR is fixing the WebGL vertex property issue. I'll update the description. Thanks for pointing it out! And for now I’ll update the implementation to copy vertex properties into new buffers, similar to how |
hey @davepagurek i've updated the pr. The issue with vertex properties has been resolved, and manual testing confirms the fix. |
Hey @davepagurek, just checking in—let me know if any further changes are needed. Thanks! |
src/webgl/p5.Geometry.js
Outdated
|
||
// Copy vertex properties into buffers for stroke vertices | ||
if (this.vertexProperties) { | ||
this.vertexProperties.push([...this.vertexProperties[currEdge[0]]]); |
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.
I think we might need to do this more than once, depending on what we add. So I think every edge has 4 vertices (we render segments as rectangles basically), so we'd have to double these up. But also, between some segments we have quads for joins, and at some segments we also have caps, and all of the vertices for those need vertex properties too, otherwise we won't have enough data to match all the vertices.
_addCap
, _addJoin
, and _addSegment
already do this duplication for positions and colors, so those methods may need to be modified to pass in vertex properties so that they can duplicate and add them too.
Hey, sorry for the delay! I may be a little slow to reply in the next few weeks as we finalize the initial p5 2.0 release, so I appreciate you pinging me to remind me 🙂 I left a comment about how we might be able to handle the extra vertices in caps, joins, etc, let me know if that makes sense! |
Fix camera tilt function to prevent orientation flipping
docs: add mclark414 as a contributor for ideas
…kkapeddi docs: add AaratiAkkapeddi as a contributor for ideas
Hey @davepagurek, thanks for the feedback! I’ll ensure that vertex properties are properly handled in |
docs: add mxramsey as a contributor for ideas
b6491c2
to
4496a4d
Compare
Resolves #7519
Changes:
dev-2.0
branch.PR Checklist
npm run lint
passes