setup.html 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <!DOCTYPE html><html lang="zh"><head>
  2. <meta charset="utf-8">
  3. <title>设置</title>
  4. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  5. <meta name="twitter:card" content="summary_large_image">
  6. <meta name="twitter:site" content="@threejs">
  7. <meta name="twitter:title" content="Three.js – 设置">
  8. <meta property="og:image" content="https://threejs.org/files/share.png">
  9. <link rel="shortcut icon" href="../../files/favicon_white.ico" media="(prefers-color-scheme: dark)">
  10. <link rel="shortcut icon" href="../../files/favicon.ico" media="(prefers-color-scheme: light)">
  11. <link rel="stylesheet" href="../resources/lesson.css">
  12. <link rel="stylesheet" href="../resources/lang.css">
  13. <script type="importmap">
  14. {
  15. "imports": {
  16. "three": "../../build/three.module.js"
  17. }
  18. }
  19. </script>
  20. <link rel="stylesheet" href="/manual/zh/lang.css">
  21. </head>
  22. <body>
  23. <div class="container">
  24. <div class="lesson-title">
  25. <h1>设置</h1>
  26. </div>
  27. <div class="lesson">
  28. <div class="lesson-main">
  29. <p>这是three.js系列文章的其中之一。
  30. 第一篇是<a href="fundamentals.html">关于three.js基础</a>。
  31. 如果你还没有阅读那你应该从那开始。</p>
  32. <p>在我们深入之前我们需要讨论一下设置你的电脑来开发。
  33. 尤其是,因为安全的原因,
  34. WebGL不能直接从你的硬件使用图片。意思是说
  35. 为了能开发你需要使用web服务。幸运的是
  36. web服务很容易设置和使用。</p>
  37. <p>首先如果你喜欢你可以从<a href="https://github.com/gfxfundamentals/threejsfundamentals/archive/gh-pages.zip">这个链接</a>
  38. 下载整个网站。
  39. 一旦下载完成双击文件来解压。</p>
  40. <p>下一步下载一个简单的web服务。</p>
  41. <p>如果你更喜欢有用户界面的web服务,这有一个
  42. <a href="https://greggman.github.io/servez">Servez</a></p>
  43. <p></p><div class="threejs_image border">
  44. <img class="" src="../resources/servez.gif">
  45. </div>
  46. <p></p>
  47. <p>只要将他指向你解压的文件夹,点击"Start",然后
  48. 打开你的浏览器的<a href="http://localhost:8080/"><code class="notranslate" translate="no">http://localhost:8080/</code></a>或者
  49. 你想浏览例子打开<a href="http://localhost:8080/threejs"><code class="notranslate" translate="no">http://localhost:8080/threejs</code></a>。</p>
  50. <p>点击stop或者推出Servez来停止服务。
  51. 如果你更喜欢命令行(我就是),另一种方法是使用<a href="https://nodejs.org">node.js</a>。
  52. 下载,安装,然后打开一个command prompt / console / terminal窗口。 如果你是在Windows上安装程序会添加一个特别的"Node Command Prompt"所以使用它。</p>
  53. <p>然后安装<a href="https://github.com/greggman/servez-cli"><code class="notranslate" translate="no">servez</code></a>通过输入</p>
  54. <pre class="prettyprint showlinemods notranslate notranslate" translate="no">npm -g install servez
  55. </pre><p>如果你是OSX使用</p>
  56. <pre class="prettyprint showlinemods notranslate notranslate" translate="no">sudo npm -g install servez
  57. </pre><p>一旦你输入完成</p>
  58. <pre class="prettyprint showlinemods notranslate notranslate" translate="no">servez path/to/folder/where/you/unzipped/files
  59. </pre><p>它会打印像这样的东西</p>
  60. <p></p><div class="threejs_image ">
  61. <img class="" src="../resources/servez-response.png">
  62. </div>
  63. <p></p>
  64. <p>然后在你的浏览器中打开<a href="http://localhost:8080/"><code class="notranslate" translate="no">http://localhost:8080/</code></a>。</p>
  65. <p>如果你没有指定路径那么servez会使用当前的文件夹。</p>
  66. <p>如果这些都不是你的选择
  67. <a href="https://stackoverflow.com/questions/12905426/what-is-a-faster-alternative-to-pythons-servez-or-simplehttpserver">这里有很多其他的服务可供选择</a>。</p>
  68. <p>现在你有了服务我们可以移步到<a href="textures.html">纹理</a>.</p>
  69. </div>
  70. </div>
  71. </div>
  72. <script src="../resources/prettify.js"></script>
  73. <script src="../resources/lesson.js"></script>
  74. </body></html>