[英]THREEJS Sprite repeat texture
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;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.