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);
必须将.wrapS
和.wrapT
属性设置为Texture
而不是SpriteMaterial
:
spriteMaterial.wrapS = spriteMaterial.wrapT = THREE.RepeatWrapping;
spriteMaterial.map.wrapS = spriteMaterial.map.wrapT = THREE.RepeatWrapping;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.