Skip to content

Commit

Permalink
[MainGameVR] Use Background Color from H-scene settings (#35)
Browse files Browse the repository at this point in the history
Only affects H scenes. Main idea are chroma keying for passthrough. And since game have option for solid bg why not use it.
  • Loading branch information
ovROG authored Nov 15, 2023
1 parent 893df41 commit d4e9761
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions MainGameVR/Interpreters/HSceneInterpreter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ internal class HSceneInterpreter : SceneInterpreter
private HSceneProc _proc;
private Caress.VRMouth _vrMouth;

private Color _currentBackgroundColor;
private bool _currentShowMap;

public override void OnStart()
{
_currentBackgroundColor = Manager.Config.HData.BackColor;
_currentShowMap = Manager.Config.HData.Map;
UpdateCameraState();
}

public override void OnDisable()
Expand All @@ -20,6 +26,11 @@ public override void OnDisable()

public override void OnUpdate()
{
if (_currentShowMap != Manager.Config.HData.Map || _currentBackgroundColor != Manager.Config.HData.BackColor)
{
UpdateCameraState();
}

if (_active && (!_proc || !_proc.enabled))
{
// The HProc scene is over, but there may be one more coming.
Expand All @@ -41,11 +52,27 @@ private void Deactivate()
{
if (_active)
{
VR.Camera.SteamCam.camera.clearFlags = CameraClearFlags.Skybox;
Object.Destroy(_vrMouth);
DestroyControllerComponent<Caress.CaressController>();
_proc = null;
_active = false;
}
}

private void UpdateCameraState()
{
if (!Manager.Config.HData.Map)
{
VR.Camera.SteamCam.camera.backgroundColor = Manager.Config.HData.BackColor;
VR.Camera.SteamCam.camera.clearFlags = CameraClearFlags.SolidColor;
}
else
{
VR.Camera.SteamCam.camera.clearFlags = CameraClearFlags.Skybox;
}
_currentBackgroundColor = Manager.Config.HData.BackColor;
_currentShowMap = Manager.Config.HData.Map;
}
}
}

0 comments on commit d4e9761

Please sign in to comment.