Skip to content

feat(ambiente): implementa ajuste de iluminação e cor do ambiente (RF-ENV-007) - #12

Merged
BGLuis merged 1 commit into
developfrom
feature/environment-lighting-color
Sep 25, 2026
Merged

BGLuis merged 1 commit into
developfrom
feature/environment-lighting-color

Conversation

@BGLuis

@BGLuis BGLuis commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Description

Implementa o requisito RF-ENV-007 (Ajuste de Iluminação e Cor do Ambiente) da Fase 0.5 (§4 e DoD §6), completando 100% das tarefas T4.1 a T4.5:

  • T4.1 & T4.2 (Screen Glow): Amostragem difusa da cor da tela derivada do pipeline offscreen 32×18 Vulkan projetada nas paredes e geometria dos ambientes 3D (cinema, living_room) com atenuação quadrática e orientação normal, sem uso de glReadPixels.
  • T4.3 (Brilho do Ambiente): Modulação do brilho base da iluminação e da skybox (0% a 100%).
  • T4.4 (Temperatura de Cor & Modo Noturno): Curva de Planckian locus (2700K a 6500K) e Modo Noturno (~3000K) em todos os pipelines de vídeo (video, stereo, stereo_cubemap), respeitando rigorosamente o limite de push constants de 128 bytes do Vulkan.
  • T4.5 (Interface & Persistência): Nova seção "Iluminação e Ambiente" em SettingsScreen.kt com slider de brilho, chips de Screen Glow (Desligado / Sutil / Forte), slider de temperatura em Kelvin e checkbox de Modo Noturno, persistidos via FeatureFlags em SharedPreferences.

Type of change

  • ✨ New feature (non-breaking change which adds functionality)
  • 📝 Documentation update

Affected layers

  • 🟣 Kotlin (app/) — app shell, UI panels, credentials, history, i18n
  • 🔵 C++ (native/) — OpenXR session, Vulkan/GLES render loop, controller input
  • 🦀 Rust (rust/) — demux, decode, audio, network protocols
  • 🔧 Build / CI / scripts
  • 📚 Docs only

How has this been tested?

  • Unit tests (JVM / cargo test): ./gradlew testDebugUnitTest (incluindo EnvironmentLightingTest, FeatureFlagsTest, I18nParityTest) passou com 100% de sucesso. cargo test -p protocols -p media-logic (83 testes passaram).
  • Native/Vulkan build compiled without errors: Todos os 8 shaders SPIR-V (environment.vert/frag, video.vert/frag, stereo.vert/frag, stereo_cubemap.vert/frag) compilados via glslc.
  • Physically tested on a device (Quest 2 / Quest 3 / Quest 3s)

Checklist:

  • My code follows the project's style guidelines (ktlint, rustfmt, clippy -D warnings).
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added new tests that prove my fix is effective or that my feature works.
  • The CI/CD Actions (build-and-lint) are passing for this PR.

If applicable

  • Kotlin never calls Rust directly — the Kotlin → JNI → C++ → C ABI → Rust path is preserved (ADR-002).
  • I changed the screen/stereo mode enum and kept it in sync across all three places: SCREEN_MODE in rust/bridge/src/lib.rs, enum class ScreenMode in native/include/screen_mode.h, and the catalog in ScreenFormatCatalog.kt.
  • I added or changed user-facing strings and updated both values/strings.xml and values-pt-rBR/strings.xml, keeping the key order mirrored and using positional placeholders (%1$s).
  • Pure logic I added lives in media-logic (host-testable) rather than in core, where it could not be tested.
  • No credential is stored or logged in plain text.

…-ENV-007)

- Shaders Vulkan (SPIR-V):
  - environment.frag/vert: amostragem difusa da cor da tela (Screen Glow) com
    atenuacao quadratica por distancia e normal da malha 3D, e modulacao do
    brilho base da iluminacao e skybox.
  - video, stereo, stereo_cubemap: aproximacao de Planckian locus (Kelvin 2700K-6500K)
    e Modo Noturno (~3000K para reducao de luz azul) preservando limites de push
    constants (128 bytes no stereo).
- C++ / JNI:
  - vr_player_jni_vulkan.cpp: atomicos e metodos JNI para brilho, intensidade de glow,
    temperatura de cor e modo noturno.
  - vr_player_ambient.h: constantes kAmbientIntensityOff, kAmbientIntensitySubtle,
    kAmbientIntensityStrong.
  - vr_player_input_vulkan.h: suporte a downsample offscreen da tela nos ambientes 3D
    (cinema, living_room).
  - vr_player_app_vulkan.cpp: integracao do descriptor set de ambient nos draws de ambiente
    e passagem das push constants correspondentes.
- Kotlin / Android UI:
  - FeatureFlags.kt: persistencia de brilho, intensidade de glow, temperatura e
    Flag.NIGHT_MODE em SharedPreferences.
  - VRActivity.kt: exportacao JNI e sincronizacao de valores persistidos no onCreate.
  - SettingsScreen.kt: secao 'Iluminacao e Ambiente' com sliders de brilho (0%-100%),
    temperatura (2700K-6500K), selecao de chips de Screen Glow (Desligado/Sutil/Forte)
    e toggle de Modo Noturno.
  - strings.xml, values-pt-rBR, values-es: recursos localizados com placeholders posicionais.
- Testes & Docs:
  - EnvironmentLightingTest.kt e FeatureFlagsTest.kt: testes unitarios cobrindo clamping,
    mapeamentos e contratos de seguranca.
  - docs/phases/PHASE-0.5-PREMIUM.md: marcacao das tarefas T4.1-T4.5 e DoD de iluminacao como concluidos.
@BGLuis
BGLuis merged commit 4ba96b2 into develop Sep 25, 2026
2 checks passed
@BGLuis
BGLuis deleted the feature/environment-lighting-color branch September 25, 2026 19:50
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