Fix 2d paint
This commit is contained in:
@@ -34,10 +34,11 @@ function make_brush_run(kong: node_shader_t) {
|
||||
node_shader_write_frag(kong, "var plane_dist: float = dot(wn, winp.xyz - input.wposition);");
|
||||
|
||||
if (config_raw.brush_angle_reject && !context_raw.xray) {
|
||||
node_shader_write_frag(kong, "if (plane_dist < -0.01) { discard; }");
|
||||
// constants.inp.w = paint2d ? 0.0 : 1.0
|
||||
node_shader_write_frag(kong, "if (plane_dist < -0.01 && constants.inp.w == 0.0) { discard; }");
|
||||
kong.frag_n = true;
|
||||
let angle: f32 = context_raw.brush_angle_reject_dot;
|
||||
node_shader_write_frag(kong, "if (dot(wn, n) < " + angle + ") { discard; }");
|
||||
node_shader_write_frag(kong, "if (dot(wn, n) < " + angle + " && constants.inp.w == 0.0) { discard; }");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ function vec2d(x: f32): f32 {
|
||||
function uniforms_ext_vec4_link(object: object_t, mat: material_data_t, link: string): vec4_t {
|
||||
if (link == "_input_brush") {
|
||||
let down: bool = mouse_down() || pen_down();
|
||||
let v: vec4_t = vec4_create(context_raw.paint_vec.x, context_raw.paint_vec.y, down ? 1.0 : 0.0, 0.0);
|
||||
let v: vec4_t = vec4_create(context_raw.paint_vec.x, context_raw.paint_vec.y, down ? 1.0 : 0.0, context_raw.paint2d ? 1.0 : 0.0);
|
||||
if (context_raw.paint2d) {
|
||||
v.x = vec2d(v.x);
|
||||
}
|
||||
@@ -267,7 +267,7 @@ function uniforms_ext_vec4_link(object: object_t, mat: material_data_t, link: st
|
||||
}
|
||||
else if (link == "_input_brush_last") {
|
||||
let down: bool = mouse_down() || pen_down();
|
||||
let v: vec4_t = vec4_create(context_raw.last_paint_vec_x, context_raw.last_paint_vec_y, down ? 1.0 : 0.0, 0.0);
|
||||
let v: vec4_t = vec4_create(context_raw.last_paint_vec_x, context_raw.last_paint_vec_y, down ? 1.0 : 0.0, context_raw.paint2d ? 1.0 : 0.0);
|
||||
if (context_raw.paint2d) {
|
||||
v.x = vec2d(v.x);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user