问题描述
限时送ChatGPT账号..基本上,
这有效:
var expl1 = new THREE.ImageUtils.loadTexture( 'images/explodes/expl1.png' );
this.material = new THREE.MeshBasicMaterial({ map: expl1, transparent:true, blending:THREE.AdditiveBlending });
这并没有...
var expl1 = new THREE.ImageUtils.loadTexture( 'images/explodes/expl1.png' );
this.material = new THREE.MeshBasicMaterial({ map: expl1.clone(), transparent:true, blending:THREE.AdditiveBlending });
问题是,我有多个具有此纹理的对象.我希望能够在不改变其他对象的情况下更改其中一个对象的纹理偏移.这就是为什么我需要克隆,但克隆的纹理似乎是空的.
The problem is, i have multiple objects with this texture. I want to be able to change the texture offsets of 1 of the objects without the others changing also. That's why i need clone, but the cloned texture seems to be empty.
var expl1 = new THREE.ImageUtils.loadTexture( 'images/explodes/expl1.png' );
这仅在全局变量中加载一次.我可以在每次创建新对象时加载一个新纹理,但因为它是 700KB,所以在加载图像时会产生延迟.
this is only loaded once in a global variable. I could load a new texture each time i'm creating a new object, but because it's 700KB, it creates lag when loading the image.
推荐答案
THREE.ImageUtils.loadTexture()
已被替换为 loader = new THREE.TextureLoader();loader.load()
.
这可能是因为 new THREE.TextureLoader().load()
为您设置了 needsUpdate
标志,而克隆则没有.
This is likely because new THREE.TextureLoader().load()
sets the needsUpdate
flag for you, while cloning does not.
改为这样做
var texture2 = texture1.clone();
texture2.needsUpdate = true;
material = new THREE.MeshBasicMaterial( { map: texture2, ... } );
three.js r.75
three.js r.75
这篇关于无法克隆()纹理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论