Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upRefactoring Camera as a Component #440
Conversation
| @@ -138,7 +140,8 @@ where | ||
| .. | ||
| } = self; | ||
| - let camera = &camera; | ||
| + // TODO: multiple cameras | ||
| + let camera = (&camera, &global).join().next(); |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
added
project: core
status: ready
type: improvement
labels
Oct 21, 2017
torkleyy
assigned
Aceeri
Oct 21, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
minecrawler
Oct 21, 2017
Contributor
Hey, that's half my PR, however you cleared up one of my major pain points, so that's really awesome :D
- If possible, could you add the ActiveCamera component we talked about over there, so multiple cameras are possible? Only always take the first ActiveCamera!
- Shouldn't a camera have both,
TransformandLocalTransform, for example in case you want the camera to follow a mesh? (I hope I got the purpose ofLocalTransformright this time)
|
Hey, that's half my PR, however you cleared up one of my major pain points, so that's really awesome :D
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Oct 21, 2017
Member
For 2. That's up to the user, a LocalTransform will always be converted to a Transform before arriving in the renderer, this is done by Transformsystem.
|
For 2. That's up to the user, a LocalTransform will always be converted to a Transform before arriving in the renderer, this is done by Transformsystem. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
For 1. I'm still debating solutions to this problem |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
omni-viral
Oct 21, 2017
Member
ActiveCamera as optional resource is better. Otherwise changing active camera will have more boilerplate.
|
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
I think I'm gonna add |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Oct 21, 2017
Member
I will add the active camera resource for now, as optional, fallback to first camera if its not set, and fallback to identity from that
|
I will add the active camera resource for now, as optional, fallback to first camera if its not set, and fallback to identity from that |
| + .and_then(|a| { | ||
| + let cam = camera.get(a.entity); | ||
| + let transform = global.get(a.entity); | ||
| + cam.into_iter().zip(transform.into_iter()).next() |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
omni-viral
Oct 21, 2017
Member
This is unusual but good alternative to cam.and_then(|cam| transform.map(|transform| (cam, transform)))
omni-viral
Oct 21, 2017
Member
This is unusual but good alternative to cam.and_then(|cam| transform.map(|transform| (cam, transform)))
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Xaeroxe
approved these changes
Oct 21, 2017
I love it! This was how it should have been all along imo.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
r? @Aceeri |
Rhuagh
added some commits
Oct 21, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
bors r+ |
Rhuagh commentedOct 21, 2017
Render pass use Transform of Camera entity to compute the view matrix.