feat():initial version
This commit is contained in:
7
insDavi2.0/Res/shader/prog_color.fp
Normal file
7
insDavi2.0/Res/shader/prog_color.fp
Normal file
@@ -0,0 +1,7 @@
|
||||
uniform float u_flt_inv_alpha;
|
||||
varying vec4 v_v4_clr;
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = v_v4_clr;
|
||||
gl_FragColor.a *= 1.0-u_flt_inv_alpha;
|
||||
}
|
||||
11
insDavi2.0/Res/shader/prog_color.vp
Normal file
11
insDavi2.0/Res/shader/prog_color.vp
Normal file
@@ -0,0 +1,11 @@
|
||||
uniform mat4 u_mat4_mdv;
|
||||
uniform mat4 u_mat4_prj;
|
||||
attribute vec3 a_v3_vtx;
|
||||
attribute vec4 a_v4_clr;
|
||||
varying vec4 v_v4_clr;
|
||||
void main()
|
||||
{
|
||||
vec4 vPosES = u_mat4_mdv * vec4(a_v3_vtx.x, a_v3_vtx.y, a_v3_vtx.z, 1.0);
|
||||
gl_Position = u_mat4_prj * vPosES;
|
||||
v_v4_clr = a_v4_clr;
|
||||
}
|
||||
9
insDavi2.0/Res/shader/prog_color_with_tex_alpha.fp
Normal file
9
insDavi2.0/Res/shader/prog_color_with_tex_alpha.fp
Normal file
@@ -0,0 +1,9 @@
|
||||
uniform sampler2D u_sam_tex;
|
||||
uniform float u_flt_inv_alpha;
|
||||
varying vec4 v_v4_clr;
|
||||
varying vec2 v_v2_txc;
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = v_v4_clr;
|
||||
gl_FragColor.a *= texture2D(u_sam_tex, v_v2_txc).a*(1.0-u_flt_inv_alpha);
|
||||
}
|
||||
14
insDavi2.0/Res/shader/prog_color_with_tex_alpha.vp
Normal file
14
insDavi2.0/Res/shader/prog_color_with_tex_alpha.vp
Normal file
@@ -0,0 +1,14 @@
|
||||
uniform mat4 u_mat4_mdv;
|
||||
uniform mat4 u_mat4_prj;
|
||||
attribute vec3 a_v3_vtx;
|
||||
attribute vec4 a_v4_clr;
|
||||
attribute vec2 a_v2_txc;
|
||||
varying vec4 v_v4_clr;
|
||||
varying vec2 v_v2_txc;
|
||||
void main()
|
||||
{
|
||||
vec4 vPosES = u_mat4_mdv * vec4(a_v3_vtx.x, a_v3_vtx.y, a_v3_vtx.z, 1.0);
|
||||
gl_Position = u_mat4_prj * vPosES;
|
||||
v_v4_clr = a_v4_clr;
|
||||
v_v2_txc = a_v2_txc;
|
||||
}
|
||||
10
insDavi2.0/Res/shader/prog_font.fp
Normal file
10
insDavi2.0/Res/shader/prog_font.fp
Normal file
@@ -0,0 +1,10 @@
|
||||
uniform sampler2D u_sam_tex;
|
||||
uniform vec3 u_v3_clr;
|
||||
uniform float u_flt_inv_alpha;
|
||||
varying vec2 v_v2_txc;
|
||||
#define offset (1.0/512)
|
||||
void main()
|
||||
{
|
||||
float alpha = texture2D(u_sam_tex, v_v2_txc).a;
|
||||
gl_FragColor = vec4(u_v3_clr.r, u_v3_clr.g, u_v3_clr.b, (1.0-u_flt_inv_alpha)*alpha);
|
||||
}
|
||||
11
insDavi2.0/Res/shader/prog_font.vp
Normal file
11
insDavi2.0/Res/shader/prog_font.vp
Normal file
@@ -0,0 +1,11 @@
|
||||
uniform mat4 u_mat4_mdv;
|
||||
uniform mat4 u_mat4_prj;
|
||||
attribute vec3 a_v3_vtx;
|
||||
attribute vec2 a_v2_txc;
|
||||
varying vec2 v_v2_txc;
|
||||
void main()
|
||||
{
|
||||
vec4 vPosES = u_mat4_mdv * vec4(a_v3_vtx.x, a_v3_vtx.y, a_v3_vtx.z, 1.0);
|
||||
gl_Position = u_mat4_prj * vPosES;
|
||||
v_v2_txc = a_v2_txc;
|
||||
}
|
||||
10
insDavi2.0/Res/shader/prog_font_attr_alpha.fp
Normal file
10
insDavi2.0/Res/shader/prog_font_attr_alpha.fp
Normal file
@@ -0,0 +1,10 @@
|
||||
uniform sampler2D u_sam_tex;
|
||||
uniform vec3 u_v3_clr;
|
||||
uniform float u_flt_inv_alpha;
|
||||
varying vec2 v_v2_txc;
|
||||
varying float v_flt_alpha;
|
||||
void main()
|
||||
{
|
||||
float alpha = texture2D(u_sam_tex, v_v2_txc).a*v_flt_alpha;
|
||||
gl_FragColor = vec4(u_v3_clr.r, u_v3_clr.g, u_v3_clr.b, (1.0-u_flt_inv_alpha)*alpha);
|
||||
}
|
||||
14
insDavi2.0/Res/shader/prog_font_attr_alpha.vp
Normal file
14
insDavi2.0/Res/shader/prog_font_attr_alpha.vp
Normal file
@@ -0,0 +1,14 @@
|
||||
uniform mat4 u_mat4_mdv;
|
||||
uniform mat4 u_mat4_prj;
|
||||
attribute vec3 a_v3_vtx;
|
||||
attribute vec2 a_v2_txc;
|
||||
attribute float a_flt_alpha;
|
||||
varying vec2 v_v2_txc;
|
||||
varying float v_flt_alpha;
|
||||
void main()
|
||||
{
|
||||
vec4 vPosES = u_mat4_mdv * vec4(a_v3_vtx.x, a_v3_vtx.y, a_v3_vtx.z, 1.0);
|
||||
gl_Position = u_mat4_prj * vPosES;
|
||||
v_v2_txc = a_v2_txc;
|
||||
v_flt_alpha = a_flt_alpha;
|
||||
}
|
||||
30
insDavi2.0/Res/shader/prog_model_ads.fp
Normal file
30
insDavi2.0/Res/shader/prog_model_ads.fp
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
uniform mat4 u_mat4_ads;
|
||||
|
||||
varying vec3 vEyeNormal;
|
||||
varying vec3 vPosition3;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 amb = u_mat4_ads[0];//vec4 (0.0, 0.0, 0.0, 1.0);
|
||||
vec4 diff = u_mat4_ads[1];//vec4 (1.0, 1.0, 1.0, 1.0);
|
||||
vec4 spcl = u_mat4_ads[2];//vec4 (1.0, 1.0, 1.0, 1.0);
|
||||
vec3 lpos = u_mat4_ads[3].xyz;//vec3(-10.0, 10.0, 10.0);
|
||||
|
||||
vec3 vLightDir = normalize(lpos - vPosition3);
|
||||
|
||||
float tdiff = max(0.0, dot(vEyeNormal, vLightDir));
|
||||
|
||||
vec4 v_v4_clr = tdiff * diff;
|
||||
|
||||
v_v4_clr += amb;
|
||||
vec3 vReflection = normalize(reflect(-vLightDir, vEyeNormal));
|
||||
float spec = max(0.0, dot(vEyeNormal, vReflection));
|
||||
|
||||
float fSpec = pow(spec, 128.0);
|
||||
v_v4_clr.rgb += vec3(fSpec, fSpec, fSpec);
|
||||
|
||||
v_v4_clr.rgba *= u_mat4_ads[3].w;
|
||||
|
||||
gl_FragColor = v_v4_clr;
|
||||
}
|
||||
19
insDavi2.0/Res/shader/prog_model_ads.vp
Normal file
19
insDavi2.0/Res/shader/prog_model_ads.vp
Normal file
@@ -0,0 +1,19 @@
|
||||
uniform mat4 u_mat4_mdv;
|
||||
uniform mat4 u_mat4_prj;
|
||||
uniform mat4 u_mat4_ads;
|
||||
|
||||
attribute vec3 a_v3_nor;
|
||||
attribute vec3 a_v3_vtx;
|
||||
|
||||
varying vec3 vEyeNormal;
|
||||
varying vec3 vPosition3;
|
||||
|
||||
void main()
|
||||
{
|
||||
vEyeNormal = vec3(u_mat4_mdv * vec4(a_v3_nor, 0.0));
|
||||
|
||||
vec4 vPosition4 = u_mat4_mdv * vec4(a_v3_vtx.x, a_v3_vtx.y, a_v3_vtx.z, 1.0);
|
||||
vPosition3 = vPosition4.xyz / vPosition4.w;
|
||||
|
||||
gl_Position = u_mat4_prj * vPosition4;
|
||||
}
|
||||
8
insDavi2.0/Res/shader/prog_texture.fp
Normal file
8
insDavi2.0/Res/shader/prog_texture.fp
Normal file
@@ -0,0 +1,8 @@
|
||||
uniform sampler2D u_sam_tex;
|
||||
uniform float u_flt_inv_alpha;
|
||||
varying vec2 v_v2_txc;
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = texture2D(u_sam_tex, v_v2_txc);
|
||||
gl_FragColor.a *= 1.0-u_flt_inv_alpha;
|
||||
}
|
||||
11
insDavi2.0/Res/shader/prog_texture.vp
Normal file
11
insDavi2.0/Res/shader/prog_texture.vp
Normal file
@@ -0,0 +1,11 @@
|
||||
uniform mat4 u_mat4_mdv;
|
||||
uniform mat4 u_mat4_prj;
|
||||
attribute vec3 a_v3_vtx;
|
||||
attribute vec2 a_v2_txc;
|
||||
varying vec2 v_v2_txc;
|
||||
void main()
|
||||
{
|
||||
vec4 vPosES = u_mat4_mdv * vec4(a_v3_vtx.x, a_v3_vtx.y, a_v3_vtx.z, 1.0);
|
||||
v_v2_txc = a_v2_txc;
|
||||
gl_Position = u_mat4_prj * vPosES;
|
||||
}
|
||||
10
insDavi2.0/Res/shader/prog_texture_attr_alpha.fp
Normal file
10
insDavi2.0/Res/shader/prog_texture_attr_alpha.fp
Normal file
@@ -0,0 +1,10 @@
|
||||
uniform sampler2D u_sam_tex;
|
||||
uniform float u_flt_inv_alpha;
|
||||
varying vec2 v_v2_txc;
|
||||
varying float v_flt_alpha;
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = texture2D(u_sam_tex, v_v2_txc);
|
||||
gl_FragColor.a *= v_flt_alpha;
|
||||
gl_FragColor.a *= 1.0-u_flt_inv_alpha;
|
||||
}
|
||||
14
insDavi2.0/Res/shader/prog_texture_attr_alpha.vp
Normal file
14
insDavi2.0/Res/shader/prog_texture_attr_alpha.vp
Normal file
@@ -0,0 +1,14 @@
|
||||
uniform mat4 u_mat4_mdv;
|
||||
uniform mat4 u_mat4_prj;
|
||||
attribute vec3 a_v3_vtx;
|
||||
attribute vec2 a_v2_txc;
|
||||
attribute float a_flt_alpha;
|
||||
varying vec2 v_v2_txc;
|
||||
varying float v_flt_alpha;
|
||||
void main()
|
||||
{
|
||||
vec4 vPosES = u_mat4_mdv * vec4(a_v3_vtx.x, a_v3_vtx.y, a_v3_vtx.z, 1.0);
|
||||
v_v2_txc = a_v2_txc;
|
||||
v_flt_alpha = a_flt_alpha;
|
||||
gl_Position = u_mat4_prj * vPosES;
|
||||
}
|
||||
18
insDavi2.0/Res/shader/prog_texture_complex.fp
Normal file
18
insDavi2.0/Res/shader/prog_texture_complex.fp
Normal file
@@ -0,0 +1,18 @@
|
||||
uniform vec4 u_v4_clr;
|
||||
//uniform sampler2D u_sam_tex;
|
||||
uniform sampler2D u_sam_tex_mask;
|
||||
uniform float u_flt_inv_alpha;
|
||||
//varying vec2 v_v2_txc;
|
||||
varying vec2 v_v2_txc_mask;
|
||||
varying float v_flt_alpha;
|
||||
void main()
|
||||
{
|
||||
if(v_v2_txc_mask.x < 0.0)discard;
|
||||
if(v_v2_txc_mask.x > 1.0)discard;
|
||||
if(v_v2_txc_mask.y < 0.0)discard;
|
||||
if(v_v2_txc_mask.y > 1.0)discard;
|
||||
float alpha = texture2D(u_sam_tex_mask, v_v2_txc_mask).a;
|
||||
//gl_FragColor = texture2D(u_sam_tex, v_v2_txc);
|
||||
gl_FragColor = u_v4_clr;//vec4(0.1, 0.3, 0.9, 1.0);
|
||||
gl_FragColor.a *= alpha*v_flt_alpha*(1.0-u_flt_inv_alpha);
|
||||
}
|
||||
18
insDavi2.0/Res/shader/prog_texture_complex.vp
Normal file
18
insDavi2.0/Res/shader/prog_texture_complex.vp
Normal file
@@ -0,0 +1,18 @@
|
||||
uniform mat4 u_mat4_mdv;
|
||||
uniform mat4 u_mat4_prj;
|
||||
uniform vec4 u_flt_mask_pos;
|
||||
attribute vec3 a_v3_vtx;
|
||||
//attribute vec2 a_v2_txc;
|
||||
attribute float a_flt_alpha;
|
||||
//varying vec2 v_v2_txc;
|
||||
varying vec2 v_v2_txc_mask;
|
||||
varying float v_flt_alpha;
|
||||
void main()
|
||||
{
|
||||
vec4 vPosES = u_mat4_mdv * vec4(a_v3_vtx.x, a_v3_vtx.y, a_v3_vtx.z, 1.0);
|
||||
//v_v2_txc = a_v2_txc;
|
||||
gl_Position = u_mat4_prj * vPosES;
|
||||
v_flt_alpha = a_flt_alpha;
|
||||
v_v2_txc_mask.x = (a_v3_vtx.x-u_flt_mask_pos.x)/(u_flt_mask_pos.z-u_flt_mask_pos.x);
|
||||
v_v2_txc_mask.y = (a_v3_vtx.y-u_flt_mask_pos.w)/(u_flt_mask_pos.y-u_flt_mask_pos.w);
|
||||
}
|
||||
11
insDavi2.0/Res/shader/prog_texture_road.fp
Normal file
11
insDavi2.0/Res/shader/prog_texture_road.fp
Normal file
@@ -0,0 +1,11 @@
|
||||
uniform sampler2D u_sam_tex;
|
||||
uniform vec4 u_v4_param;
|
||||
uniform float u_flt_inv_alpha;
|
||||
varying float v_flt_txcy;
|
||||
void main()
|
||||
{
|
||||
vec2 txc = vec2(0,v_flt_txcy);
|
||||
txc.x = u_v4_param.x*y*y*y+u_v4_param.y*y*y+u_v4_param.z*y+u_v4_param.w;
|
||||
gl_FragColor = texture2D(u_sam_tex, txc);
|
||||
gl_FragColor.a *= 1.0-u_flt_inv_alpha;
|
||||
}
|
||||
11
insDavi2.0/Res/shader/prog_texture_road.vp
Normal file
11
insDavi2.0/Res/shader/prog_texture_road.vp
Normal file
@@ -0,0 +1,11 @@
|
||||
uniform mat4 u_mat4_mdv;
|
||||
uniform mat4 u_mat4_prj;
|
||||
attribute vec3 a_v3_vtx;
|
||||
attribute float a_flt_txcy;
|
||||
varying float v_flt_txcy;
|
||||
void main()
|
||||
{
|
||||
vec4 vPosES = u_mat4_mdv * vec4(a_v3_vtx.x, a_v3_vtx.y, a_v3_vtx.z, 1.0);
|
||||
v_flt_txcy = a_flt_txcy;
|
||||
gl_Position = u_mat4_prj * vPosES;
|
||||
}
|
||||
13
insDavi2.0/Res/shader/prog_texture_with_mask.fp
Normal file
13
insDavi2.0/Res/shader/prog_texture_with_mask.fp
Normal file
@@ -0,0 +1,13 @@
|
||||
uniform sampler2D u_sam_tex;
|
||||
uniform sampler2D u_sam_tex_mask;
|
||||
uniform float u_flt_inv_alpha;
|
||||
varying vec2 v_v2_txc;
|
||||
varying vec2 v_v2_txc_mask;
|
||||
void main()
|
||||
{
|
||||
if(v_v2_txc_mask.y < 0.0)discard;
|
||||
if(v_v2_txc_mask.y > 1.0)discard;
|
||||
float alpha = texture2D(u_sam_tex_mask, v_v2_txc_mask).a;
|
||||
gl_FragColor = texture2D(u_sam_tex, v_v2_txc);
|
||||
gl_FragColor.a *= alpha*(1.0-u_flt_inv_alpha);
|
||||
}
|
||||
15
insDavi2.0/Res/shader/prog_texture_with_mask.vp
Normal file
15
insDavi2.0/Res/shader/prog_texture_with_mask.vp
Normal file
@@ -0,0 +1,15 @@
|
||||
uniform mat4 u_mat4_mdv;
|
||||
uniform mat4 u_mat4_prj;
|
||||
uniform vec4 u_flt_mask_pos;
|
||||
attribute vec3 a_v3_vtx;
|
||||
attribute vec2 a_v2_txc;
|
||||
varying vec2 v_v2_txc;
|
||||
varying vec2 v_v2_txc_mask;
|
||||
void main()
|
||||
{
|
||||
vec4 vPosES = u_mat4_mdv * vec4(a_v3_vtx.x, a_v3_vtx.y, a_v3_vtx.z, 1.0);
|
||||
v_v2_txc = a_v2_txc;
|
||||
v_v2_txc_mask.x = (a_v3_vtx.x-u_flt_mask_pos.x)/(u_flt_mask_pos.z-u_flt_mask_pos.x);
|
||||
v_v2_txc_mask.y = (a_v3_vtx.y-u_flt_mask_pos.w)/(u_flt_mask_pos.y-u_flt_mask_pos.w);
|
||||
gl_Position = u_mat4_prj * vPosES;
|
||||
}
|
||||
Reference in New Issue
Block a user