Skip to content
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

Reflector/Refractor: Expose virtual camera as a property. #23890

Merged
merged 3 commits into from
Apr 14, 2022

Conversation

LR17
Copy link
Contributor

@LR17 LR17 commented Apr 12, 2022

Description

It may be useful to control some properties of the camera used by Reflector, for example to set its layers. This pull request expose the camera used by Reflector as a property of the object.

@Mugen87
Copy link
Collaborator

Mugen87 commented Apr 12, 2022

Do you mind making the same change for Refractor? It would be good to keep both classes in sync.

@mrdoob
Copy link
Owner

mrdoob commented Apr 12, 2022

It may be useful to control some properties of the camera used by Reflector, for example to set its layers.

Do you mean copying the main camera layers? Or custom layers?

@LR17
Copy link
Contributor Author

LR17 commented Apr 13, 2022

My specific use case is this: I have some sets of meshes and for each set I assign it a layer so that all the meshes of a set have the same layer. Then I want the main camera of my application to be able to see a set of layers different from the ones seen by the Reflector camera. My client code would then look like this:

const reflector = new Reflector(geometry, options); 
reflector.camera.layers.enable(3); 
reflector.camera.layers.enable(7);

@Mugen87
Copy link
Collaborator

Mugen87 commented Apr 13, 2022

Um, if the virtual camera should work with different layers than the main camera, it's indeed required to expose it.

Too bad, I was hoping we could hide the camera inside the classes. In some sense, the virtual camera is a technical detail that should not be relevant to users.

@Mugen87 Mugen87 changed the title Expose Reflector camera as a property Reflector/Refractor: Expose virtual camera as a property. Apr 14, 2022
@mrdoob mrdoob added this to the r140 milestone Apr 14, 2022
@mrdoob mrdoob merged commit 211ca7f into mrdoob:dev Apr 14, 2022
@mrdoob
Copy link
Owner

mrdoob commented Apr 14, 2022

Thanks!

@LR17 LR17 deleted the reflector branch August 24, 2022 06:47
abernier pushed a commit to abernier/three.js that referenced this pull request Sep 16, 2022
* expose reflector camera as a property

* clean up

* Expose Refractor camera property
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants