Skip to content

Latest commit

 

History

History
70 lines (50 loc) · 3.79 KB

File metadata and controls

70 lines (50 loc) · 3.79 KB
title slug l10n
VREyeParameters
Web/API/VREyeParameters
sourceCommit
579788ba8fe61b6c7dddaec09dee7b33d6548a4d

{{APIRef("WebVR API")}}{{Deprecated_Header}}{{Non-standard_Header}}

VREyeParametersWebVR API のインターフェイスで、指定した目のためにシーンを正しくレンダリングするためのすべての情報(視界の情報を含む)を表します。

Note

このインターフェイスは古い WebVR API の一部でした。これは WebXR 機器 API に置き換えられました。

このインターフェイスは {{domxref("VRDisplay.getEyeParameters()")}} メソッドを通じてアクセスできます。

Warning

このインターフェイスは、ビューおよび投影行列を計算するために使用すべきではありません。ハードウェアの互換性を可能な限り確保するために、{{domxref("VRFrameData")}} で指定された行列を使用してください。

インスタンスプロパティ

  • {{domxref("VREyeParameters.offset")}} {{Deprecated_Inline}} {{ReadOnlyInline}} {{Non-standard_Inline}}
    • : ユーザーの目と目の間の中心点から目の中心までのオフセットを、メートル単位で表します。
  • {{domxref("VREyeParameters.fieldOfView")}} {{Deprecated_Inline}} {{ReadOnlyInline}} {{Non-standard_Inline}}
    • : ユーザーの瞳孔間距離 (IPD) の調整により変化する、目の現在の視野角を記述します。
  • {{domxref("VREyeParameters.renderWidth")}} {{Deprecated_Inline}} {{ReadOnlyInline}} {{Non-standard_Inline}}
    • : それぞれの目のビューポートの推奨レンダーターゲットの幅をピクセル単位で記述します。
  • {{domxref("VREyeParameters.renderHeight")}} {{Deprecated_Inline}} {{ReadOnlyInline}} {{Non-standard_Inline}}
    • : それぞれの目のビューポートの推奨レンダーターゲットの高さをピクセル単位で記述します。

navigator.getVRDisplays().then((displays) => {
  // If a display is available, use it to present the scene
  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", () => {
    vrDisplay.requestPresent([{ source: canvas }]).then(() => {
      console.log("Presenting to WebVR display");

      // Set the canvas size to the size of the vrDisplay viewport

      const leftEye = vrDisplay.getEyeParameters("left");
      const rightEye = vrDisplay.getEyeParameters("right");

      canvas.width = Math.max(leftEye.renderWidth, rightEye.renderWidth) * 2;
      canvas.height = Math.max(leftEye.renderHeight, rightEye.renderHeight);

      drawVRScene();
    });
  });
});

仕様書

このインターフェイスは古い WebVR API の一部であり、これは WebXR 機器 API で置き枯れられました。標準規格になる見込みはありません。

すべてのブラウザーが新しい WebXR API を実装するまで、 A-FrameBabylon.jsThree.js などのフレームワークを使用するか、ポリフィルを使用することが、すべてのブラウザーで動作する WebXR アプリを開発する上で推奨されます。[1]

ブラウザーの互換性

{{Compat}}

関連情報