2
0

How-to-create-VR-content.html 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <!DOCTYPE html>
  2. <html lang="ko">
  3. <head>
  4. <meta charset="utf-8">
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. <h1>VR 컨텐츠를 만드는 방법[name]</h1>
  11. <p>
  12. 이 가이드에서는 three.js를 통한 웹 기반 VR 앱의 기본 컴포넌트를 만드는 방법을 알려드리겠습니다.
  13. </p>
  14. <h2>작업 순서</h2>
  15. <p>
  16. 먼저, [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/VRButton.js VRButton.js]
  17. 를 프로젝트에 불러옵니다.
  18. </p>
  19. <code>
  20. import { VRButton } from 'three/addons/webxr/VRButton.js';
  21. </code>
  22. <p>
  23. *VRButton.createButton()*은 두 가지 중요한 일을 합니다: VR에서 활용이 가능한 버튼을 만듭니다. 그리고 유저가 버튼을 누르면
  24. VR 세션을 실행시킵니다. 다음 코드를 삽입하기만 하면 됩니다.
  25. </p>
  26. <code>
  27. document.body.appendChild( VRButton.createButton( renderer ) );
  28. </code>
  29. <p>
  30. 다음으로, *WebGLRenderer* 인스턴스에게 XR 렌더링을 허용해줘야합니다.
  31. </p>
  32. <code>
  33. renderer.xr.enabled = true;
  34. </code>
  35. <p>
  36. 마지막으로, 자주 쓰이는 *window.requestAnimationFrame()* 기능을 활용할 수 없기 때문에, 애니메이션 루프를 수정해주어야 합니다.
  37. VR 프로젝트에서는 [page:WebGLRenderer.setAnimationLoop setAnimationLoop]를 사용합니다.
  38. 가장 간소화된 코드는 다음과 같습니다:
  39. </p>
  40. <code>
  41. renderer.setAnimationLoop( function () {
  42. renderer.render( scene, camera );
  43. } );
  44. </code>
  45. <h2>다음 절차</h2>
  46. <p>
  47. 실행을 위한 작업 절차와 관련된 공식 WebVR 예제를 확인하세요.<br /><br />
  48. [example:webxr_vr_ballshooter WebXR / VR / ballshooter]<br />
  49. [example:webxr_vr_cubes WebXR / VR / cubes]<br />
  50. [example:webxr_vr_dragging WebXR / VR / dragging]<br />
  51. [example:webxr_vr_paint WebXR / VR / paint]<br />
  52. [example:webxr_vr_panorama_depth WebXR / VR / panorama_depth]<br />
  53. [example:webxr_vr_panorama WebXR / VR / panorama]<br />
  54. [example:webxr_vr_rollercoaster WebXR / VR / rollercoaster]<br />
  55. [example:webxr_vr_sandbox WebXR / VR / sandbox]<br />
  56. [example:webxr_vr_sculpt WebXR / VR / sculpt]<br />
  57. [example:webxr_vr_video WebXR / VR / video]
  58. </p>
  59. </body>
  60. </html>