-
-
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
Should createCamera
still auto-set itself as the default camera?
#7077
Comments
In view of this @davepagurek maybe we can introduce a new parameter or function option for Its implementation example can be something like: // Current behavior
let mainCamera = createCamera(); // Sets itself as default
// Suggested new parameter approach
let mainCamera = createCamera(true); // Explicitly sets itself as default
let framebufferCamera = createCamera(false); // Does not set itself as default
// Usage with push/pop
push();
setCamera(framebufferCamera);
// Perform framebuffer operations
pop(); |
@davepagurek Please let me know if this approach seems fine to you, and if you agree may be I could go on with making a PR for this?! |
Hi, sorry for the delay! I think making it by default not set itself, and letting you optionally make it set itself would be a good change. Maybe to make it easier to read the code, we could have an options object instead of just a boolean parameter? Something like: myCam = createCamera({ setDefault: true }) The other thing is, as this would be a change to default behaviour, we'd probably need to branch off of the dev-2.0 branch rather than the main branch to make the change just be released as part of 2.0. |
+1 for the "Make all cameras not auto-apply themselves" approach. What do people think about matching // createCamera([x], [y], [z], [centerX], [centerY], [centerZ], [upX], [upY], [upZ])
let myCam = createCamera(200, -400, 800);
setCamera(myCam); |
I think that could make sense @nickmcintyre. What are your thoughts on having the optional ability to set a camera as default? Would it be worth adding an optional options object to the end of that signature, or just relying on |
@davepagurek @Garima3110 I think I'm in favor of using |
Not currently I think, I had suggested it to avoid the slightly more cryptic API of Since we already have |
Considering your points, @davepagurek and @nickmcintyre, I agree that using |
I think we're ok to make a PR into the dev-2.0 branch then if you're up for it! For all 2.0 features, we're going to have an advisory committee help make the final decision on what gets included, but the dev-2.0 branch is where we've been working on things we feel reasonably confident in and wanted to start prototyping. |
Topic
When debugging #7071 with @Vishal2002, we noticed a bug in my original bug report's code: I was creating a framebuffer camera in
setup
withcreateCamera
, and it was accidentally being set as the main canvas's camera. This was happening because the default behaviour of anycreateCamera()
call is not only to return a new camera, but also to basically callsetCamera()
on it too. If you don't want that, you have to manually surround it withpush
/pop
or an equivalent.Some thoughts:
begin
/end
There are a few ways we could try to resolve this, from lightest to heaviest touch:
push
/pop
. It introduces a bit of inconsistency, but the way you use cameras in framebuffers is already a bit inconsistent because you have to apply a camera within eachbegin
/end
due to it not saving state between draws.The text was updated successfully, but these errors were encountered: