Skip to content

Instantly share code, notes, and snippets.

@pomle
Created July 25, 2015 07:41
Show Gist options
  • Save pomle/0376c4a69dac110d7796 to your computer and use it in GitHub Desktop.
Save pomle/0376c4a69dac110d7796 to your computer and use it in GitHub Desktop.
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