git-svn-id: svn://db.shs.com.ru/libs@48 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2015-11-26 21:42:43 +00:00
parent 4cbcbb5174
commit 59eb135a60
14 changed files with 419 additions and 42861 deletions

View File

@@ -1,7 +1,7 @@
#version 150
in vec3 src_normal, normal;//, et;
in vec4 pos;
in vec4 pos, ppos;
in float fogCoord;
in mat3 TBN;
@@ -42,10 +42,14 @@ void main(void) {
vec4 self = texture(qgl_Material.map_self_illumination.map, tc) * qgl_Material.map_self_illumination.amount + qgl_Material.map_self_illumination.offset;
self *= qgl_Material.color_self_illumination;
vec3 speed = pos.xyz/pos.w - ppos.xyz/ppos.w;
//speed /= abs(pos.z);
qgl_FragData[0] = vec4(dc.rgb, z);
qgl_FragData[1] = vec4(n.xyz / 2. + vec3(0.5), specularity);
qgl_FragData[2] = vec4(spec.rgb, hei);
qgl_FragData[3] = vec4(self.rgb, pos.w);
qgl_FragData[4] = vec4(speed,0);
//gl_FragData[0] = vec4(et.xyz, pos.w);
//gl_FragDepth = gl_FragCoord.z - clamp(hei / pos.z / pos.z / (abs(n.z) + 1), -0.01, 0.01);

View File

@@ -1,30 +1,36 @@
#version 150
out vec3 src_normal, normal;//, et;
out vec4 pos;
out vec4 pos, ppos;
out float fogCoord, fs_gid;
out mat3 TBN;
uniform bool acc_fog;
uniform vec2 dt;
uniform vec3 eye;
uniform mat4 prev_ModelViewProjectioMatrix;
void main(void) {
normal = qgl_Normal;//(qgl_NormalMatrix * qgl_Normal);
pos.xyzw = vec4(qgl_ModelViewMatrix * qgl_Vertex);
TBN = (mat3(qgl_Tangent, qgl_Bitangent, qgl_Normal));
pos = qgl_ftransform();
TBN = mat3(qgl_Tangent, qgl_Bitangent, qgl_Normal);
/*if (acc_fog) {
fogCoord = (gl_Fog.end - length(pos.xyz) * 0.85) / (gl_Fog.end - gl_Fog.start);
fogCoord = 1. - clamp(fogCoord, 0., 1.);
}*/
//gl_TexCoord[0] = gl_MultiTexCoord0;
//gl_TexCoord[1] = gl_MultiTexCoord1;
src_normal = normalize(vec3(pos.xy * dt * 2., 0));
qgl_FragTexture = qgl_Texture;
qgl_FragColor = qgl_Color;
vec4 tp = qgl_ftransform();
//tp /= tp.w;
src_normal = normalize(vec3(pos.xy * dt * 2., 0));
pos.w = tp.w;
ppos = prev_ModelViewProjectioMatrix * qgl_Vertex;
//pos.w = pos.w;
//speed = tp - ppos;
//speed /= (abs(speed) + 1.);
//speed.xyz *= speed.w;
//pos *= pos.w;
gl_Position = tp;//ftransform();
gl_Position = pos;
}

View File

@@ -4,7 +4,7 @@
in vec4 view_dir, view_pos;
uniform vec3 ambient;
uniform sampler2D t0, t1, t2, t3, t_pp;
uniform sampler2D t0, t1, t2, t3, t4, t_pp;
uniform sampler2D td;
uniform int gid, lightsCount;
uniform float z_near, z_far;
@@ -61,7 +61,7 @@ void main(void) {
qgl_FragData[0] = back_color;
return;
}
vec4 v1 = texture2D(t1, tc), v2 = texture2D(t2, tc), v3 = texture2D(t3, tc);
vec4 v1 = texture2D(t1, tc), v2 = texture2D(t2, tc), v3 = texture2D(t3, tc), v4 = texture2D(t4, tc);
vec2 sp = gl_FragCoord.xy * dt * 2 - vec2(1, 1);
vec3 dc = v0.rgb, n = v1.xyz * 2. - vec3(1.);
float height = v2.w;
@@ -91,6 +91,6 @@ void main(void) {
qgl_FragData[0].rgb = li * dc + si * v2.rgb + v3.rgb + texture(t_pp, tc).rgb;
//qgl_FragData[0].rgb = vec3(abs(lpos.xyz - pos.xyz)/10);
//qgl_FragData[0].rgb = si.rgb;
//qgl_FragData[0].rgb = (v0.rgb)/2;
//qgl_FragData[0].rgb = vec3(length(v4.xyz)/10);
//qgl_FragData[0].a = 0.;
}

View File

@@ -0,0 +1,24 @@
#version 150
uniform sampler2D t0, ts;
uniform vec2 dt;
uniform float factor;
uniform int steps = 16;
void main(void) {
vec2 cdt = dt / steps;
vec2 ct = qgl_FragTexture.xy;
vec3 speed = texture(ts, ct).rgb*1024;
int hsteps = steps / 2;
ct -= speed.xy * cdt * hsteps;
vec3 scol = vec3(0);//texture(t0, ct).rgb;
float sum = 0.;
for (int i = 0; i < steps; ++i) {
ct += speed.xy * cdt;
float mul = 1. - abs(i - hsteps) * 2. / steps;
scol += texture(t0, ct).rgb * mul;
sum += mul;
}
scol /= sum;
qgl_FragData[0].rgb = scol;
}

View File

@@ -0,0 +1,6 @@
#version 150
void main(void) {
qgl_FragTexture = qgl_Texture;
gl_Position = qgl_ftransform();
}