From 6ef1fa4618e08426b874529619a66adbd3d1fcf0 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 12:07:59 +0100 Subject: unslug ja: move --- files/ja/web/api/vrlayerinit/index.html | 91 +++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 files/ja/web/api/vrlayerinit/index.html (limited to 'files/ja/web/api/vrlayerinit/index.html') diff --git a/files/ja/web/api/vrlayerinit/index.html b/files/ja/web/api/vrlayerinit/index.html new file mode 100644 index 0000000000..b0edd0d577 --- /dev/null +++ b/files/ja/web/api/vrlayerinit/index.html @@ -0,0 +1,91 @@ +--- +title: VRLayer +slug: Web/API/VRLayer +translation_of: Web/API/VRLayerInit +--- +
{{APIRef("WebVR API")}}{{SeeCompatTable}}
+ +

WebVR API の VRLayer インターフェイス (ディクショナリ)は,VRHMDへ表示したいコンテンツレイヤー( {{domxref("HTMLCanvasElement")}} または {{domxref("OffscreenCanvas")}})を表します。

+ +

{{domxref("VRDisplay.requestPresent()")}} メソッドを使うことでレイヤーを表示することができます。

+ +

プロパティ

+ +
+
{{domxref("VRLayer.leftBounds")}}
+
{{domxref("VRDisplay")}} に表示されるキャンバスの左側テクスチャ境界を定義します。
+
{{domxref("VRLayer.rightBounds")}}
+
{{domxref("VRDisplay")}} に表示されるキャンバスの右側テクスチャ境界を定義します。
+
{{domxref("VRLayer.source")}}
+
{{domxref("VRDisplay")}} に表示されるコンテンツの対象となるキャンバスを定義します。
+
+ +

+ +
// currently returns an empty array
+var layers = vrDisplay.getLayers();
+
+if(navigator.getVRDisplays) {
+  console.log('WebVR 1.1 supported');
+  // Then get the displays attached to the computer
+  navigator.getVRDisplays().then(function(displays) {
+    // If a display is available, use it to present the scene
+    if(displays.length > 0) {
+      vrDisplay = displays[0];
+      console.log('Display found');
+      // Starting the presentation when the button is clicked: It can only be called in response to a user gesture
+      btn.addEventListener('click', function() {
+        vrDisplay.requestPresent([{ source: canvas }]).then(function() {
+          console.log('Presenting to WebVR display');
+
+          // Here it returns an array of VRLayerInit objects
+          var layers = vrDisplay.getLayers();
+
+          ...
+        });
+      });
+    }
+  });
+}
+ +

{{domxref("VRLayerInit")}} objects look something like this:

+ +
{
+  leftBounds : [ ... ],
+  rightBounds: [ ... ],
+  source: canvasReference
+}
+ +
+

Note: The canvasReference refers to the {{htmlelement("canvas")}} element itself, not the WebGL context associated with the canvas. The other two members are arrays

+
+ +

仕様

+ + + + + + + + + + + + + + +
仕様ステータス備考
{{SpecName('WebVR', '#interface-vrlayer', 'VRLayer')}}{{Spec2('WebVR')}}初回定義
+ +

ブラウザの互換性

+ +

{{Compat("api.VRLayerInit")}}

+ +
+ +

参照

+ + -- cgit v1.2.3-54-g00ecf