Made a new method to return Geometry with no internal colors.#6498
Made a new method to return Geometry with no internal colors.#6498davepagurek merged 11 commits intoprocessing:mainfrom
Conversation
davepagurek
left a comment
There was a problem hiding this comment.
Nice work on this! I think we just want to add some documentation to the new method now.
src/webgl/3d_primitives.js
Outdated
| * Clears the internal Color of the Geometry. | ||
| * @method clearColors | ||
| */ | ||
| p5.prototype.clearColors = function () { |
There was a problem hiding this comment.
I think maybe we can take out this method now that we have one on p5.Geometry.
| this.dirtyFlags = {}; | ||
| } | ||
|
|
||
| clearColors() { |
There was a problem hiding this comment.
Do you think you can add a doc comment around this one? It would be nice to add your example in the video in your PR description. Maybe we can add two examples: one showing the behaviour without clearColors(), and one showing the behaviour with clearColors()?
Here's an example of a doc comment with an example sketch on another class. Adding one here would look similar:
p5.js/src/webgl/p5.Framebuffer.js
Lines 750 to 794 in 716554f
There was a problem hiding this comment.
Okay, I will add a doc comment around this one.
|
@davepagurek , I have added a doc comment with two examples. Can you check and suggest what else we need? |
davepagurek
left a comment
There was a problem hiding this comment.
Nice work so far, and great comments in the example! I just have a few more comments to clean up the example a bit.
src/webgl/p5.Geometry.js
Outdated
| * for (let vec of points) vertex(vec.x * 200, vec.y * 200, vec.z * 200); | ||
| * endShape(CLOSE); | ||
| * shape02 = endGeometry(); | ||
| * // You can also call shape02.clearColors() here. |
There was a problem hiding this comment.
How do you feel about putting the clearColors() here? It also works having it in draw, but it only needs to be called once, so it feels like only doing it once when building the shape fits more cleanly.
src/webgl/p5.Geometry.js
Outdated
| * let points = []; | ||
| * | ||
| * function setup() { | ||
| * renderer = createCanvas(600, 600, WEBGL); |
There was a problem hiding this comment.
I think we can take out the renderer = because we don't use it elsewhere.
There was a problem hiding this comment.
Oh yess... I will take out that.
src/webgl/p5.Geometry.js
Outdated
| } | ||
|
|
||
| /** | ||
| * Removes the internal Colors of p5.Geometry |
There was a problem hiding this comment.
Maybe we can add one more sentence after this explaining that this lets you supply new colors with fill() before drawing it? And otherwise, fill() gets ignored?
There was a problem hiding this comment.
Yes. I was also thinking of that... Okay going to add this.
There was a problem hiding this comment.
One other small request: could we add a period at the end of the sentence so it fits with the style of the next bit of text? other than that I think everything looks good!
src/webgl/p5.Geometry.js
Outdated
| * Removes the internal Colors of p5.Geometry | ||
| * Using clearColors, you can use 'fill()' to supply new colors before drawing each shape. | ||
| * If clearColors() is not used, the shapes will use their internal colors. | ||
| * If clearColors() is not used, the shapes will use their internal colors by ignoring 'fill()'. |
There was a problem hiding this comment.
If you use backticks around the function names, they'll get rendered like code:
by ignoring `fill()`....becomes:
by ignoring fill().
There was a problem hiding this comment.
Okay...gonna do it.
|
@davepagurek Does it looks good now? |
|
Any other change you want @davepagurek ? |
davepagurek
left a comment
There was a problem hiding this comment.
Found two tiny things, and after that we're good to merge!
src/webgl/p5.Geometry.js
Outdated
| /** | ||
| * Removes the internal Colors of p5.Geometry. | ||
| * Using clearColors, you can use `fill()` to supply new colors before drawing each shape. | ||
| * If clearColors() is not used, the shapes will use their internal colors by ignoring `fill()`. |
There was a problem hiding this comment.
One more spot where we can use backticks:
| * If clearColors() is not used, the shapes will use their internal colors by ignoring `fill()`. | |
| * If `clearColors()` is not used, the shapes will use their internal colors by ignoring `fill()`. |
src/webgl/p5.Geometry.js
Outdated
| } | ||
|
|
||
| /** | ||
| * Removes the internal Colors of p5.Geometry. |
There was a problem hiding this comment.
oh also, we have an extra capital in here:
| * Removes the internal Colors of p5.Geometry. | |
| * Removes the internal colors of p5.Geometry. |
There was a problem hiding this comment.
Ok gonna do ASAP, wait
There was a problem hiding this comment.
Btw nice observation 😅
davepagurek
left a comment
There was a problem hiding this comment.
Everything looks good to go now, thanks! 😁
|
Sorry @davepagurek for these all mistakes. And thankyou so much for the constant support. |
|
No worries! Don't think of it so much as finding mistakes, rather it's just always helpful having an editor/reviewer to catch things that slip by. Hopefully it relieves some of the pressure knowing you don't have to get everything right yourself the first time because someone else is also helping to check! |
Yes, Thankyou so much. Love to contribute more like this. |
Resolves #6384
Changes:
PR.mp4
Description:
let shap01;
function setup() {
renderer = createCanvas(600, 600, WEBGL);
buildShape02();
}
function draw() {
background(0);
fill("yellow");
model(shape02);
}
function buildShape02() {
beginGeometry();
fill("red"); //The box is red
box(50);
shape02 = endGeometry();
shape02.clearColors(); //After calling this the box becomes yellow as it removes internal colors.
}
PR Checklist
npm run lintpasses