Skip to content

Commit bcdbdeb

Browse files
committed
shader stuff
1 parent 82e2f0f commit bcdbdeb

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

src/scripts/shader.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ camera.position.z = 1;
2121
const scene = new THREE.Scene();
2222

2323
// const geometry = new THREE.BoxGeometry(0.2, 0.2, 0.2);
24-
const geometry = new THREE.IcosahedronGeometry(0.2, 0);
24+
const geometry = new THREE.IcosahedronGeometry(0.2, 1);
2525
// const material = new THREE.ShaderMaterial();
2626
const material = new THREE.ShaderMaterial({
2727
vertexShader: _vert,
2828
fragmentShader: _frag,
29-
wireframe: true,
29+
// wireframe: true,
3030
});
3131

3232

src/scripts/test.frag

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
varying vec3 vPosition;
2+
varying vec3 vNormal;
3+
14
void main() {
2-
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
5+
// gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
6+
// float c = sin(pos.x * 16.) / 2.0;
7+
vec3 c = normalize(vNormal * vNormal);
8+
9+
gl_FragColor = vec4(c, 1.0);
10+
// gl_FragColor = vec4(vec3(1., 1., 1.), 1.0);
311
}

src/scripts/test.vert

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
varying vec3 vPosition;
2+
varying vec3 vNormal;
3+
14
void main() {
5+
vPosition = position;
6+
vNormal = normal;
7+
28
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
39
}

0 commit comments

Comments
 (0)