Make decal layers usable

This commit is contained in:
luboslenco
2020-12-14 16:20:09 +01:00
parent d2d64edb91
commit d884048f76
11 changed files with 47 additions and 39 deletions
+3 -4
View File
@@ -42,14 +42,13 @@ class LineDraw {
public static function render(g4: kha.graphics4.Graphics) {
return; ////
var hide = Operator.shortcut(Config.keymap.stencil_hide, ShortcutDown);
var isPaint = UIHeader.inst.worktab.position == SpacePaint;
var isDecal = isPaint && Context.layer.fill_layer != null && Context.layer.uvType == UVProject;
if (!isDecal) return;
if (!isDecal || hide) return;
mat = Context.layer.decalMat;
dim = Context.layer.decalDim;
dim = Context.layer.decalMat.getScale();
g = g4;
+8
View File
@@ -97,6 +97,9 @@ class Uniforms {
case "_dilateRadius": {
return UVUtil.dilatemap != null ? Config.raw.dilate_radius : 0.0;
}
case "_decalLayerDim": {
return Context.layer.decalMat.getScale().z * 0.5;
}
}
if (MaterialParser.script_links != null) {
for (key in MaterialParser.script_links.keys()) {
@@ -173,6 +176,11 @@ class Uniforms {
v.set(Context.layer.decalMat._30, Context.layer.decalMat._31, Context.layer.decalMat._32);
return v;
}
case "_decalLayerNor": {
v = iron.object.Uniforms.helpVec;
v.set(Context.layer.decalMat._20, Context.layer.decalMat._21, Context.layer.decalMat._22).normalize();
return v;
}
}
return v;