Erase to default color

This commit is contained in:
unknown
2019-08-13 14:36:15 +02:00
parent feef4792f2
commit c5a4f8c5d5
2 changed files with 7 additions and 5 deletions
+5 -2
View File
@@ -50,13 +50,16 @@ class Layers {
public static var cursorTex:TextureUnit;
public static var cursorGbufferD:TextureUnit;
public static var cursorGbuffer0:TextureUnit;
public static inline var defaultBase = 0.5;
public static inline var defaultRough = 0.4;
public static function initLayers(g:kha.graphics4.Graphics) {
g.end();
var layers = Project.layers;
layers[0].texpaint.g4.begin();
layers[0].texpaint.g4.clear(kha.Color.fromFloats(0.5, 0.5, 0.5, 0.0)); // Base
layers[0].texpaint.g4.clear(kha.Color.fromFloats(defaultBase, defaultBase, defaultBase, 0.0)); // Base
layers[0].texpaint.g4.end();
layers[0].texpaint_nor.g4.begin();
@@ -64,7 +67,7 @@ class Layers {
layers[0].texpaint_nor.g4.end();
layers[0].texpaint_pack.g4.begin();
layers[0].texpaint_pack.g4.clear(kha.Color.fromFloats(1.0, 0.4, 0.0, 0.0)); // Occ, rough, met
layers[0].texpaint_pack.g4.clear(kha.Color.fromFloats(1.0, defaultRough, 0.0, 0.0)); // Occ, rough, met
layers[0].texpaint_pack.g4.end();
g.begin();
+2 -3
View File
@@ -556,10 +556,9 @@ class MaterialBuilder {
}
else {
if (eraser) {
// Clear to default initLayers() values
frag.write('fragColor[0] = vec4(0.5, 0.5, 0.5, 0.0);');
frag.write('fragColor[0] = vec4(${Layers.defaultBase}, ${Layers.defaultBase}, ${Layers.defaultBase}, 0.0);');
frag.write('fragColor[1] = vec4(0.5, 0.5, 1.0, 0.0);');
frag.write('fragColor[2] = vec4(1.0, 0.4, 0.0, 0.0);');
frag.write('fragColor[2] = vec4(1.0, ${Layers.defaultRough}, 0.0, 0.0);');
}
else {
frag.add_uniform('sampler2D texpaint_nor_undo', '_texpaint_nor_undo');