Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions TheForceEngine/TFE_FrontEndUI/frontEndUi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,20 @@ namespace TFE_FrontEndUI
"True Color", // COLORMODE_TRUE_COLOR
};

static const char* c_supersampling[] =
{
"Off",
"2x",
"4x",
};

static const s32 c_supersamplingFactor[] =
{
1,
2,
4,
};

typedef void(*MenuItemSelected)();

static s32 s_resIndex = 0;
Expand Down Expand Up @@ -3190,6 +3204,23 @@ namespace TFE_FrontEndUI
ImGui::InputInt("##FOVText", &graphics->fov, 1, 20, ImGuiInputTextFlags_CharsDecimal);
graphics->fov = clamp(graphics->fov, 5, 175);

s32 supersamplingIndex = 0;
if (graphics->supersampling == 2)
{
supersamplingIndex = 1;
}
else if (graphics->supersampling == 4)
{
supersamplingIndex = 2;
}

ImGui::LabelText("##ConfigLabel", "Supersampling"); ImGui::SameLine(comboOffset);
ImGui::SetNextItemWidth(196 * s_uiScale);
if (ImGui::Combo("##Supersampling", &supersamplingIndex, c_supersampling, IM_ARRAYSIZE(c_supersampling)))
{
graphics->supersampling = c_supersamplingFactor[supersamplingIndex];
}

// Sky rendering mode.
s32 skyMode = graphics->skyMode;
ImGui::LabelText("##ConfigLabel", "Sky Render Mode"); ImGui::SameLine(comboOffset);
Expand Down Expand Up @@ -4056,6 +4087,7 @@ namespace TFE_FrontEndUI
graphicsSettings->widescreen = true;
graphicsSettings->gameResolution.x = displayInfo.width;
graphicsSettings->gameResolution.z = displayInfo.height;
graphicsSettings->supersampling = 1;
// Color mode and texture filtering are the main differences between modes.
graphicsSettings->colorMode = (temp == TEMPLATE_MODERN) ? COLORMODE_TRUE_COLOR : COLORMODE_8BIT_INTERP;
// Texture filtering.
Expand Down Expand Up @@ -4106,6 +4138,7 @@ namespace TFE_FrontEndUI
graphicsSettings->widescreen = false;
graphicsSettings->gameResolution.x = 320;
graphicsSettings->gameResolution.z = 200;
graphicsSettings->supersampling = 1;
graphicsSettings->colorMode = COLORMODE_8BIT;
// Reticle.
graphicsSettings->reticleEnable = false;
Expand Down
7 changes: 4 additions & 3 deletions TheForceEngine/TFE_Jedi/Renderer/RClassic_GPU/rsectorGPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1886,6 +1886,7 @@ namespace TFE_Jedi
{
u32 dispWidth, dispHeight;
vfb_getResolution(&dispWidth, &dispHeight);
const f32 ssFactor = f32(TFE_RenderBackend::getVirtualDisplaySupersampleFactor());

// Compute the camera yaw from the camera direction and rotate it 90 degrees.
// This generates a value from 0 to 1.
Expand All @@ -1901,12 +1902,12 @@ namespace TFE_Jedi
cameraYaw * parallax[0],
clamp(cameraPitch, -rad45, rad45) * parallax[1] * oneOverTwoPi,
parallax[0] * oneOverTwoPi,
200.0f / f32(dispHeight),
200.0f / (f32(dispHeight) * ssFactor),
};
const f32 skyParam1[2] =
{
-s_rcfltState.nearPlaneHalfLen,
s_rcfltState.nearPlaneHalfLen * 2.0f / f32(dispWidth),
s_rcfltState.nearPlaneHalfLen * 2.0f / (f32(dispWidth) * ssFactor),
};
shader->setVariable(skyInputs->skyParam0Id, SVT_VEC4, skyParam0);
shader->setVariable(skyInputs->skyParam1Id, SVT_VEC2, skyParam1);
Expand Down Expand Up @@ -2238,4 +2239,4 @@ namespace TFE_Jedi
assert(success);
return success;
}
}
}
7 changes: 5 additions & 2 deletions TheForceEngine/TFE_Jedi/Renderer/virtualFramebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace TFE_Jedi
static u32 s_prevWidth = 0;
static u32 s_prevHeight = 0;
static s32 s_widescreenOffset = 0;
static s32 s_supersampling = 1;
static bool s_widescreen = false;

static u32 s_palette[256];
Expand All @@ -39,11 +40,13 @@ namespace TFE_Jedi
JBool vfb_setResolution(u32 width, u32 height)
{
TFE_Settings_Graphics* graphics = TFE_Settings::getGraphicsSettings();
if (width == s_width && height == s_height && s_widescreen == graphics->widescreen && s_mode == s_nextMode)
const s32 supersampling = s_nextMode == VFB_RENDER_TRAGET ? graphics->supersampling : 1;
if (width == s_width && height == s_height && s_widescreen == graphics->widescreen && s_supersampling == supersampling && s_mode == s_nextMode)
{
return JFALSE;
}
s_widescreen = graphics->widescreen;
s_supersampling = supersampling;
s_mode = s_nextMode;

if (width == 320 && height == 200)
Expand Down Expand Up @@ -273,4 +276,4 @@ namespace TFE_Jedi
};
TFE_RenderBackend::createVirtualDisplay(vdisp);
}
} // namespace TFE_Jedi
} // namespace TFE_Jedi
Loading