【发布时间】:2013-01-04 21:52:10
【问题描述】:
我正在完成 Oreilly 编写的 WebGL 入门书中的练习。
以下行会导致运行时错误。我用谷歌搜索并没有看到其他人有这个问题,所以我做错了什么?
var specularMap= THREE.ImageUtils.loadTexture("WebGLBook/images/earth_specular_2048.jpg");
var shader = THREE.ShaderUtils.lib[ "normal" ]; <-- fails
var uniforms = THREE.UniformsUtils.clone(shader.uniforms);
uniforms['tNormal'].texture = normalMap;
uniforms['tDiffuse'].texture = surfaceMap;
指出的行失败并出现以下错误:
Uncaught TypeError: Cannot read property 'lib' of undefined solar-system-spec-map.html:60
Earth.createGlobe solar-system-spec-map.html:60
Earth.init solar-system-spec-map.html:51
EarthApp.init solar-system-spec-map.html:33
(anonymous function) solar-system-spec-map.html:93
deferred.resolveWith jquery-1.6.4.js:1016
jQuery.extend.ready jquery-1.6.4.js:437
DOMContentLoaded
还有一点奇怪的是,“ShaderUtils”并没有在 THREE.js 文档中列出……http://mrdoob.github.com/three.js/docs/55/
发生了什么事?!
【问题讨论】:
标签: javascript three.js webgl