paint: cleanup
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
|
||||
#include "../global.h"
|
||||
|
||||
void make_particle_mask(node_shader_t *kong) {
|
||||
node_shader_add_out(kong, "wpos: float4");
|
||||
node_shader_add_constant(kong, "W: float4x4", "_world_matrix");
|
||||
node_shader_write_attrib_vert(kong, "output.wpos = constants.W * float4(input.pos.xyz, 1.0);");
|
||||
node_shader_add_constant(kong, "particle_hit: float3", "_particle_hit");
|
||||
node_shader_add_constant(kong, "particle_hit_last: float3", "_particle_hit_last");
|
||||
node_shader_add_constant(kong, "particle_radius: float", "_particle_radius");
|
||||
|
||||
node_shader_write_frag(kong, "var pa: float3 = input.wpos.xyz - constants.particle_hit;");
|
||||
node_shader_write_frag(kong, "var ba: float3 = constants.particle_hit_last - constants.particle_hit;");
|
||||
node_shader_write_frag(kong, "var h: float = clamp(dot(pa, ba) / max(dot(ba, ba), 0.00000001), 0.0, 1.0);");
|
||||
node_shader_write_frag(kong, "dist = length(pa - ba * h) * (5.0 / constants.particle_radius);");
|
||||
node_shader_write_frag(kong, "if (dist > 1.0) { discard; }");
|
||||
node_shader_write_frag(kong, "var str: float = clamp(pow(1.0 / dist * constants.brush_hardness * 0.2, 4.0), 0.0, 1.0) * opacity;");
|
||||
node_shader_write_frag(kong, "if (str == 0.0) { discard; }");
|
||||
}
|
||||
Reference in New Issue
Block a user