Per-engine camera selection + native rename#18
Draft
kiryldz wants to merge 3 commits into
Draft
Conversation
Make each rendering engine (Vulkan, OpenGL) independently choose its camera source (Camera2 vs CameraX) and lens facing. CameraBox wraps each preview with its own FAB controls; the activity mounts Camera2 and/or CameraX based on which engines are currently using each source. Lens facing stays in sync when both engines share a camera source. Native: CoreEngine renamed to RenderingEngine (C++ class, header, JNI peer, CMake project). Kotlin Camera2/CameraX moved into the camera/ sub-package.
Drop the two mutableStateListOf engine lists from CameraActivity — they duplicated information already in the two CameraData states and could drift. Both Camera2 and CameraX engine lists are now derived inline from vulkanCameraData.cameraMode / openGlCameraData.cameraMode at the mount sites, so list membership cannot disagree with the cameraMode field. When an engine's cameraMode changes onto the source the other engine is already on, adopt the other engine's lens. Previously only the lens-flip callback synced lens facing, so flipping cameraMode could leave two engines on the same source with mismatched lens (and the activity-level lensFacing picker would silently choose one, causing UI/physical divergence). Camera2 and CameraX now read the engine list through rememberUpdatedState, so the per-frame listener (set once when the camera opens) always sees the current list. Without this an engine that hopped sources mid-stream would either keep receiving frames it shouldn't, or stop receiving frames it should, until the camera was torn down and reopened.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make each rendering engine (Vulkan, OpenGL) independently choose its camera source (Camera2 vs CameraX) and lens facing. CameraBox wraps each preview with its own FAB controls; the activity mounts Camera2 and/or CameraX based on which engines are currently using each source. Lens facing stays in sync when both engines share a camera source.
Native: CoreEngine renamed to RenderingEngine (C++ class, header, JNI peer, CMake project). Kotlin Camera2/CameraX moved into the camera/ sub-package.