How To Use Texture Atlas With Threejs (r65)?
Since the new threejs revision (r65) is released, the uvOffset and uvScale is moved to texture.offset and texture.repeate. Unfortunately, the texture.offset is not working for me w
Solution 1:
I realise that is not the prettiest... but try with this:
var texture1 = new THREE.Texture();
texture1.offset.set( 0.5, 0 );
var texture2 = new THREE.Texture();
texture2.offset.set( - 0.5, 0 );
var loader = new THREE.ImageLoader();
loader.load( 'images/button.png', function ( image ) {
texture1.image = image;
texture1.needsUpdate = true;
texture2.image = image;
texture2.needsUpdate = true;
} );
var button1 = new THREE.Sprite( new THREE.SpriteMaterial( { map:texture1 } ) );
button1.position.set( - screen_half_x + 50, screen_half_y - 25, 1 );
button1.scale.set( 100, 50, 1 );
gui_node.add( button1 );
var button2 = new THREE.Sprite( new THREE.SpriteMaterial( { map:texture2 } ) );
button2.position.set( - screen_half_x + 50, screen_half_y - 150, 1 );
button2.scale.set( 100, 50, 1.0 );
gui_node.add( button2 );
Post a Comment for "How To Use Texture Atlas With Threejs (r65)?"