Created
July 25, 2015 07:41
-
-
Save pomle/0376c4a69dac110d7796 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var vertexShader = "varying vec2 vUv; void main() {vUv = uv;gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );}"; | |
var fragmentShader = "uniform vec3 color; uniform sampler2D texture; varying vec2 vUv; void main() { vec4 tColor = texture2D( texture, vUv ); gl_FragColor = vec4( mix( color, tColor.rgb, tColor.a ), 1.0 );}"; | |
var texture = THREE.ImageUtils.loadTexture( "sprites/stageselect.png"); | |
var geometry = new THREE.PlaneGeometry(48, 48); // Is not visible. | |
var geometry = new THREE.SphereGeometry(32, 4, 4); // Is visible. | |
var material = new THREE.ShaderMaterial({ | |
uniforms:{ | |
color: { type: "c", value: new THREE.Color( 0xffffff ) }, | |
texture: { type: "t", value: texture }, | |
}, | |
vertexShader: vertexShader, | |
fragmentShader: fragmentShader, | |
}); | |
var model = new THREE.Mesh(geometry, material) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment