Three.js - 更新纹理
Three.js - Update texture
如何获取导出的 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)
我不会退出 get this reference 所以任何帮助都将不胜感激。
谢谢!
找到了..
mesh.material.materials[4].map = THREE.ImageUtils.loadTexture("image.jpg");
mesh.material.materials[4].needsUpdate = true;
如何获取导出的 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)
我不会退出 get this reference 所以任何帮助都将不胜感激。 谢谢!
找到了..
mesh.material.materials[4].map = THREE.ImageUtils.loadTexture("image.jpg"); mesh.material.materials[4].needsUpdate = true;