这很奇怪。。
我在我的目录'brick'中下载了three.js:
这会产生一个子目录:
brick/three.js/
当我去
brick/three.js/examples
并在 Firefox 中打开文件
brick/three.js/examples/webgl_geometry_cube.html
一个漂亮的旋转立方体出现了。然后当我将它(即brick/three.js/examples/webgl_geometry_cube.html)复制到目录'brick'并相应地更改新brick/webgl_geometry_cube.html中的three.min.js引用时,brick/webgl_geometry_cube。 html 不起作用 - 当我在 Firefox 中打开它时,没有立方体出现。
让我更具体地说明 webgl_geometry_cube.html 中的three.min.js 引用。brick/three.js/examples/webgl_geometry_cube.html 的顶部如下所示:
<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js webgl - geometry - cube</title>
<meta charset="utf-8">
<style>
body {
margin: 0px;
background-color: #000000;
overflow: hidden;
}
</style>
</head>
<body>
<script src="../build/three.min.js"></script>
<script>
var camera, scene, renderer;
var mesh;
当我将它复制到
brick/webgl_geometry_cube.html
我换行
<script src="../build/three.min.js"></script>
到:
<script src="three.js/build/three.min.js"></script>
我通过打开来验证这个新参考确实有效
brick/webgl_geometry_cube.html
在 Firefox 中,选择“查看源代码”,并在源代码中遵循对 three.min.js 的引用。如果我看到three.min.js(我就是)的源代码,我很高兴。
但是为什么在 Firefox 中打开移动的文件时没有立方体旋转呢?我很困惑。webgl_geometry_cube.html 中似乎没有任何其他依赖于路径的引用。webgl_geometry_cube.html 的完整源代码可以在这里看到:
Github 上的 webgl_geometry_cube.html
另外,我该如何调试呢?我可以对代码进行某种单步执行,以查看两个文件在执行过程中的不同之处吗?