diff --git a/Sources/arm/Config.hx b/Sources/arm/Config.hx index 0ef497f3..6a874d7a 100644 --- a/Sources/arm/Config.hx +++ b/Sources/arm/Config.hx @@ -72,7 +72,6 @@ class Config { #if arm_painter if (raw.undo_steps == null) raw.undo_steps = 4; // Max steps to keep - if (raw.rp_culling == null) raw.rp_culling = true; if (raw.keymap == null) { raw.keymap = {}; raw.keymap.action_paint = "left"; @@ -229,5 +228,4 @@ typedef TConfig = { @:optional var plugins:Array; @:optional var undo_steps:Null; @:optional var keymap:Dynamic; // Map - @:optional var rp_culling:Null; } diff --git a/Sources/arm/node/MaterialBuilder.hx b/Sources/arm/node/MaterialBuilder.hx index 2394b74c..5939eb54 100644 --- a/Sources/arm/node/MaterialBuilder.hx +++ b/Sources/arm/node/MaterialBuilder.hx @@ -828,7 +828,7 @@ class MaterialBuilder { name: context_id, depth_write: true, compare_mode: 'less', - cull_mode: (Config.raw.rp_culling || !isScene) ? 'clockwise' : 'none', + cull_mode: (UITrait.inst.cullBackfaces || !isScene) ? 'clockwise' : 'none', vertex_elements: [{name: "pos", data: 'short4norm'},{name: "nor", data: 'short2norm'},{name: "tex", data: 'short2norm'}] }); var vert = con_mesh.make_vert(); @@ -1006,7 +1006,7 @@ class MaterialBuilder { name: context_id, depth_write: true, compare_mode: 'less', - cull_mode: Config.raw.rp_culling ? 'clockwise' : 'none', + cull_mode: UITrait.inst.cullBackfaces ? 'clockwise' : 'none', vertex_elements: [{name: "pos", data: 'short4norm'},{name: "nor", data: 'short2norm'},{name: "tex", data: 'short2norm'}] }); var vert = con_mesh.make_vert(); diff --git a/Sources/arm/ui/BoxPreferences.hx b/Sources/arm/ui/BoxPreferences.hx index 7ad2019a..967079e1 100644 --- a/Sources/arm/ui/BoxPreferences.hx +++ b/Sources/arm/ui/BoxPreferences.hx @@ -147,18 +147,7 @@ class BoxPreferences { var vsyncHandle = Id.handle({selected: Config.raw.window_vsync}); Config.raw.window_vsync = ui.check(vsyncHandle, "VSync"); if (vsyncHandle.changed) Config.save(); - var cullHandle = Id.handle({selected: Config.raw.rp_culling}); - Config.raw.rp_culling = ui.check(cullHandle, "Cull Backfaces"); - if (cullHandle.changed) { - Config.save(); - MaterialParser.parseMeshMaterial(); - } - var filterHandle = Id.handle({selected: UITrait.inst.textureFilter}); - UITrait.inst.textureFilter = ui.check(filterHandle, "Filter Textures"); - if (filterHandle.changed) { - MaterialParser.parsePaintMaterial(); - MaterialParser.parseMeshMaterial(); - } + #if (!kha_direct3d12) ui.check(UITrait.inst.hvxao, "Voxel AO"); if (ui.isHovered) ui.tooltip("Cone-traced AO and shadows"); diff --git a/Sources/arm/ui/UIMenu.hx b/Sources/arm/ui/UIMenu.hx index de13731e..6d8f5977 100644 --- a/Sources/arm/ui/UIMenu.hx +++ b/Sources/arm/ui/UIMenu.hx @@ -50,7 +50,7 @@ class UIMenu { menuCommands(ui); } else { - var menuItems = [12, 3, 13, 17, 5]; + var menuItems = [12, 3, 15, 17, 5]; if (viewportColorHandle.selected) menuItems[2] += 6; #if (!kha_direct3d12) menuItems[2] += 2; #end var sepw = menuW / ui.SCALE(); @@ -152,6 +152,19 @@ class UIMenu { MaterialParser.parseMeshMaterial(); } + var cullHandle = Id.handle({selected: UITrait.inst.cullBackfaces}); + UITrait.inst.cullBackfaces = ui.check(cullHandle, "Cull Backfaces"); + if (cullHandle.changed) { + MaterialParser.parseMeshMaterial(); + } + + var filterHandle = Id.handle({selected: UITrait.inst.textureFilter}); + UITrait.inst.textureFilter = ui.check(filterHandle, "Filter Textures"); + if (filterHandle.changed) { + MaterialParser.parsePaintMaterial(); + MaterialParser.parseMeshMaterial(); + } + UITrait.inst.drawWireframe = ui.check(UITrait.inst.wireframeHandle, "Wireframe"); if (UITrait.inst.wireframeHandle.changed) { ui.g.end(); diff --git a/Sources/arm/ui/UITrait.hx b/Sources/arm/ui/UITrait.hx index abf38e6a..d4d9582e 100644 --- a/Sources/arm/ui/UITrait.hx +++ b/Sources/arm/ui/UITrait.hx @@ -90,6 +90,7 @@ class UITrait { public var wireframeHandle = new Handle({selected: false}); public var drawTexels = false; public var texelsHandle = new Handle({selected: false}); + public var cullBackfaces = true; public var textureFilter = true; public var ui:Zui;