Decal paint -> decal mask

This commit is contained in:
luboslenco
2020-10-24 13:30:23 +02:00
parent 9ee816d4cc
commit 9da935e339
10 changed files with 24 additions and 24 deletions
+1 -1
View File
@@ -8,7 +8,7 @@
"set_clone_source": "alt",
"stencil_transform": "ctrl",
"stencil_hide": "z",
"decal_paint": "ctrl",
"decal_mask": "ctrl",
"select_material": "shift+number",
"cycle_layers": "ctrl+tab",
"brush_radius": "f",
+1 -1
View File
@@ -8,7 +8,7 @@
"set_clone_source": "alt",
"stencil_transform": "ctrl",
"stencil_hide": "z",
"decal_paint": "ctrl",
"decal_mask": "ctrl",
"select_material": "shift+number",
"cycle_layers": "ctrl+tab",
"brush_radius": "f",
+1 -1
View File
@@ -14,7 +14,7 @@ class MakeBrush {
if (Context.tool == ToolParticle) return;
var decal = Context.tool == ToolDecal || Context.tool == ToolText;
if (decal) frag.write('if (decalPaint.z > 0) {');
if (decal) frag.write('if (decalMask.z > 0) {');
if (Config.raw.brush_3d) {
frag.write('vec4 inpLocal = inp;'); // TODO: spirv workaround
+2 -2
View File
@@ -72,8 +72,8 @@ class MakePaint {
vert.write('vec2 subtex = tex;');
if (decal) {
vert.add_uniform('vec2 sub', '_sub');
vert.add_uniform('vec4 decalPaint', '_decalPaint');
vert.write('if (decalPaint.z > 0.0) subtex += sub;');
vert.add_uniform('vec4 decalMask', '_decalMask');
vert.write('if (decalMask.z > 0.0) subtex += sub;');
}
}
+3 -3
View File
@@ -23,10 +23,10 @@ class MakeTexcoord {
//frag.write_attrib('if (uvsp.x < 0.0 || uvsp.y < 0.0 || uvsp.x > 1.0 || uvsp.y > 1.0) discard;');
}
else if (decal) {
frag.add_uniform('vec4 decalPaint', '_decalPaint');
frag.write_attrib('uvsp -= decalPaint.xy;');
frag.add_uniform('vec4 decalMask', '_decalMask');
frag.write_attrib('uvsp -= decalMask.xy;');
frag.write_attrib('uvsp.x *= aspectRatio;');
frag.write_attrib('uvsp *= 0.21 / (decalPaint.w * 0.9);'); // Decal radius
frag.write_attrib('uvsp *= 0.21 / (decalMask.w * 0.9);'); // Decal radius
if (Context.brushDirectional) {
frag.add_uniform('vec3 brushDirection', '_brushDirection');
+2 -2
View File
@@ -36,12 +36,12 @@ class InputNode extends LogicNode {
}
var decal = Context.tool == ToolDecal || Context.tool == ToolText;
var decalPaint = decal && Operator.shortcut(Config.keymap.decal_paint + "+" + Config.keymap.action_paint, ShortcutDown);
var decalMask = decal && Operator.shortcut(Config.keymap.decal_mask + "+" + Config.keymap.action_paint, ShortcutDown);
var lazyPaint = Context.brushLazyRadius > 0 &&
(Operator.shortcut(Config.keymap.action_paint, ShortcutDown) ||
Operator.shortcut(Config.keymap.brush_ruler + "+" + Config.keymap.action_paint, ShortcutDown) ||
decalPaint);
decalMask);
var mouse = iron.system.Input.getMouse();
var paintX = mouse.viewX / iron.App.w();
+4 -4
View File
@@ -361,14 +361,14 @@ class RenderPathPaint {
public static function commandsCursor() {
var decal = Context.tool == ToolDecal || Context.tool == ToolText;
var decalPaint = decal && Operator.shortcut(Config.keymap.decal_paint);
var decalMask = decal && Operator.shortcut(Config.keymap.decal_mask);
var tool = Context.tool;
if (tool != ToolBrush &&
tool != ToolEraser &&
tool != ToolClone &&
tool != ToolBlur &&
tool != ToolParticle &&
!decalPaint) {
!decalMask) {
return;
}
if (!App.uiEnabled || UIHeader.inst.worktab.position == SpaceRender) {
@@ -408,8 +408,8 @@ class RenderPathPaint {
path.setTarget("");
g.setPipeline(Layers.pipeCursor);
var decal = Context.tool == ToolDecal || Context.tool == ToolText;
var decalPaint = decal && Operator.shortcut(Config.keymap.decal_paint);
var img = (decal && !decalPaint) ? Context.decalImage : Res.get("cursor.k");
var decalMask = decal && Operator.shortcut(Config.keymap.decal_mask);
var img = (decal && !decalMask) ? Context.decalImage : Res.get("cursor.k");
g.setTexture(Layers.cursorTex, img);
var gbuffer0 = path.renderTargets.get("gbuffer0").image;
g.setTextureDepth(Layers.cursorGbufferD, gbuffer0);
+5 -5
View File
@@ -33,8 +33,8 @@ class Uniforms {
#if arm_painter
case "_brushRadius": {
var val = radiusUniform();
var decalPaint = Operator.shortcut(Config.keymap.decal_paint + "+" + Config.keymap.action_paint, ShortcutDown);
return decalPaint ? val * 2 : val;
var decalMask = Operator.shortcut(Config.keymap.decal_mask + "+" + Config.keymap.action_paint, ShortcutDown);
return decalMask ? val * 2 : val;
}
case "_brushScaleX": {
return 1 / Context.brushScaleX;
@@ -360,9 +360,9 @@ class Uniforms {
vec.set(Context.envmapAngle, Math.sin(-Context.envmapAngle), Math.cos(-Context.envmapAngle), Context.showEnvmap ? Scene.active.world.probe.raw.strength : 4.0);
return vec;
}
case "_decalPaint": {
var decalPaint = Operator.shortcut(Config.keymap.decal_paint + "+" + Config.keymap.action_paint, ShortcutDown);
vec.set(Context.decalX, Context.decalY, decalPaint ? 1 : 0, radiusUniform());
case "_decalMask": {
var decalMask = Operator.shortcut(Config.keymap.decal_mask + "+" + Config.keymap.action_paint, ShortcutDown);
vec.set(Context.decalX, Context.decalY, decalMask ? 1 : 0, radiusUniform());
return vec;
}
}
+3 -3
View File
@@ -489,11 +489,11 @@ class UISidebar {
}
var decal = Context.tool == ToolDecal || Context.tool == ToolText;
var decalPaint = decal && Operator.shortcut(Config.keymap.decal_paint + "+" + Config.keymap.action_paint, ShortcutDown);
var decalMask = decal && Operator.shortcut(Config.keymap.decal_mask + "+" + Config.keymap.action_paint, ShortcutDown);
var setCloneSource = Context.tool == ToolClone && Operator.shortcut(Config.keymap.set_clone_source + "+" + Config.keymap.action_paint, ShortcutDown);
var down = Operator.shortcut(Config.keymap.action_paint, ShortcutDown) ||
decalPaint ||
decalMask ||
setCloneSource ||
Operator.shortcut(Config.keymap.brush_ruler + "+" + Config.keymap.action_paint, ShortcutDown) ||
(Input.getPen().down() && !kb.down("alt"));
@@ -744,7 +744,7 @@ class UISidebar {
var psizex = Std.int(256 * ui.SCALE() * (Context.brushRadius * Context.brushNodesRadius * Context.brushScaleX));
var psizey = Std.int(256 * ui.SCALE() * (Context.brushRadius * Context.brushNodesRadius));
var decalAlpha = 0.5;
if (!Operator.shortcut(Config.keymap.decal_paint, ShortcutDown)) {
if (!Operator.shortcut(Config.keymap.decal_mask, ShortcutDown)) {
Context.decalX = Context.paintVec.x;
Context.decalY = Context.paintVec.y;
decalAlpha = Context.brushOpacity;
+2 -2
View File
@@ -276,13 +276,13 @@ class UIView2D {
}
var decal = Context.tool == ToolDecal || Context.tool == ToolText;
var decalPaint = decal && Operator.shortcut(Config.keymap.decal_paint + "+" + Config.keymap.action_paint, ShortcutDown);
var decalMask = decal && Operator.shortcut(Config.keymap.decal_mask + "+" + Config.keymap.action_paint, ShortcutDown);
var setCloneSource = Context.tool == ToolClone && Operator.shortcut(Config.keymap.set_clone_source + "+" + Config.keymap.action_paint, ShortcutDown);
if (type == View2DLayer &&
(Operator.shortcut(Config.keymap.action_paint, ShortcutDown) ||
Operator.shortcut(Config.keymap.brush_ruler + "+" + Config.keymap.action_paint, ShortcutDown) ||
decalPaint ||
decalMask ||
setCloneSource ||
Config.raw.brush_live)) {
Context.paint2d = true;