File size: 4,431 Bytes
b6a38d7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
DefineClass.DevDSForceModeDlg = {
__parents = { "XDialog" },
}
if FirstLoad then
DebugForceModeIdx = {
gbuffers = 0,
stencil = 0,
misc = 0,
lights = 0,
}
end
local DebugForceModeList = {
["gbuffers"] = { "NORMAL", "GEOMETRY_NORMAL", "BASECOLOR", "COLORMAP", "ROUGHNESS", "METALLIC", "AO", "SI", "TANGENT", "ENCODED_NORMAL", "DEPTH", "NONE"},
["stencil"] = { "STENCIL", "NONE" },
["misc"] = { "BRDF", "ENV_IRRAD","ENV_DIFFUSE", "SUN_DIFFUSE", "DIFFUSE",
"ENV_SPECULAR","SUN_SPECULAR", "SPECULAR", "SUN_SHADOW",
"TRANSLUCENCY", "REFLECTION", "REFLECTION_ITERATIONS", "PRECISE_SELECTION_IDS", "NONE"},
["lights"] = { "LIGHTS", "LIGHTS_DIFFUSE", "LIGHTS_SPECULAR", "LIGHTS_SHADOW",
"LIGHTS_COUNT", "LIGHTS_ATTENUATION", "LIGHTS_CLUSTER", "NONE"}
}
local DebugForceModeRemap = {
["COLORMAP"] = "BASECOLOR",
["TANGENT"] = "NORMAL",
}
local DebugForceModeHROptions =
{
["STENCIL"] = { ShowStencil = 2, ShowRT = "show_rt_buffer", ShowRTEnable = 1, },
["COLORMAP"] = { ForceColorizationRGB = 1, DisableBaseColorMaps = 1, RenderClutter = 0, },
["TANGENT"] = { UseTangentNormalMap = 1 },
["REFLECTION"] = { EnableScreenSpaceReflections = 1, RenderClutter = 0, SSRDebug = 1 },
["REFLECTION_ITERATIONS"] = { EnableScreenSpaceReflections = 1, RenderClutter = 0, SSRDebug = 2 },
["PRECISE_SELECTION_IDS"] = { ShowPreciseSelectionIDs = 1, RenderTransparent = 1 },
}
function DevDSForceModeDlg:Init()
XText:new({
Id = "idText",
Margins = box(100, 80, 0, 0),
TextStyle= "GizmoText",
HandleMouse = false,
}, self)
self.idText:SetText(self.context.text or "")
end
function DevDSForceModeDlg:Done()
table.restore(hr, "ForceModeSpecific")
table.restore(hr, "ForceMode")
RecreateRenderObjects()
end
function OpenDevDSForceModeDlg(mode)
CloseDialog("DevDSForceModeDlg")
table.change(hr, "ForceMode", {
EnablePostprocess = 0,
EnableScreenSpaceReflections = 0,
EnableSubsurfaceScattering = 0,
RenderTransparent = 0,
RenderParticles = 0,
ShowStencil = 0,
ShowRT = "",
ShowRTEnable = 0,
DeferMode = DeferModes[DebugForceModeRemap[mode] or mode],
})
table.change(hr, "ForceModeSpecific", DebugForceModeHROptions[mode] or {})
RecreateRenderObjects()
OpenDialog("DevDSForceModeDlg", terminal.desktop, { text = mode })
end
function ToggleDebugForceMode(debug_type)
if not debug_type then
CloseDialog("DevDSForceModeDlg")
return
end
local modes = DebugForceModeList[debug_type]
local index = (DebugForceModeIdx[debug_type] % #modes) + (GetDialog("DevDSForceModeDlg") and 1 or 0)
DebugForceModeIdx[debug_type] = index
if index ~= #modes then
OpenDevDSForceModeDlg(modes[index])
else
CloseDialog("DevDSForceModeDlg")
end
PP_Rebuild()
RecreateRenderObjects()
end
if FirstLoad then
g_PostProcDebugMode = "Off"
end
local PostProcDebugModesIdxs = {
HsvDebug = 0,
}
local PostProcDebugModes = {
HsvDebug = { names = { "Hue", "Saturation", "Lightness", "Lighness_WO_Shadows", "Off" },
hr_vars = { {}, {}, {}, { Shadowmap = 0, EnableScreenSpaceAmbientObscurance = 0 }, {} },
debug_passes = { "debug_hue", "debug_saturation", "debug_lightness", "debug_lightness", "Off" },
}
}
DefineClass.PostProcDebugFeatureDlg = {
__parents = { "XDialog" },
}
function PostProcDebugFeatureDlg:Init()
XText:new({
Id = "idText",
Margins = box(20, 90, 0, 0),
TextStyle= "EditorText",
HandleMouse = false,
}, self)
self.idText:SetText(self.context.text or "")
end
function PostProcDebugFeatureDlg:Done()
table.restore(hr, "PostProcForceMode")
end
function OpenPostProcDebugFeatureDlg(mode, idx)
CloseDialog("PostProcDebugFeatureDlg")
local hr_options = {}
for op, value in pairs(PostProcDebugModes[mode].hr_vars[idx]) do
hr_options[op] = value
end
table.change(hr, "PostProcForceMode", hr_options)
OpenDialog("PostProcDebugFeatureDlg", terminal.desktop, { text = PostProcDebugModes[mode].names[idx] })
end
function ToggleHsvDebugForceMode(mode)
local num_modes = #PostProcDebugModes[mode].debug_passes
local idx = (PostProcDebugModesIdxs[mode] % num_modes) + 1
PostProcDebugModesIdxs[mode] = idx
if idx ~= num_modes then
OpenPostProcDebugFeatureDlg(mode, idx)
else
CloseDialog("PostProcDebugFeatureDlg")
end
g_PostProcDebugMode = PostProcDebugModes[mode].debug_passes[idx]
PP_Rebuild()
end |