From 2bc58537201a1852b3853294185b36cf87ed8302 Mon Sep 17 00:00:00 2001 From: james webb Date: Wed, 6 Mar 2024 12:21:21 +0000 Subject: [PATCH] implementation --- src/dxvk/imgui/dxvk_imgui.cpp | 1 + src/dxvk/rtx_render/rtx_options.h | 2 ++ src/dxvk/rtx_render/rtx_scene_manager.cpp | 4 +++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dxvk/imgui/dxvk_imgui.cpp b/src/dxvk/imgui/dxvk_imgui.cpp index 3bb196e10..a32688517 100644 --- a/src/dxvk/imgui/dxvk_imgui.cpp +++ b/src/dxvk/imgui/dxvk_imgui.cpp @@ -2087,6 +2087,7 @@ namespace dxvk { spacing(); ImGui::DragFloat("Scene Unit Scale", &RtxOptions::Get()->sceneScaleObject(), 0.00001f, 0.00001f, FLT_MAX, "%.3f", sliderFlags); ImGui::Checkbox("Scene Z-Up", &RtxOptions::Get()->zUpObject()); + ImGui::Checkbox("Scene Left-Handed Coordinate System", &RtxOptions::Get()->leftHandedCoordinateSystemObject()); fusedWorldViewModeCombo.getKey(&RtxOptions::Get()->fusedWorldViewModeRef()); ImGui::Separator(); diff --git a/src/dxvk/rtx_render/rtx_options.h b/src/dxvk/rtx_render/rtx_options.h index 139b1a272..a70da70ce 100644 --- a/src/dxvk/rtx_render/rtx_options.h +++ b/src/dxvk/rtx_render/rtx_options.h @@ -357,6 +357,7 @@ namespace dxvk { RTX_OPTION("rtx", bool, enableDirectLighting, true, "Enables direct lighting (lighting directly from lights on to a surface) on surfaces when set to true, otherwise disables it."); RTX_OPTION("rtx", bool, enableSecondaryBounces, true, "Enables indirect lighting (lighting from diffuse/specular bounces to one or more other surfaces) on surfaces when set to true, otherwise disables it."); RTX_OPTION("rtx", bool, zUp, false, "Indicates that the Z axis is the \"upward\" axis in the world when true, otherwise the Y axis when false."); + RTX_OPTION("rtx", bool, leftHandedCoordinateSystem, false, "Indicates that the world space coordinate system is left-handed when true, otherwise right-handed when false."); RTX_OPTION("rtx", float, uniqueObjectDistance, 300.f, "The distance (in game units) that an object can move in a single frame before it is no longer considered the same object.\n" "If this is too low, fast moving objects may flicker and have bad lighting. If it's too high, repeated objects may flicker.\n" "This does not account for sceneScale."); @@ -1213,6 +1214,7 @@ namespace dxvk { bool shouldCaptureDebugImage() const { return captureDebugImage(); } bool isLiveShaderEditModeEnabled() const { return useLiveShaderEditMode(); } bool isZUp() const { return zUp(); } + bool isLeftHandedCoordinateSystem() const { return leftHandedCoordinateSystem(); } float getUniqueObjectDistanceSqr() const { return uniqueObjectDistance() * uniqueObjectDistance(); } float getResolutionScale() const { return resolutionScale(); } DLSSProfile getDLSSQuality() const { return qualityDLSS(); } diff --git a/src/dxvk/rtx_render/rtx_scene_manager.cpp b/src/dxvk/rtx_render/rtx_scene_manager.cpp index d7281f23e..3be385558 100644 --- a/src/dxvk/rtx_render/rtx_scene_manager.cpp +++ b/src/dxvk/rtx_render/rtx_scene_manager.cpp @@ -131,7 +131,9 @@ namespace dxvk { } Vector3 SceneManager::calculateSceneRight() { - return cross(getSceneForward(), getSceneUp()); + const Vector3 up = SceneManager::getSceneUp(); + const Vector3 forward = SceneManager::getSceneForward(); + return RtxOptions::Get()->isLeftHandedCoordinateSystem() ? cross(up, forward) : cross(forward, up); } Vector3 SceneManager::worldToSceneOrientedVector(const Vector3& worldVector) {