<xr-asset-load type="gltf" asset-id="gltf-item" src="..."/>
...
<xr-gltf id="gltf1" model="gltf-item"></xr-gltf>
<xr-gltf id="gltf2" model="gltf-item"></xr-gltf>
<xr-gltf id="gltf3" model="gltf-item"></xr-gltf>
...
const gltfElement = this.scene.getElementById("gltf1");
const gltfModel = gltfElement.getComponent(xrFrameSystem.GLTF);
const textureAsset = await this.scene.assets.loadAsset({
type: 'texture',
src: '...'
});
for (const mesh of gltfModel.getPrimitivesByNodeName("tag")) {
mesh.material.setVector('u_specularFactor', xrFrameSystem.Vector3.createFromNumber(0, 0, 0));
mesh.material.setTexture('u_baseColorMap', textureAsset.value);
}
加载多个相同模型时,修改其中一个模型的贴图,其他模型的贴图也会被修改,如何做到只修改单个模型的贴图呢
这里没人回。可以进微信群里问下,应该有人遇到过,不过人太多了,只能+wx:wdmwjm ,邀请进