Shader fixes
This commit is contained in:
+3
-3
@@ -355,12 +355,12 @@ class App extends iron.Trait {
|
|||||||
var isPicker = UITrait.inst.selectedTool == ToolPicker;
|
var isPicker = UITrait.inst.selectedTool == ToolPicker;
|
||||||
Zui.alwaysRedrawWindow =
|
Zui.alwaysRedrawWindow =
|
||||||
showMenu ||
|
showMenu ||
|
||||||
isDragging ||
|
|
||||||
(!UITrait.inst.brush3d) ||
|
|
||||||
showBox ||
|
showBox ||
|
||||||
|
isDragging ||
|
||||||
isPicker ||
|
isPicker ||
|
||||||
UIView2D.inst.show ||
|
|
||||||
decal ||
|
decal ||
|
||||||
|
UIView2D.inst.show ||
|
||||||
|
!UITrait.inst.brush3d ||
|
||||||
UITrait.inst.frame < 3;
|
UITrait.inst.frame < 3;
|
||||||
if (Zui.alwaysRedrawWindow && UITrait.inst.ddirty < 0) UITrait.inst.ddirty = 0;
|
if (Zui.alwaysRedrawWindow && UITrait.inst.ddirty < 0) UITrait.inst.ddirty = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,7 +186,8 @@ class RenderPathDeferred {
|
|||||||
lastY = mouse.y;
|
lastY = mouse.y;
|
||||||
|
|
||||||
if (!UITrait.inst.dirty()) {
|
if (!UITrait.inst.dirty()) {
|
||||||
if (mx != lastX || my != lastY || UITrait.inst.ddirty > -2 || mouse.locked) {
|
if (mx != lastX || my != lastY || mouse.locked) UITrait.inst.ddirty = 0;
|
||||||
|
if (UITrait.inst.ddirty > -2) {
|
||||||
path.setTarget("");
|
path.setTarget("");
|
||||||
path.bindTarget(taaFrame % 2 == 0 ? "taa" : "taa2", "tex");
|
path.bindTarget(taaFrame % 2 == 0 ? "taa" : "taa2", "tex");
|
||||||
ssaa4 ?
|
ssaa4 ?
|
||||||
|
|||||||
@@ -211,12 +211,12 @@ class UIMenu {
|
|||||||
g.begin(false);
|
g.begin(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function show(commands:Zui->Void = null) {
|
public static function show(commands:Zui->Void = null, x = -1, y = -1) {
|
||||||
var uibox = App.uibox;
|
var uibox = App.uibox;
|
||||||
App.showMenu = true;
|
App.showMenu = true;
|
||||||
menuCommands = commands;
|
menuCommands = commands;
|
||||||
menuX = Std.int(iron.App.x() + iron.system.Input.getMouse().x);
|
menuX = x > -1 ? x : Std.int(iron.App.x() + iron.system.Input.getMouse().x);
|
||||||
menuY = Std.int(iron.App.y() + iron.system.Input.getMouse().y);
|
menuY = y > -1 ? y : Std.int(iron.App.y() + iron.system.Input.getMouse().y);
|
||||||
var menuw = uibox.ELEMENT_W() * 1.5;
|
var menuw = uibox.ELEMENT_W() * 1.5;
|
||||||
if (menuX + menuw > kha.System.windowWidth()) {
|
if (menuX + menuw > kha.System.windowWidth()) {
|
||||||
menuX = Std.int(kha.System.windowWidth() - menuw);
|
menuX = Std.int(kha.System.windowWidth() - menuw);
|
||||||
|
|||||||
+64
-55
@@ -238,61 +238,7 @@ class UINodes extends iron.Trait {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Node search popup
|
// Node search popup
|
||||||
if (keyboard.started("space")) {
|
if (keyboard.started("space")) nodeSearch();
|
||||||
var searchHandle = Id.handle();
|
|
||||||
var first = true;
|
|
||||||
UIMenu.show(function(ui:Zui) {
|
|
||||||
ui.fill(0, 0, ui._w / ui.SCALE, ui.t.ELEMENT_H * 8, ui.t.WINDOW_BG_COL);
|
|
||||||
ui.textInput(searchHandle, "");
|
|
||||||
ui.changed = false;
|
|
||||||
if (first) {
|
|
||||||
first = false;
|
|
||||||
ui.startTextEdit(searchHandle); // Focus search bar
|
|
||||||
ui.textSelectedCurrentText = searchHandle.text;
|
|
||||||
searchHandle.text = "";
|
|
||||||
nodeSearchLast = "";
|
|
||||||
|
|
||||||
}
|
|
||||||
var search = ui.textSelectedCurrentText.toLowerCase();
|
|
||||||
if (searchHandle.text != "") search = searchHandle.text;
|
|
||||||
if (search != nodeSearchLast) {
|
|
||||||
nodeSearchOffset = 0;
|
|
||||||
nodeSearchLast = search;
|
|
||||||
}
|
|
||||||
if (ui.isKeyDown) { // Move selection
|
|
||||||
if (ui.key == kha.input.KeyCode.Down && nodeSearchOffset < 6) nodeSearchOffset++;
|
|
||||||
if (ui.key == kha.input.KeyCode.Up && nodeSearchOffset > 0) nodeSearchOffset--;
|
|
||||||
}
|
|
||||||
var enter = keyboard.down("enter");
|
|
||||||
var count = 0;
|
|
||||||
var BUTTON_COL = ui.t.BUTTON_COL;
|
|
||||||
for (list in NodeCreator.list) {
|
|
||||||
for (n in list) {
|
|
||||||
if (n.name.toLowerCase().indexOf(search) >= 0) {
|
|
||||||
ui.t.BUTTON_COL = count == nodeSearchOffset ? ui.t.HIGHLIGHT_COL : ui.t.WINDOW_BG_COL;
|
|
||||||
if (ui.button(n.name, Left) || (enter && count == nodeSearchOffset)) {
|
|
||||||
nodeSearchSpawn = makeNode(n, nodes, canvas); // Spawn selected node
|
|
||||||
canvas.nodes.push(nodeSearchSpawn);
|
|
||||||
nodes.nodesSelected = [nodeSearchSpawn];
|
|
||||||
nodes.nodesDrag = true;
|
|
||||||
hwnd.redraws = 2;
|
|
||||||
if (enter) {
|
|
||||||
ui.changed = true;
|
|
||||||
count = 6; // Trigger break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (++count > 6) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (count > 6) break;
|
|
||||||
}
|
|
||||||
if (enter && count == 0) { // Hide popup on enter when node is not found
|
|
||||||
ui.changed = true;
|
|
||||||
searchHandle.text = "";
|
|
||||||
}
|
|
||||||
ui.t.BUTTON_COL = BUTTON_COL;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (nodeSearchSpawn != null) {
|
if (nodeSearchSpawn != null) {
|
||||||
ui.inputX = mouse.x + App.x(); // Fix inputDX after popup removal
|
ui.inputX = mouse.x + App.x(); // Fix inputDX after popup removal
|
||||||
ui.inputY = mouse.y + App.y();
|
ui.inputY = mouse.y + App.y();
|
||||||
@@ -300,6 +246,64 @@ class UINodes extends iron.Trait {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function nodeSearch(x = -1, y = -1) {
|
||||||
|
var keyboard = iron.system.Input.getKeyboard();
|
||||||
|
var searchHandle = Id.handle();
|
||||||
|
var first = true;
|
||||||
|
UIMenu.show(function(ui:Zui) {
|
||||||
|
ui.fill(0, 0, ui._w / ui.SCALE, ui.t.ELEMENT_H * 8, ui.t.WINDOW_BG_COL);
|
||||||
|
ui.textInput(searchHandle, "");
|
||||||
|
ui.changed = false;
|
||||||
|
if (first) {
|
||||||
|
first = false;
|
||||||
|
ui.startTextEdit(searchHandle); // Focus search bar
|
||||||
|
ui.textSelectedCurrentText = searchHandle.text;
|
||||||
|
searchHandle.text = "";
|
||||||
|
nodeSearchLast = "";
|
||||||
|
}
|
||||||
|
var search = ui.textSelectedCurrentText.toLowerCase();
|
||||||
|
if (searchHandle.text != "") search = searchHandle.text;
|
||||||
|
if (search != nodeSearchLast) {
|
||||||
|
nodeSearchOffset = 0;
|
||||||
|
nodeSearchLast = search;
|
||||||
|
}
|
||||||
|
if (ui.isKeyDown) { // Move selection
|
||||||
|
if (ui.key == kha.input.KeyCode.Down && nodeSearchOffset < 6) nodeSearchOffset++;
|
||||||
|
if (ui.key == kha.input.KeyCode.Up && nodeSearchOffset > 0) nodeSearchOffset--;
|
||||||
|
}
|
||||||
|
var enter = keyboard.down("enter");
|
||||||
|
var count = 0;
|
||||||
|
var BUTTON_COL = ui.t.BUTTON_COL;
|
||||||
|
var nodeList = canvasType == 0 ? NodeCreator.list : NodeCreatorBrush.list;
|
||||||
|
for (list in nodeList) {
|
||||||
|
for (n in list) {
|
||||||
|
if (n.name.toLowerCase().indexOf(search) >= 0) {
|
||||||
|
ui.t.BUTTON_COL = count == nodeSearchOffset ? ui.t.HIGHLIGHT_COL : ui.t.WINDOW_BG_COL;
|
||||||
|
if (ui.button(n.name, Left) || (enter && count == nodeSearchOffset)) {
|
||||||
|
var canvas = getCanvas();
|
||||||
|
nodeSearchSpawn = makeNode(n, nodes, canvas); // Spawn selected node
|
||||||
|
canvas.nodes.push(nodeSearchSpawn);
|
||||||
|
nodes.nodesSelected = [nodeSearchSpawn];
|
||||||
|
nodes.nodesDrag = true;
|
||||||
|
hwnd.redraws = 2;
|
||||||
|
if (enter) {
|
||||||
|
ui.changed = true;
|
||||||
|
count = 6; // Trigger break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (++count > 6) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count > 6) break;
|
||||||
|
}
|
||||||
|
if (enter && count == 0) { // Hide popup on enter when node is not found
|
||||||
|
ui.changed = true;
|
||||||
|
searchHandle.text = "";
|
||||||
|
}
|
||||||
|
ui.t.BUTTON_COL = BUTTON_COL;
|
||||||
|
}, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
public function getNodeX():Int {
|
public function getNodeX():Int {
|
||||||
var mouse = iron.system.Input.getMouse();
|
var mouse = iron.system.Input.getMouse();
|
||||||
return Std.int((mouse.x + App.x() - wx - nodes.PAN_X()) / nodes.SCALE);
|
return Std.int((mouse.x + App.x() - wx - nodes.PAN_X()) / nodes.SCALE);
|
||||||
@@ -434,6 +438,11 @@ class UINodes extends iron.Trait {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui._x += ew + 3;
|
||||||
|
ui._y = 3;
|
||||||
|
if (ui.button("Search")) nodeSearch(Std.int(ui._windowX + ui._x), Std.int(ui._windowY + ui._y));
|
||||||
|
if (ui.isHovered) ui.tooltip("(Space)");
|
||||||
|
|
||||||
ui.t.BUTTON_COL = BUTTON_COL;
|
ui.t.BUTTON_COL = BUTTON_COL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2485,7 +2485,7 @@ class UITrait extends iron.Trait {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function tabProperties() {
|
function tabProperties() {
|
||||||
if (ui.tab(htab, 'Properties')) {
|
if (ui.tab(htab1, 'Properties')) {
|
||||||
if (selectedObject != null) {
|
if (selectedObject != null) {
|
||||||
|
|
||||||
var h = Id.handle();
|
var h = Id.handle();
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#version 450
|
||||||
|
#include "../Shaders/compiled.inc"
|
||||||
|
in vec4 pos;
|
||||||
|
in vec2 nor;
|
||||||
|
out vec3 voxpositionGeom;
|
||||||
|
uniform mat4 W;
|
||||||
|
void main() {
|
||||||
|
voxpositionGeom = vec3(W * vec4(pos.xyz, 1.0)) / voxelgiHalfExtents;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#version 450
|
||||||
|
#extension GL_ARB_shader_image_load_store : enable
|
||||||
|
#include "../Shaders/compiled.inc"
|
||||||
|
#include "../Shaders/std/math.glsl"
|
||||||
|
#include "../Shaders/std/imageatomic.glsl"
|
||||||
|
in vec3 voxposition;
|
||||||
|
uniform layout(r8) writeonly image3D voxels;
|
||||||
|
void main() {
|
||||||
|
if (abs(voxposition.z) > 1.0 || abs(voxposition.x) > 1 || abs(voxposition.y) > 1) return;
|
||||||
|
imageStore(voxels, ivec3(voxelgiResolution * (voxposition * 0.5 + 0.5)), vec4(1.0));
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
#version 450
|
||||||
|
layout(triangles) in;
|
||||||
|
layout(triangle_strip) out;
|
||||||
|
layout(max_vertices=3) out;
|
||||||
|
in vec3 voxpositionGeom[];
|
||||||
|
out vec3 voxposition;
|
||||||
|
void main() {
|
||||||
|
vec3 p1 = voxpositionGeom[1] - voxpositionGeom[0];
|
||||||
|
vec3 p2 = voxpositionGeom[2] - voxpositionGeom[0];
|
||||||
|
vec3 p = abs(cross(p1, p2));
|
||||||
|
for (uint i = 0; i < 3; ++i) {
|
||||||
|
voxposition = voxpositionGeom[i];
|
||||||
|
if (p.z > p.x && p.z > p.y) {
|
||||||
|
gl_Position = vec4(voxposition.x, voxposition.y, 0.0, 1.0);
|
||||||
|
}
|
||||||
|
else if (p.x > p.y && p.x > p.z) {
|
||||||
|
gl_Position = vec4(voxposition.y, voxposition.z, 0.0, 1.0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
gl_Position = vec4(voxposition.x, voxposition.z, 0.0, 1.0);
|
||||||
|
}
|
||||||
|
EmitVertex();
|
||||||
|
}
|
||||||
|
EndPrimitive();
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#version 450
|
||||||
|
#include "../Shaders/compiled.inc"
|
||||||
|
in vec4 pos;
|
||||||
|
in vec2 nor;
|
||||||
|
out vec3 voxpositionGeom;
|
||||||
|
uniform mat4 W;
|
||||||
|
void main() {
|
||||||
|
voxpositionGeom = vec3(W * vec4(pos.xyz, 1.0)) / voxelgiHalfExtents;
|
||||||
|
}
|
||||||
+7
-1
@@ -6,7 +6,6 @@ project.addLibrary("iron");
|
|||||||
project.addLibrary("zui");
|
project.addLibrary("zui");
|
||||||
project.addLibrary("iron_format");
|
project.addLibrary("iron_format");
|
||||||
project.addShaders("compiled/Shaders/*.glsl", { noembed: false});
|
project.addShaders("compiled/Shaders/*.glsl", { noembed: false});
|
||||||
project.addShaders("compiled/Hlsl/*.glsl", { noprocessing: true, noembed: false });
|
|
||||||
project.addAssets("compiled/Assets/**", { notinlist: true , destination: "data/{name}" });
|
project.addAssets("compiled/Assets/**", { notinlist: true , destination: "data/{name}" });
|
||||||
project.addAssets("compiled/Shaders/*.arm", { notinlist: true , destination: "data/{name}" });
|
project.addAssets("compiled/Shaders/*.arm", { notinlist: true , destination: "data/{name}" });
|
||||||
project.addAssets("Bundled/data/**", { notinlist: true , destination: "data/{name}" });
|
project.addAssets("Bundled/data/**", { notinlist: true , destination: "data/{name}" });
|
||||||
@@ -54,6 +53,13 @@ project.addDefine('arm_data_dir');
|
|||||||
project.addParameter('--macro include("arm.brushnode")');
|
project.addParameter('--macro include("arm.brushnode")');
|
||||||
project.addParameter('-dce full');
|
project.addParameter('-dce full');
|
||||||
|
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
project.addShaders("compiled/Hlsl/*.glsl", { noprocessing: true, noembed: false });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
project.addShaders("compiled/Glsl/*.glsl", { noembed: false });
|
||||||
|
}
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
project.addAssets("Bundled/cmft/cmft.exe", { notinlist: true , destination: "data/{name}" });
|
project.addAssets("Bundled/cmft/cmft.exe", { notinlist: true , destination: "data/{name}" });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user