setup.html 4.2 KB

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