[go: up one dir, main page]

Skip to content

Invert how cameras and viewports are assigned to each other

Summary

When a Camera is created in setupCameras, it seems like it would make more sense to focus on working with the Camera instead of the other way around.

Example

In this sample, we "switch" from working with the Camera to working with the Viewport.

// ...
Camera camera = sm.createCamera(...);
window.getViewport(0).setCamera(camera);

Here, we just created the Camera, and it seems more "natural" to just set the Camera's Viewport directly as shown below instead of doing it as shown above.

// ...
Camera camera = sm.createCamera(...);
camera.setViewport(window.getViewport(0));

Benefits

It seems more natural and consistent, especially given the fact that the user's mind is focused on the Camera object after using the manager to create it. There's no technical benefit, but it seems more consistent.