Skip to content

Per-engine camera selection + native rename#18

Draft
kiryldz wants to merge 3 commits into
mainfrom
kdz-refactor
Draft

Per-engine camera selection + native rename#18
kiryldz wants to merge 3 commits into
mainfrom
kdz-refactor

Conversation

@kiryldz
Copy link
Copy Markdown
Owner

@kiryldz kiryldz commented May 14, 2026

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.

kiryldz added 3 commits May 14, 2026 16:45
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.
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.

1 participant