-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Defaults for buildGeometry #6722
Comments
Going to tag the other WebGL stewards too in case any of you have opinions on what the defaults should be: @aferriss, @aceslowman, @ShenpaiSharma, @ChihYungChang, @teragramgius, @JazerUCSB, @richardegil, @itsjoopark, @Gaurav-1306, @jeanetteandrews Assuming we do want to change the defaults: one way to do this could be to add a settings object to const geom = buildGeometry(() => {
// ...
}, { includeColors: true });
// or:
beginGeometry({ includeColors: true });
// ...
const geom = endGeometry(); How do you feel about an API like that? |
A settings object sounds fine to me. What other settings would we add? If it's just a single one, it probably doesn't need to be an object, although I suppose that does future proof it somewhat if more options are added in the future. |
One thing that comes to mind is possibly something to do with how edges are handled. Currently, edges display incorrectly if you create geometry without a stroke enabled, but then try to draw it later with strokes. One option is to always generate strokes when building geometry, but if this adds a significant time cost for people who won't ever use it, it might make sense to add a setting to disable it. |
Hello @wagedu , Thank you for raising this point. I'd also like to express my gratitude to @davepagurek and @aferriss for sharing their insights on the topic. While working on the const shape1 = buildGeometry(() => {
fill('red');
box();
});
shape1.clearColors();
fill('blue');
model(shape1); // the box should now be blue bcz we cleard its internal color. But after the imlementation we will completely eliminate the concept of const geom = buildGeometry(() => {
// ...
}, { includeColors: true/false }); // by default it could be true.
// or:
beginGeometry({ includeColors: true/false });
// ...
const geom = endGeometry(); The vanilla approach seems satisfactory, especially considering our use of framebuffers with All I would say, I agree with @davepagurek suggestion about potentially adding new settings like enabling/disabling strokes. If we plan to introduce additional settings beyond just colors, it might be beneficial to maintain a vanilla format. However, if we are only dealing with color settings, the current( |
For what it's worth, I think we'll still keep Also, in case it's relevant: currently, other material settings such as shininess are currently not included in |
Hi @perminder-17 I've also enjoyed the way you've put it. A Vanilla setup and consistency sound super sexy. In a very geeky way, I know For instance, It would be a way to be ready for what's coming. The question, though, is what defaults to use: But the "undefined" (not-set?) settings start blank + whenever the model is called, they are permeable to the canvas/scene settings. **Just in case, by permeable from the canvas settings I mean affected by the canvas setting. Like being affected (or not) by a |
Hi @wagedu , thanks for sharing your thoughts on this topic. I must say, our ideas align quite well, haha. I understand your point, and it resonates with me. Regarding the question of default settings, I completely agree with your suggestion to disable all default settings. Perhaps, if a user calls the One question arises for me here, and I know it might sound silly, but it seems like something worth considering for an improved user experience. When creating multiple models on a canvas, calling |
Hello @perminder-17 glad I didn't write a bunch of madness :) If your question is silly, then I'm Mr Silly. Defaults are -to me- the hardest choice Now, apologies if I use "automatically" as if it's something super easy to do. I don't know how the models are built internally. So, please take it as a suggestion from someone ignorant as to how easy/hard it is to implement. I'd go with your suggestion UNLESS it is possible to detect if any colors have been set or not. Then I'd use nothing. Which also arises another question: Bonus question: how does Cheers, have a great weekend! |
OOOOPS 2: sorry @perminder-17 and @davepagurek |
Thank you once again, @wagedu , for sharing your insightful thoughts and taking the time to discuss this topic. As you mentioned earlier, the buildGeometry function is expected to grow, and I share the same sentiment. We will going to be the one who will help making it grow hahaha
Regarding the use of the word "automatically" as mentioned above, where |
I think it's feasible: in My initial reasoning for trying to not be fancy is because some other properties get set outside of |
Again, apologies in advance for questions based on lack of knowledge. My suggested "logic" comes from expecting the customGeoms to behave like native Geoms (as far as possible, oc) function setup() {
createCanvas(400, 400,WEBGL);
noStroke();
fill('orange')
myG = buildGeometry(()=>{
sphere(50); //fill NOT specified
translate(0,50,0)
fill('red')
sphere(50)
})
}
function draw() {
background(220);
// myG.clearColors();
fill('blue')
model(myG)
} Assume I create a model called myG with 2 spheres in it. Only the second one has Currently, it will display one That makes me wonder 2 things:
=
If if I call my model like this: |
Increasing Access
More intuitive use of the command.
Most appropriate sub-area of p5.js?
Feature enhancement details
Currently buildGeometry creates models affected by the context's open settings (fill, rectMode etc).
ie if I have fill('blue') declared before I start a buildGeometry, the model will have the setting "fill = blue".
Also, by default, buildGeometry forces a call to model.disableColor() if one wants to use fill on the model.
I feel like the default for buildGeometry should be vanilla.
A vanilla geom that I can affect with fill is (probably) more frequent than a custom colored one where I want to disableColor before using fill on it (or rectMode, etc) - Specially because buildGeometry doesn't accept all params (no stroke, for instance), so it gets difficult to track what is being affected and what is not.
Then, only in cases where I want a non-vanilla model, it's up to me/user to pass "extra parameters" as modifiers when starting buildGeometry()
The text was updated successfully, but these errors were encountered: