forked from Edarke/131P4_Tester
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassign_test.glsl
75 lines (63 loc) · 1.19 KB
/
assign_test.glsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//precision highp float;
vec2 v2; // = vec2(1.0, 2.0);
vec2 v21; // = vec2(3.3, 6.7);
vec3 v3; // = vec3(-1.0, 3.0, 5.0);
vec3 v31; // = vec3(2.2, 4.4, 6.6);
vec4 v4; // = vec4(0.0, 1.0, 2.0, 3.0);
vec4 v41; // = vec4(9.9, 8.7, 4.7, 2.9);
float hash(vec2 l2, vec3 l3, vec4 l4){
float hash = l2.x;
hash *= 10.0;
hash += l2.y;
hash *= 10.0;
hash += l3.x;
hash *= 10.0;
hash += l3.y;
hash *= 10.0;
hash += l3.z;
hash *= 10.0;
hash += l4.x;
hash *= 10.0;
hash += l4.y;
hash *= 10.0;
hash += l4.z;
hash *= 10.0;
hash += l4.w;
return hash;
}
float assign_test() {
v2 *= v3.xz;
v2 += v4.wx;
v2 -= v2.yx;
v2 /= v4.zy;
v3 *= v2.xxx;
v3 += v3.xyz;
v3 /= v4.wyz;
v3 -= v3.xyz;
v4 += v3.xyzx;
v4 -= v2.xyxy;
v4 *= v4.wzyx;
v4 /= v2.yyxx;
v2 = v2;
v2 -= v21;
v2 += v21;
v2 *= v21;
v2 /= v21;
v3 = v3;
v3 -= v31;
v3 += v31;
v3 *= v31;
v3 /= v31;
v4 = v4;
v4 -= v41;
v4 += v41;
v4 *= v41;
v4 /= v41;
return hash(v2, v3, v4);
}
/* void main() {
if(assign_test() == -3.200029e+08) // Assert function call returns expected value
gl_FragColor = vec4(0,1,0,1.0); // green
else
gl_FragColor = vec4(1,0,0,1.0); // red
} */