Skip to content

Commit eebdfe1

Browse files
committed
Merge branch 'master' of github.com:stackgl/shader-school
2 parents 02c3a03 + d59869b commit eebdfe1

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed
Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
highp mat4 reflection(highp vec3 n) {
2-
n = normalize(n);
3-
return mat4(1.0-2.0*n.x*n.x, -2.0*n.y*n.x, -2.0*n.z*n.x, 0,
4-
-2.0*n.y*n.x, 1.0-2.0*n.y*n.y, -2.0*n.z*n.y, 0,
5-
-2.0*n.z*n.x, -2.0*n.y*n.z, 1.0-2.0*n.z*n.z, 0,
6-
0, 0, 0, 1);
1+
highp mat4 rotation(highp vec3 n, highp float theta) {
2+
3+
float s = sin(theta);
4+
float c = cos(theta);
5+
float oc = 1.0 - c;
6+
7+
return mat4(
8+
oc * n.x * n.x + c, oc * n.x * n.y + n.z * s, oc * n.z * n.x - n.y * s, 0.0,
9+
oc * n.x * n.y - n.z * s, oc * n.y * n.y + c, oc * n.y * n.z + n.x * s, 0.0,
10+
oc * n.z * n.x + n.y * s, oc * n.y * n.z - n.x * s, oc * n.z * n.z + c, 0.0,
11+
0.0, 0.0, 0.0, 1.0
12+
);
713
}
814

9-
#pragma glslify: export(reflection)
15+
#pragma glslify: export(rotation)

index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ function createServer(root) {
6565
})
6666

6767
http.createServer(function(req, res) {
68+
// Force the addition of a query string. This
69+
// works around an issue in beefy until it gets fixed:
70+
// https://github.com/stackgl/shader-school/issues/107
71+
req.url = req.url.indexOf('?') === -1
72+
? req.url + '?'
73+
: req.url
74+
6875
var uri = url.parse(req.url).pathname
6976
var paths = uri.split('/').filter(Boolean)
7077

0 commit comments

Comments
 (0)