Added commented code that can be used for depth-independent line width

master
Martin Felis 2017-01-14 14:31:43 +01:00
parent 546fe64c6f
commit 2365fe04ff
5 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,19 @@
$input v_texcoord0
/*
* Copyright 2013-2014 Dario Manesku. All rights reserved.
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
#include "../common/common.sh"
SAMPLER2D(s_shadowMap0, 4);
uniform vec4 u_params2;
#define u_depthValuePow u_params2.x
void main()
{
float depth = unpackRgbaToFloat(texture2D(s_shadowMap0, v_texcoord0) );
vec3 rgba = pow(vec3_splat(depth), vec3_splat(u_depthValuePow) );
gl_FragColor = vec4(rgba, 1.0);
}

View File

@ -0,0 +1,5 @@
vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0);
vec3 a_position : POSITION;
vec4 a_normal : NORMAL;
vec2 a_texcoord0 : TEXCOORD0;

View File

@ -0,0 +1,16 @@
$input a_position, a_texcoord0
$output v_texcoord0
/*
* Copyright 2013-2014 Dario Manesku. All rights reserved.
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
*/
#include "../common/common.sh"
void main()
{
gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) );
v_texcoord0 = a_texcoord0;
}

View File

@ -31,6 +31,10 @@ void main()
vec2 next_screen = next_proj.xy / next_proj.w * aspect_vec;
float len = thickness;
// uncomment the following line to get a line width
// independent of distance to screen.
// len *= current_proj.w;
float orientation = direction;
vec2 dir = vec2(0.0);

BIN
shaders/src/mesh.out Normal file

Binary file not shown.