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