Paint channels
This commit is contained in:
+13
-8
@@ -405,11 +405,15 @@ class UINodes extends iron.Trait {
|
||||
alpha_blend_source: 'blend_one',
|
||||
alpha_blend_destination: eraser ? 'blend_zero' : 'blend_one',
|
||||
alpha_blend_operation: 'add',
|
||||
vertex_structure: [{"name": "pos", "size": 3},{"name": "nor", "size": 3},{"name": "tex", "size": 2}] });
|
||||
vertex_structure: [{name: "pos", size: 3},{name: "nor", size: 3},{name: "tex", size: 2}] });
|
||||
|
||||
con_paint.data.color_writes_red = [true, true, true, true];
|
||||
con_paint.data.color_writes_green = [true, true, true, true];
|
||||
con_paint.data.color_writes_blue = [true, true, true, true];
|
||||
|
||||
if (UITrait.inst.brushType == 3) { // Bake AO
|
||||
con_paint.data.color_write_green = false; // R
|
||||
con_paint.data.color_write_blue = false; // M
|
||||
con_paint.data.color_writes_green[2] = false; // No rough
|
||||
con_paint.data.color_writes_blue[2] = false; // No met
|
||||
}
|
||||
|
||||
var vert = con_paint.make_vert();
|
||||
@@ -598,8 +602,9 @@ class UINodes extends iron.Trait {
|
||||
|
||||
if (!UITrait.inst.paintBase) frag.write('fragColor[0].a = 0.0;');
|
||||
if (!UITrait.inst.paintNor) frag.write('fragColor[1].a = 0.0;');
|
||||
if (!UITrait.inst.paintRough) frag.write('fragColor[2].a = 0.0;');
|
||||
// if (!UITrait.inst.paintHeight) frag.write('fragColor[3].a = 0.0;');
|
||||
if (!UITrait.inst.paintOcc) con_paint.data.color_writes_red[2] = false;
|
||||
if (!UITrait.inst.paintRough) con_paint.data.color_writes_green[2] = false;
|
||||
if (!UITrait.inst.paintMet) con_paint.data.color_writes_blue[2] = false;
|
||||
|
||||
if (UITrait.inst.brushType == 3) { // Bake AO
|
||||
frag.write('fragColor[0].a = 0.0;');
|
||||
@@ -631,7 +636,7 @@ class UINodes extends iron.Trait {
|
||||
compare_mode: 'less',
|
||||
// cull_mode: 'clockwise',
|
||||
cull_mode: 'none',
|
||||
vertex_structure: [{"name": "pos", "size": 3},{"name": "nor", "size": 3},{"name": "tex", "size": 2}] });
|
||||
vertex_structure: [{name: "pos", size: 3},{name: "nor", size: 3},{name: "tex", size: 2}] });
|
||||
|
||||
var vert = con_mesh.make_vert();
|
||||
var frag = con_mesh.make_frag();
|
||||
@@ -711,7 +716,7 @@ class UINodes extends iron.Trait {
|
||||
color_write_green: false,
|
||||
color_write_blue: false,
|
||||
color_write_alpha: false,
|
||||
vertex_structure: [{"name": "pos", "size": 3}]
|
||||
vertex_structure: [{name: "pos", size: 3}]
|
||||
});
|
||||
|
||||
var vert = con_depth.make_vert();
|
||||
@@ -774,7 +779,7 @@ class UINodes extends iron.Trait {
|
||||
depth_write: true,
|
||||
compare_mode: 'less',
|
||||
cull_mode: 'clockwise',
|
||||
vertex_structure: [{"name": "pos", "size": 3},{"name": "nor", "size": 3},{"name": "tex", "size": 2}] });
|
||||
vertex_structure: [{name: "pos", size: 3},{name: "nor", size: 3},{name: "tex", size: 2}] });
|
||||
|
||||
var vert = con_mesh.make_vert();
|
||||
var frag = con_mesh.make_frag();
|
||||
|
||||
+30
-13
@@ -377,7 +377,7 @@ class UITrait extends iron.Trait {
|
||||
|
||||
function linkTex(object:Object, mat:MaterialData, link:String):kha.Image {
|
||||
if (link == "_texcolorid") {
|
||||
if (UITrait.inst.assets.length == 0) return bundled.get("mat_empty.jpg");
|
||||
if (UITrait.inst.assets.length == 0) return bundled.get("mat_slot.jpg");
|
||||
else return UITrait.inst.getImage(UITrait.inst.assets[colorIdHandle.position]);
|
||||
}
|
||||
return null;
|
||||
@@ -459,7 +459,7 @@ class UITrait extends iron.Trait {
|
||||
|
||||
var scale = armory.data.Config.raw.window_scale;
|
||||
ui = new Zui( { theme: arm.App.theme, font: arm.App.font, scaleFactor: scale, color_wheel: arm.App.color_wheel } );
|
||||
loadBundled(['cursor.png', 'mat.jpg', 'mat_empty.jpg', 'brush_draw.png', 'brush_erase.png', 'brush_fill.png', 'brush_bake.png', 'brush_colorid.png', 'cay_thumb.jpg'], done);
|
||||
loadBundled(['cursor.png', 'mat_slot.jpg', 'brush_draw.png', 'brush_erase.png', 'brush_fill.png', 'brush_bake.png', 'brush_colorid.png', 'cay_thumb.jpg'], done);
|
||||
}
|
||||
|
||||
var haxeTrace:Dynamic->haxe.PosInfos->Void;
|
||||
@@ -1404,7 +1404,7 @@ class UITrait extends iron.Trait {
|
||||
}
|
||||
if (ui.panel(Id.handle({selected: true}), "Material")) {
|
||||
|
||||
var img2 = bundled.get("mat_empty.jpg");
|
||||
var img2 = bundled.get("mat_slot.jpg");
|
||||
|
||||
for (row in 0...Std.int(Math.ceil(materials2.length / 5))) {
|
||||
ui.row([1/5,1/5,1/5,1/5,1/5]);
|
||||
@@ -1528,8 +1528,10 @@ class UITrait extends iron.Trait {
|
||||
ui.row([1/2, 1/2]);
|
||||
brushScale = ui.slider(Id.handle({value: brushScale}), "UV Scale", 0.0, 2.0, true);
|
||||
brushStrength = ui.slider(Id.handle({value: brushStrength}), "Strength", 0.0, 1.0, true);
|
||||
}
|
||||
|
||||
ui.row([1/4,1/4,1/4,1/4]);
|
||||
if (ui.panel(Id.handle({selected: true}), "Paint Channels")) {
|
||||
ui.row([1/3,1/3,1/3]);
|
||||
|
||||
var baseHandle = Id.handle({selected: paintBase});
|
||||
paintBase = ui.check(baseHandle, "Base");
|
||||
@@ -1545,14 +1547,6 @@ class UITrait extends iron.Trait {
|
||||
UINodes.inst.parsePaintMaterial();
|
||||
}
|
||||
|
||||
var roughHandle = Id.handle({selected: paintRough});
|
||||
// TODO: Use glColorMaski() to disable specific channel
|
||||
paintRough = ui.check(roughHandle, "ORM");
|
||||
if (roughHandle.changed) {
|
||||
UINodes.inst.updateCanvasMap();
|
||||
UINodes.inst.parsePaintMaterial();
|
||||
}
|
||||
|
||||
var heightHandle = Id.handle({selected: paintHeight});
|
||||
paintHeight = ui.check(heightHandle, "Height");
|
||||
if (heightHandle.changed) {
|
||||
@@ -1563,13 +1557,36 @@ class UITrait extends iron.Trait {
|
||||
UINodes.inst.parsePaintMaterial();
|
||||
}
|
||||
|
||||
ui.row([1/3,1/3,1/3]);
|
||||
|
||||
var occHandle = Id.handle({selected: paintOcc});
|
||||
paintOcc = ui.check(occHandle, "Occlusion");
|
||||
if (occHandle.changed) {
|
||||
UINodes.inst.updateCanvasMap();
|
||||
UINodes.inst.parsePaintMaterial();
|
||||
}
|
||||
|
||||
var roughHandle = Id.handle({selected: paintRough});
|
||||
paintRough = ui.check(roughHandle, "Roughness");
|
||||
if (roughHandle.changed) {
|
||||
UINodes.inst.updateCanvasMap();
|
||||
UINodes.inst.parsePaintMaterial();
|
||||
}
|
||||
|
||||
var metHandle = Id.handle({selected: paintMet});
|
||||
paintMet = ui.check(metHandle, "Metallic");
|
||||
if (metHandle.changed) {
|
||||
UINodes.inst.updateCanvasMap();
|
||||
UINodes.inst.parsePaintMaterial();
|
||||
}
|
||||
|
||||
paintVisible = ui.check(Id.handle({selected: paintVisible}), "Visible Only");
|
||||
}
|
||||
}
|
||||
|
||||
if (ui.panel(Id.handle({selected: true}), "Material")) {
|
||||
|
||||
var img2 = bundled.get("mat_empty.jpg");
|
||||
var img2 = bundled.get("mat_slot.jpg");
|
||||
|
||||
for (row in 0...Std.int(Math.ceil(materials.length / 5))) {
|
||||
ui.row([1/5,1/5,1/5,1/5,1/5]);
|
||||
|
||||
Reference in New Issue
Block a user