Merge pull request 'Bug markers look better at longer distances.' (#9) from bug-marker-distance-improvements into main
Reviewed-on: BattyBovine/Bugbot#9
This commit is contained in:
commit
941967d5ee
Binary file not shown.
@ -6,20 +6,23 @@ render_mode blend_mix,depth_test_disabled,cull_disabled,unshaded;
|
||||
uniform vec3 colour : source_color = vec3(1.0f);
|
||||
uniform sampler2D msdf_icon : filter_linear_mipmap,hint_default_black;
|
||||
uniform float shape_thickness : hint_range(0.0f,1.0f,0.01) = 0.95f;
|
||||
uniform vec3 line_colour : source_color = vec3(0.0f);
|
||||
uniform float line_thickness : hint_range(0.0f,1.0f,0.01) = 0.0f;
|
||||
//uniform vec3 line_colour : source_color = vec3(0.0f);
|
||||
//uniform float line_thickness : hint_range(0.0f,1.0f,0.01) = 0.0f;
|
||||
uniform bool billboard = false;
|
||||
|
||||
varying float model_distance;
|
||||
|
||||
void vertex() {
|
||||
if (billboard) {
|
||||
MODELVIEW_MATRIX = VIEW_MATRIX * mat4(INV_VIEW_MATRIX[0], INV_VIEW_MATRIX[1], INV_VIEW_MATRIX[2], MODEL_MATRIX[3]);
|
||||
MODELVIEW_MATRIX = MODELVIEW_MATRIX * mat4(vec4(length(MODEL_MATRIX[0].xyz), 0.0, 0.0, 0.0), vec4(0.0, length(MODEL_MATRIX[1].xyz), 0.0, 0.0), vec4(0.0, 0.0, length(MODEL_MATRIX[2].xyz), 0.0), vec4(0.0, 0.0, 0.0, 1.0));
|
||||
MODELVIEW_NORMAL_MATRIX = mat3(MODELVIEW_MATRIX);
|
||||
}
|
||||
model_distance = pow(length(VIEW_MATRIX * MODEL_MATRIX[3]), 0.125f);
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
vec4 albedo_tex = texture(msdf_icon, UV);
|
||||
if (step(shape_thickness, albedo_tex.r) > 0.5f) { discard; }
|
||||
ALBEDO = (step(shape_thickness-line_thickness, albedo_tex.r) > 0.5f) ? pow(line_colour, vec3(0.4545454545)) : pow(colour.rgb, vec3(0.4545454545));
|
||||
if (step(clamp(shape_thickness / model_distance, 0.0, shape_thickness), albedo_tex.r) > 0.5f) { discard; }
|
||||
ALBEDO = /*(step(shape_thickness-line_thickness, albedo_tex.r) > 0.5f) ? pow(line_colour, vec3(0.4545454545)) : */pow(colour.rgb, vec3(0.4545454545));
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user