-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjson.vert
41 lines (37 loc) · 840 Bytes
/
json.vert
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
/*{
frameskip: 1,
vertexMode: "TRIANGLES",
PASSES: [{
MODEL: {
PATH: './models/json/teapot-claraio.json',
},
}]
}*/
precision mediump float;
attribute vec3 position;
attribute vec3 normal;
attribute vec2 uv;
attribute float vertexId;
attribute float objectId;
uniform mat4 projectionMatrix;
uniform mat4 modelViewMatrix;
uniform mat3 uvTransform;
uniform float time;
uniform vec2 resolution;
varying vec2 vUv;
varying float vObjectId;
varying vec4 v_color;
vec2 rot(in vec2 p, in float t) {
float s = sin(t);
float c = cos(t);
return mat2(s, c, -c, s) * p;
}
void main() {
vec3 pos = position;
pos.xz = rot(pos.xz, time * 0.2);
pos.x *= resolution.y / resolution.x;
gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);
vUv = uv;
vObjectId = objectId;
v_color = vec4(vUv, 1, 1);
}