Move cull and texture filter option to viewport menu

This commit is contained in:
luboslenco
2019-11-17 14:24:44 +01:00
parent 7c7b6388b5
commit e38fcfc97e
5 changed files with 18 additions and 17 deletions
-2
View File
@@ -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<String>;
@:optional var undo_steps:Null<Int>;
@:optional var keymap:Dynamic; // Map<String, String>
@:optional var rp_culling:Null<Bool>;
}
+2 -2
View File
@@ -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();
+1 -12
View File
@@ -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");
+14 -1
View File
@@ -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();
+1
View File
@@ -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;