【问题标题】:Three.js - Update textureThree.js - 更新纹理
【发布时间】:2016-02-27 14:52:33
【问题描述】:

如何获取导出的 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,因此我们将不胜感激。 谢谢!

【问题讨论】:

    标签: javascript json three.js textures


    【解决方案1】:

    我找到了..

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

    【讨论】:

      猜你喜欢
      • 2013-08-28
      • 2013-08-28
      • 2019-04-16
      • 2012-09-08
      • 2013-04-10
      • 1970-01-01
      • 2013-02-23
      • 1970-01-01
      • 2012-09-17
      相关资源
      最近更新 更多