Skip to content

Commit

Permalink
Add support for XR_VARJO_quad_views and XR_VARJO_foveated_rendering.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbucchia committed Apr 23, 2023
1 parent 9ce9197 commit 87bd49b
Show file tree
Hide file tree
Showing 14 changed files with 980 additions and 150 deletions.
381 changes: 348 additions & 33 deletions companion/ExperimentalSettings.Designer.cs

Large diffs are not rendered by default.

136 changes: 135 additions & 1 deletion companion/ExperimentalSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ private void LoadSettings()
alwaysUseFrameIdZero.Checked = (int)key.GetValue("quirk_always_use_frame_id_zero", 0) == 1 ? true : false;
forceDisableParallelProjection.Checked = (int)key.GetValue("force_parallel_projection_state", 1) == 0 ? true : false;
droolonProjectionDistance.Value = (int)key.GetValue("droolon_projection_distance", 35);
enableQuadViews.Checked = (int)key.GetValue("disable_quad_views", 1) == 0 ? true : false;
focusDensity.Value = (int)key.GetValue("focus_density", 1000);
peripheralDensity.Value = (int)key.GetValue("peripheral_density", 500);
horizontalSection1.Value = (int)key.GetValue("focus_horizontal_section", 750);
horizontalSection2.Value = (int)key.GetValue("focus_horizontal_section_foveated", 500);
verticalSection1.Value = (int)key.GetValue("focus_vertical_section", 700);
verticalSection2.Value = (int)key.GetValue("focus_vertical_section_foveated", 500);
preferFoveated.Checked = (int)key.GetValue("prefer_foveated_rendering", 1) == 1 ? true : false;

// DO NOT FORGET TO ADD TO restoreDefaults_Click()!
}
Expand All @@ -104,9 +112,14 @@ private void LoadSettings()
filterLength_Scroll(null, null);
timingBias_Scroll(null, null);
droolonProjectionDistance_Scroll(null, null);
focusDensity_Scroll(null, null);
peripheralDensity_Scroll(null, null);
horizontalSection1_Scroll(null, null);
horizontalSection2_Scroll(null, null);
verticalSection1_Scroll(null, null);
verticalSection2_Scroll(null, null);

ResumeLayout();

loading = false;
}

Expand All @@ -115,6 +128,13 @@ private void RefreshEnabledState()
forceRateLabel.Enabled = forceHalf.Enabled = forceThird.Enabled = enableFrameTiming.Checked;
filterLength.Enabled = filterLengthLabel.Enabled = filterLengthValue.Enabled =
timingBias.Enabled = timingBiasLabel.Enabled = timingBiasValue.Enabled = enableFrameTiming.Checked && !(forceHalf.Checked || forceThird.Checked);
focusDensity.Enabled = focusDensityLabel.Enabled = focusDensityValue.Enabled =
peripheralDensity.Enabled = peripheralDensityLabel.Enabled = peripheralDensityValue.Enabled =
horizontalSection1.Enabled = horizontalSection1Label.Enabled = horizontalSection1Value.Enabled =
horizontalSection2.Enabled = horizontalSection2Label.Enabled = horizontalSection2Value.Enabled =
verticalSection1.Enabled = verticalSection1Label.Enabled = verticalSection1Value.Enabled =
verticalSection2.Enabled = verticalSection2Label.Enabled = verticalSection2Value.Enabled =
preferFoveated.Enabled = enableQuadViews.Checked;
}

private void enableFrameTiming_CheckedChanged(object sender, EventArgs e)
Expand Down Expand Up @@ -264,6 +284,112 @@ private void droolonProjectionDistance_Scroll(object sender, EventArgs e)
MainForm.WriteSetting("droolon_projection_distance", droolonProjectionDistance.Value);
}

private void enableQuadViews_CheckedChanged(object sender, EventArgs e)
{
RefreshEnabledState();

if (loading)
{
return;
}

MainForm.WriteSetting("disable_quad_views", enableQuadViews.Checked ? 0 : 1);
}

private void focusDensity_Scroll(object sender, EventArgs e)
{
// Use the input in tenth of percent to allow one decimal.
focusDensityValue.Text = (focusDensity.Value / 10.0f).ToString("#.#");

if (loading)
{
return;
}

// Store in tenth of percent.
MainForm.WriteSetting("focus_density", focusDensity.Value);
}

private void peripheralDensity_Scroll(object sender, EventArgs e)
{
// Use the input in tenth of percent to allow one decimal.
peripheralDensityValue.Text = (peripheralDensity.Value / 10.0f).ToString("#.#");

if (loading)
{
return;
}

// Store in tenth of percent.
MainForm.WriteSetting("peripheral_density", peripheralDensity.Value);
}

private void horizontalSection1_Scroll(object sender, EventArgs e)
{
// Use the input in tenth of percent to allow one decimal.
horizontalSection1Value.Text = (horizontalSection1.Value / 10.0f).ToString("#.#");

if (loading)
{
return;
}

// Store in tenth of percent.
MainForm.WriteSetting("focus_horizontal_section", horizontalSection1.Value);
}

private void horizontalSection2_Scroll(object sender, EventArgs e)
{
// Use the input in tenth of percent to allow one decimal.
horizontalSection2Value.Text = (horizontalSection2.Value / 10.0f).ToString("#.#");

if (loading)
{
return;
}

// Store in tenth of percent.
MainForm.WriteSetting("focus_horizontal_section_foveated", horizontalSection2.Value);
}

private void verticalSection1_Scroll(object sender, EventArgs e)
{
// Use the input in tenth of percent to allow one decimal.
verticalSection1Value.Text = (verticalSection1.Value / 10.0f).ToString("#.#");

if (loading)
{
return;
}

// Store in tenth of percent.
MainForm.WriteSetting("focus_vertical_section", verticalSection1.Value);
}

private void verticalSection2_Scroll(object sender, EventArgs e)
{
// Use the input in tenth of percent to allow one decimal.
verticalSection2Value.Text = (verticalSection2.Value / 10.0f).ToString("#.#");

if (loading)
{
return;
}

// Store in tenth of percent.
MainForm.WriteSetting("focus_vertical_section_foveated", verticalSection2.Value);
}

private void preferFoveated_CheckedChanged(object sender, EventArgs e)
{
if (loading)
{
return;
}

MainForm.WriteSetting("prefer_foveated_rendering", preferFoveated.Checked ? 1 : 0);
}

private void restoreDefaults_Click(object sender, EventArgs e)
{
Microsoft.Win32.RegistryKey key = null;
Expand All @@ -280,6 +406,14 @@ private void restoreDefaults_Click(object sender, EventArgs e)
key.DeleteValue("quirk_always_use_frame_id_zero", false);
key.DeleteValue("force_parallel_projection_state", false);
key.DeleteValue("droolon_projection_distance", false);
key.DeleteValue("disable_quad_views", false);
key.DeleteValue("focus_density", false);
key.DeleteValue("peripheral_density", false);
key.DeleteValue("focus_horizontal_section", false);
key.DeleteValue("focus_horizontal_section_foveated", false);
key.DeleteValue("focus_vertical_section", false);
key.DeleteValue("focus_vertical_section_foveated", false);
key.DeleteValue("prefer_foveated_rendering", false);
}
catch (Exception)
{
Expand Down
Loading

0 comments on commit 87bd49b

Please sign in to comment.