如何获取导出的json文件具有的数据?例如,我有这种材料,我想更改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;