Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support switching retro mode render target at runtime #7

Merged
merged 1 commit into from Nov 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 15 additions & 5 deletions EnhancedSky/Scripts/SkyCam.cs
Expand Up @@ -22,6 +22,8 @@ public class SkyCam : MonoBehaviour
public GameObject mainCamera;
public Camera skyCamera;

int lastRetroMode = -1;

// Use this for initialization
void Start()
{
Expand All @@ -35,6 +37,19 @@ void Start()

}

private void Update()
{
if (DaggerfallUnity.Settings.RetroRenderingMode != lastRetroMode)
{
if (skyCamera && DaggerfallUnity.Settings.RetroRenderingMode != 0)
skyCamera.targetTexture = DaggerfallWorkshop.Game.GameManager.Instance.RetroRenderer.RetroTexture;
else
skyCamera.targetTexture = null;

lastRetroMode = DaggerfallUnity.Settings.RetroRenderingMode;
}
}

void LateUpdate()
{
this.transform.rotation = mainCamera.transform.rotation;
Expand All @@ -56,12 +71,7 @@ void GetCameraSettings()
skyCamera.renderingPath = RenderingPath.DeferredShading;

}


if (DaggerfallUnity.Settings.RetroRenderingMode > 0)
{
skyCamera.targetTexture = DaggerfallWorkshop.Game.GameManager.Instance.RetroRenderer.RetroTexture;
}

}

Expand Down