|
@@ -10,29 +10,27 @@
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
- <h1>[name]</h1>
|
|
|
+ <h1>如何创建VR内容([name])</h1>
|
|
|
<br />
|
|
|
|
|
|
<p>
|
|
|
- This guide provides a brief overview of the basic components of a web-based VR application
|
|
|
- made with three.js.
|
|
|
+ 本指南简要介绍了使用three.js来制作的基于Web的VR应用程序的基本组件。
|
|
|
</p>
|
|
|
|
|
|
- <h2>Workflow</h2>
|
|
|
+ <h2>工作流程</h2>
|
|
|
|
|
|
<p>
|
|
|
- First, you have to include [link:https://github.com/mrdoob/three.js/blob/master/examples/js/vr/WebVR.js WebVR.js]
|
|
|
- into your project.
|
|
|
+ 首先,你需要将[link:https://github.com/mrdoob/three.js/blob/master/examples/js/vr/WebVR.js WebVR.js]
|
|
|
+ 包含到你的项目中。
|
|
|
</p>
|
|
|
|
|
|
<code>
|
|
|
<script src="/path/to/WebVR.js"></script>
|
|
|
</code>
|
|
|
|
|
|
- <p>
|
|
|
- *WEBVR.createButton()* does two important things: It creates a button which indicates
|
|
|
- VR compatibility. Besides, it initiates a VR session if the user activates the button. The only thing you have
|
|
|
- to do is to add the following line of code to your app.
|
|
|
+ <p>*WEBVR.createButton()*做了两件重要的事情:首先,它创建了一个按钮,指示了VR的兼容性;
|
|
|
+ 此外,若用户激活了这个按钮,则它将开启一个VR会话。
|
|
|
+ 你所要做的唯一一件事情,便是把下面的这一行代码加入到你的应用程序里。
|
|
|
</p>
|
|
|
|
|
|
<code>
|
|
@@ -40,7 +38,7 @@ document.body.appendChild( WEBVR.createButton( renderer ) );
|
|
|
</code>
|
|
|
|
|
|
<p>
|
|
|
- Next, you have to tell your instance of *WebGLRenderer* to enable VR rendering.
|
|
|
+ 接下来,你需要告诉你的*WebGLRenderer*实例来启用VR渲染。
|
|
|
</p>
|
|
|
|
|
|
<code>
|
|
@@ -48,9 +46,10 @@ renderer.vr.enabled = true;
|
|
|
</code>
|
|
|
|
|
|
<p>
|
|
|
- Finally, you have to adjust your animation loop since we can't use our well known
|
|
|
- *window.requestAnimationFrame()* function. For VR projects we use [page:WebGLRenderer.setAnimationLoop setAnimationLoop].
|
|
|
- The minimal code looks like this:
|
|
|
+ 最后,你需要调整你的动画循环,因为在这里我们不能使用我们所熟知的
|
|
|
+ *window.requestAnimationFrame()*函数来更新场景。对于VR项目来说,我们使用的是[page:WebGLRenderer.setAnimationLoop setAnimationLoop]。
|
|
|
+
|
|
|
+ 简短的示例代码如下:
|
|
|
</p>
|
|
|
|
|
|
<code>
|
|
@@ -61,10 +60,11 @@ renderer.setAnimationLoop( function () {
|
|
|
} );
|
|
|
</code>
|
|
|
|
|
|
- <h2>Next Steps</h2>
|
|
|
+ <h2>接下来的步骤</h2>
|
|
|
|
|
|
<p>
|
|
|
- Have a look at one of the official WebVR examples to see this workflow in action.<br /><br />
|
|
|
+ 请查看官方示例中与WebVR相关的示例,了解这一工作流程的实际使用、运行情况。
|
|
|
+ <br /><br />
|
|
|
|
|
|
[example:webvr_ballshooter WebVR / ballshoter]<br />
|
|
|
[example:webvr_cubes WebVR / cubes]<br />
|
|
@@ -81,4 +81,4 @@ renderer.setAnimationLoop( function () {
|
|
|
|
|
|
</body>
|
|
|
|
|
|
-</html>
|
|
|
+</html>
|