-
-
Save Samsy/491ec29cecf8dea462565051eebf4585 to your computer and use it in GitHub Desktop.
triangle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uniform sampler2D tex; | |
varying vec2 vUv; | |
void main() { | |
gl_FragColor = texture2D( tex, vUv ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as three from 'three' | |
class Triangle extends three.BufferGeometry { | |
constructor(){ | |
super() | |
this.setIndex( [2, 1, 0] ) | |
this.addAttribute( 'position', new three.Float32BufferAttribute( | |
[ | |
-1, -1, 0, | |
-1, 4, 0, | |
4, -1, 0 | |
] | |
, 3 )); | |
this.needsUpdate = true | |
} | |
} | |
let tri = new Triangle() | |
export default tri; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
varying vec2 vUv; | |
void main() { | |
vUv = vec2(0.5)+(position.xy)*0.5; | |
gl_Position = vec4( position.xy, 0.0, 1.0 );; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment