You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

79 lines
2.3 KiB

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8">
<base href="../../../" />
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
<h1>VR 컨텐츠를 만드는 방법[name]</h1>
<p>
이 가이드에서는 three.js를 통한 웹 기반 VR 앱의 기본 컴포넌트를 만드는 방법을 알려드리겠습니다.
</p>
<h2>작업 순서</h2>
<p>
먼저, [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/VRButton.js VRButton.js]
를 프로젝트에 불러옵니다.
</p>
<code>
import { VRButton } from 'three/addons/webxr/VRButton.js';
</code>
<p>
*VRButton.createButton()*은 두 가지 중요한 일을 합니다: VR에서 활용이 가능한 버튼을 만듭니다. 그리고 유저가 버튼을 누르면
VR 세션을 실행시킵니다. 다음 코드를 삽입하기만 하면 됩니다.
</p>
<code>
document.body.appendChild( VRButton.createButton( renderer ) );
</code>
<p>
다음으로, *WebGLRenderer* 인스턴스에게 XR 렌더링을 허용해줘야합니다.
</p>
<code>
renderer.xr.enabled = true;
</code>
<p>
마지막으로, 자주 쓰이는 *window.requestAnimationFrame()* 기능을 활용할 수 없기 때문에, 애니메이션 루프를 수정해주어야 합니다.
VR 프로젝트에서는 [page:WebGLRenderer.setAnimationLoop setAnimationLoop]를 사용합니다.
가장 간소화된 코드는 다음과 같습니다:
</p>
<code>
renderer.setAnimationLoop( function () {
renderer.render( scene, camera );
} );
</code>
<h2>다음 절차</h2>
<p>
실행을 위한 작업 절차와 관련된 공식 WebVR 예제를 확인하세요.<br /><br />
[example:webxr_vr_ballshooter WebXR / VR / ballshooter]<br />
[example:webxr_vr_cubes WebXR / VR / cubes]<br />
[example:webxr_vr_dragging WebXR / VR / dragging]<br />
[example:webxr_vr_paint WebXR / VR / paint]<br />
[example:webxr_vr_panorama_depth WebXR / VR / panorama_depth]<br />
[example:webxr_vr_panorama WebXR / VR / panorama]<br />
[example:webxr_vr_rollercoaster WebXR / VR / rollercoaster]<br />
[example:webxr_vr_sandbox WebXR / VR / sandbox]<br />
[example:webxr_vr_sculpt WebXR / VR / sculpt]<br />
[example:webxr_vr_video WebXR / VR / video]
</p>
</body>
</html>