Added commented code that can be used for depth-independent line width
parent
546fe64c6f
commit
2365fe04ff
|
@ -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);
|
||||||
|
}
|
|
@ -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;
|
|
@ -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;
|
||||||
|
}
|
|
@ -31,6 +31,10 @@ void main()
|
||||||
vec2 next_screen = next_proj.xy / next_proj.w * aspect_vec;
|
vec2 next_screen = next_proj.xy / next_proj.w * aspect_vec;
|
||||||
|
|
||||||
float len = thickness;
|
float len = thickness;
|
||||||
|
// uncomment the following line to get a line width
|
||||||
|
// independent of distance to screen.
|
||||||
|
// len *= current_proj.w;
|
||||||
|
|
||||||
float orientation = direction;
|
float orientation = direction;
|
||||||
|
|
||||||
vec2 dir = vec2(0.0);
|
vec2 dir = vec2(0.0);
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue