Reputation: 2069
I've got a sprite and i'm trying to make the texture repeat over and over.
I think I have the right settings but it doesn't seem to be doing what I expect, am I doing something wrong?
And this is my code:
var bgTexture = new THREE.TextureLoader().load('/bg.png');
var spriteMaterial = new THREE.SpriteMaterial({ map: bgTexture });
spriteMaterial.wrapS = spriteMaterial.wrapT = THREE.RepeatWrapping;
spriteMaterial.map.offset.set( 0, 0 );
spriteMaterial.map.repeat.set( 10, 1 );
var sprite = new THREE.Sprite(spriteMaterial);
sprite.position.y = 0;
sprite.position.y = 0;
sprite.scale.x = 10;
sprite.scale.y = 1;
this.scene.add(sprite);
Upvotes: 2
Views: 279
Reputation: 210878
The properties .wrapS
and .wrapT
have to be set to the Texture
rather than the SpriteMaterial
:
spriteMaterial.wrapS = spriteMaterial.wrapT = THREE.RepeatWrapping;
spriteMaterial.map.wrapS = spriteMaterial.map.wrapT = THREE.RepeatWrapping;
Upvotes: 3