summaryrefslogtreecommitdiff
path: root/shaders/tesseract/304.shader_test
diff options
context:
space:
mode:
Diffstat (limited to 'shaders/tesseract/304.shader_test')
-rw-r--r--shaders/tesseract/304.shader_test144
1 files changed, 144 insertions, 0 deletions
diff --git a/shaders/tesseract/304.shader_test b/shaders/tesseract/304.shader_test
new file mode 100644
index 0000000..88ef6a4
--- /dev/null
+++ b/shaders/tesseract/304.shader_test
@@ -0,0 +1,144 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+#version 120
+#extension GL_ARB_texture_rectangle : enable
+#define flat
+#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset))
+#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset))
+attribute vec4 vvertex, vtangent;
+ attribute vec2 vtexcoord0;
+
+ attribute vec4 vboneweight, vboneindex;
+ #pragma CUBE2_uniform animdata
+ uniform vec4 animdata[192];
+
+ uniform mat4 modelmatrix;
+ uniform mat3 modelworld;
+ uniform vec3 modelcamera;
+ uniform vec2 texscroll;
+
+ varying vec3 nvec;
+
+
+
+ varying vec2 texcoord0;
+
+ void main(void)
+ {
+
+ int index = int(vboneindex.x);
+
+ vec4 dqreal = animdata[index] * vboneweight.x;
+ vec4 dqdual = animdata[index+1] * vboneweight.x;
+ index = int(vboneindex.y);
+ dqreal += animdata[index] * vboneweight.y;
+ dqdual += animdata[index+1] * vboneweight.y;
+
+
+ float len = length(dqreal);
+ dqreal /= len;
+ dqdual /= len;
+
+
+ vec4 mpos = vec4((cross(dqreal.xyz, cross(dqreal.xyz, vvertex.xyz) + vvertex.xyz*dqreal.w + dqdual.xyz) + dqdual.xyz*dqreal.w - dqreal.xyz*dqdual.w)*2.0 + vvertex.xyz, vvertex.w);
+
+
+ vec4 mquat = vec4(cross(dqreal.xyz, vtangent.xyz) + dqreal.xyz*vtangent.w + vtangent.xyz*dqreal.w, dqreal.w*vtangent.w - dot(dqreal.xyz, vtangent.xyz));
+
+ vec3 mnormal = cross(mquat.xyz, vec3(mquat.y, -mquat.x, mquat.w))*2.0 + vec3(0.0, 0.0, 1.0);
+
+
+
+
+ gl_Position = modelmatrix * mpos;
+
+ texcoord0 = vtexcoord0 + texscroll;
+
+
+
+
+
+
+ nvec = modelworld * mnormal;
+
+ }
+
+[fragment shader]
+#version 120
+#extension GL_ARB_texture_rectangle : enable
+#define flat
+#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset))
+#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset))
+#define fragdata(loc, name, type)
+#define gcolor gl_FragData[0]
+#define gnormal gl_FragData[1]
+#define gglow gl_FragData[2]
+varying vec3 nvec;
+
+
+ uniform vec4 colorscale;
+ uniform vec2 fullbright;
+ uniform vec2 maskscale;
+
+ uniform sampler2D tex0;
+
+
+
+
+
+ fragdata(0, gcolor, vec4)
+ fragdata(1, gnormal, vec4)
+ fragdata(2, gglow, vec4)
+
+
+
+ varying vec2 texcoord0;
+ uniform float aamask;
+
+ void main(void)
+ {
+ vec4 diffuse = texture2D(tex0, texcoord0);
+
+
+
+ gcolor.rgb = diffuse.rgb*colorscale.rgb;
+
+
+
+
+ vec3 normal = normalize(nvec);
+
+
+
+ float spec = maskscale.x;
+
+ gcolor.a = 0.5*spec;
+
+
+ float glowk = fullbright.y, colork = fullbright.x-fullbright.y;
+
+
+
+ gglow.rgb = gcolor.rgb*glowk;
+ gcolor.rgb *= colork;
+ #define packnorm colorscale.a
+
+
+
+ gnormal.rgb = normal*0.5 + 0.5;
+ #ifdef packnorm
+ gnormal.a = (packnorm);
+ #else
+ gnormal.a = 1.0;
+ #endif
+
+
+
+
+
+
+ }
+
+