gpt4 book ai didi

javascript - Three.js - 更新纹理

转载 作者:行者123 更新时间:2023-11-30 00:18:52 25 4
gpt4 key购买 nike

如何获取导出的json文件中的数据?例如,我有这种 Material ,我想更改 mapDiffuse 值,就像纹理一样。我如何在 javascript 函数中执行此操作?

"materials": [{
"transparent": false,
"DbgIndex": 0,
"mapDiffuseRepeat": [1,1],
"mapDiffuseAnisotropy": 1,
"specularCoef": 50,
"colorEmissive": [0,0,0],
"colorDiffuse": [0.64,0.64,0.64],
"wireframe": false,
"visible": true,
"blending": "NormalBlending",
"DbgColor": 15658734,
"mapDiffuse": "w.jpg",
"DbgName": "Material.005",
"opacity": 1,
"depthWrite": true,
"mapDiffuseWrap": ["RepeatWrapping","RepeatWrapping"],
"depthTest": true,
"shading": "phong",
"colorSpecular": [0.5,0.5,0.5],
"colorAmbient": [0.64,0.64,0.64]}, another 4 same materials (different names)

我不放弃 this reference所以任何帮助将不胜感激。谢谢!

最佳答案

我找到了..

mesh.material.materials[4].map = THREE.ImageUtils.loadTexture("image.jpg");mesh.material.materials[4].needsUpdate = true;

关于javascript - Three.js - 更新纹理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33905950/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com