Paint Visible -> X-Ray
This commit is contained in:
@@ -113,7 +113,7 @@ class MaterialBuilder {
|
||||
frag.write_attrib('vec3 sp = vec3((ndc.xyz / ndc.w) * 0.5 + 0.5);');
|
||||
frag.write_attrib('sp.y = 1.0 - sp.y;');
|
||||
frag.add_uniform('float paintDepthBias', '_paintDepthBias');
|
||||
frag.write_attrib('sp.z -= paintDepthBias;'); // small bias or !paintVisible
|
||||
frag.write_attrib('sp.z -= paintDepthBias;'); // small bias or xray
|
||||
|
||||
if (UITrait.inst.brushPaint != 0) frag.ndcpos = true;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class Uniforms {
|
||||
else if (link == '_paintDepthBias') {
|
||||
var f = 0.0001;
|
||||
var t = UITrait.inst.paintObject.transform;
|
||||
if (!UITrait.inst.paintVisible) f = 1.0;
|
||||
if (UITrait.inst.xray) f = 1.0;
|
||||
else if (t.scale.x < 0 && t.scale.y < 0 && t.scale.z < 0) f = -f;
|
||||
else if (t.scale.x < 0 && t.scale.y > 0 && t.scale.z > 0) f = -f;
|
||||
else if (t.scale.y < 0 && t.scale.x > 0 && t.scale.z > 0) f = -f;
|
||||
|
||||
@@ -181,7 +181,7 @@ class UITrait extends iron.Trait {
|
||||
public var bakeRadius = 1.0;
|
||||
public var bakeOffset = 1.0;
|
||||
|
||||
public var paintVisible = true;
|
||||
public var xray = false;
|
||||
public var mirrorX = false;
|
||||
public var symX = false;
|
||||
public var symY = false;
|
||||
@@ -1450,11 +1450,13 @@ class UITrait extends iron.Trait {
|
||||
}
|
||||
}
|
||||
else {
|
||||
paintVisible = ui.check(Id.handle({selected: paintVisible}), "Visible Only");
|
||||
var _w = ui._w;
|
||||
ui._w = 60;
|
||||
|
||||
xray = ui.check(Id.handle({selected: xray}), "X-Ray");
|
||||
|
||||
if (selectedTool == ToolBrush || selectedTool == ToolEraser || selectedTool == ToolDecal || selectedTool == ToolText) {
|
||||
var mirrorHandle = Id.handle({selected: mirrorX});
|
||||
var _w = ui._w;
|
||||
ui._w = 60;
|
||||
mirrorX = ui.check(mirrorHandle, "Mirror");
|
||||
if (mirrorHandle.changed) {
|
||||
@@ -1475,8 +1477,8 @@ class UITrait extends iron.Trait {
|
||||
if (symXHandle.changed || symYHandle.changed || symZHandle.changed) {
|
||||
UINodes.inst.parsePaintMaterial();
|
||||
}
|
||||
ui._w = _w;
|
||||
}
|
||||
ui._w = _w;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user