Title: [229014] trunk/Source/WebCore
Revision
229014
Author
[email protected]
Date
2018-02-26 05:37:55 -0800 (Mon, 26 Feb 2018)

Log Message

[WebVR][OpenVR] Retrieve displayId and the z-depth of eye view frustum
https://bugs.webkit.org/show_bug.cgi?id=182999

Reviewed by Žan Doberšek.

Retrieve the z-depth of the eye view frustum and the HMD unique id.
The unique identifier is generated by the VRPlatormManager whereas
we use the default values from the spec for the z-depth (those can
be changed by applications later via _javascript_).

Once this lands the only remaining data to be retrieved from VR
backends for VRDisplay is the pose (getPose() call) and the frame
data (getFrameData() call).

* Modules/webvr/VRDisplay.cpp:
(WebCore::VRDisplay::VRDisplay):
(WebCore::VRDisplay::displayId const): Deleted.
(WebCore::VRDisplay::displayName const): Deleted.
(WebCore::VRDisplay::depthNear const): Deleted.
(WebCore::VRDisplay::setDepthNear): Deleted.
(WebCore::VRDisplay::depthFar const): Deleted.
(WebCore::VRDisplay::setDepthFar): Deleted.
* Modules/webvr/VRDisplay.h:
(WebCore::VRDisplay::displayId const): Moved implementation from
source file.
(WebCore::VRDisplay::displayName const): Ditto.
(WebCore::VRDisplay::depthNear const):
(WebCore::VRDisplay::setDepthNear):
(WebCore::VRDisplay::depthFar const):
(WebCore::VRDisplay::setDepthFar):
* platform/vr/VRManager.cpp:
(WebCore::VRManager::generateUniqueDisplayIdentifier):
* platform/vr/VRManager.h:
* platform/vr/VRPlatformDisplay.h:
* platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
(WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (229013 => 229014)


--- trunk/Source/WebCore/ChangeLog	2018-02-26 13:22:26 UTC (rev 229013)
+++ trunk/Source/WebCore/ChangeLog	2018-02-26 13:37:55 UTC (rev 229014)
@@ -1,3 +1,42 @@
+2018-02-21  Sergio Villar Senin  <[email protected]>
+
+        [WebVR][OpenVR] Retrieve displayId and the z-depth of eye view frustum
+        https://bugs.webkit.org/show_bug.cgi?id=182999
+
+        Reviewed by Žan Doberšek.
+
+        Retrieve the z-depth of the eye view frustum and the HMD unique id.
+        The unique identifier is generated by the VRPlatormManager whereas
+        we use the default values from the spec for the z-depth (those can
+        be changed by applications later via _javascript_).
+
+        Once this lands the only remaining data to be retrieved from VR
+        backends for VRDisplay is the pose (getPose() call) and the frame
+        data (getFrameData() call).
+
+        * Modules/webvr/VRDisplay.cpp:
+        (WebCore::VRDisplay::VRDisplay):
+        (WebCore::VRDisplay::displayId const): Deleted.
+        (WebCore::VRDisplay::displayName const): Deleted.
+        (WebCore::VRDisplay::depthNear const): Deleted.
+        (WebCore::VRDisplay::setDepthNear): Deleted.
+        (WebCore::VRDisplay::depthFar const): Deleted.
+        (WebCore::VRDisplay::setDepthFar): Deleted.
+        * Modules/webvr/VRDisplay.h:
+        (WebCore::VRDisplay::displayId const): Moved implementation from
+        source file.
+        (WebCore::VRDisplay::displayName const): Ditto.
+        (WebCore::VRDisplay::depthNear const):
+        (WebCore::VRDisplay::setDepthNear):
+        (WebCore::VRDisplay::depthFar const):
+        (WebCore::VRDisplay::setDepthFar):
+        * platform/vr/VRManager.cpp:
+        (WebCore::VRManager::generateUniqueDisplayIdentifier):
+        * platform/vr/VRManager.h:
+        * platform/vr/VRPlatformDisplay.h:
+        * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
+        (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
+
 2018-02-26  Charlie Turner  <[email protected]>
 
         Fix build error with !LOG_DISABLED

Modified: trunk/Source/WebCore/Modules/webvr/VRDisplay.cpp (229013 => 229014)


--- trunk/Source/WebCore/Modules/webvr/VRDisplay.cpp	2018-02-26 13:22:26 UTC (rev 229013)
+++ trunk/Source/WebCore/Modules/webvr/VRDisplay.cpp	2018-02-26 13:37:55 UTC (rev 229014)
@@ -50,6 +50,7 @@
     m_capabilities = VRDisplayCapabilities::create(displayInfo.capabilityFlags);
     m_leftEyeParameters = VREyeParameters::create(displayInfo.eyeTranslation[VRPlatformDisplayInfo::EyeLeft], displayInfo.eyeFieldOfView[VRPlatformDisplayInfo::EyeLeft], displayInfo.renderSize);
     m_rightEyeParameters = VREyeParameters::create(displayInfo.eyeTranslation[VRPlatformDisplayInfo::EyeRight], displayInfo.eyeFieldOfView[VRPlatformDisplayInfo::EyeRight], displayInfo.renderSize);
+    m_displayId = displayInfo.displayIdentifier;
     m_displayName = displayInfo.displayName;
 }
 
@@ -84,16 +85,6 @@
     return eye == VREye::Left ? *m_leftEyeParameters : *m_rightEyeParameters;
 }
 
-unsigned VRDisplay::displayId() const
-{
-    return 0;
-}
-
-const String& VRDisplay::displayName() const
-{
-    return m_displayName;
-}
-
 bool VRDisplay::getFrameData(VRFrameData&) const
 {
     return false;
@@ -108,24 +99,6 @@
 {
 }
 
-double VRDisplay::depthNear() const
-{
-    return 0;
-}
-
-void VRDisplay::setDepthNear(double)
-{
-}
-
-double VRDisplay::depthFar() const
-{
-    return 0;
-}
-
-void VRDisplay::setDepthFar(double)
-{
-}
-
 long VRDisplay::requestAnimationFrame(Ref<RequestAnimationFrameCallback>&&)
 {
     return 0;

Modified: trunk/Source/WebCore/Modules/webvr/VRDisplay.h (229013 => 229014)


--- trunk/Source/WebCore/Modules/webvr/VRDisplay.h	2018-02-26 13:22:26 UTC (rev 229013)
+++ trunk/Source/WebCore/Modules/webvr/VRDisplay.h	2018-02-26 13:37:55 UTC (rev 229014)
@@ -59,8 +59,8 @@
 
     const VREyeParameters& getEyeParameters(VREye) const;
 
-    unsigned displayId() const;
-    const String& displayName() const;
+    const String& displayName() const { return m_displayName; }
+    uint32_t displayId() const { return m_displayId; }
 
     bool getFrameData(VRFrameData&) const;
 
@@ -67,10 +67,10 @@
     Ref<VRPose> getPose() const;
     void resetPose();
 
-    double depthNear() const;
-    void setDepthNear(double);
-    double depthFar() const;
-    void setDepthFar(double);
+    double depthNear() const { return m_depthNear; }
+    void setDepthNear(double depthNear) { m_depthNear = depthNear; }
+    double depthFar() const { return m_depthFar; }
+    void setDepthFar(double depthFar) { m_depthFar = depthFar; }
 
     long requestAnimationFrame(Ref<RequestAnimationFrameCallback>&&);
     void cancelAnimationFrame(unsigned);
@@ -107,6 +107,10 @@
     RefPtr<VRStageParameters> m_stageParameters;
 
     String m_displayName;
+    uint32_t m_displayId;
+
+    double m_depthNear { 0.01 }; // Default value from the specs.
+    double m_depthFar { 10000 }; // Default value from the specs.
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/vr/VRPlatformDisplay.h (229013 => 229014)


--- trunk/Source/WebCore/platform/vr/VRPlatformDisplay.h	2018-02-26 13:22:26 UTC (rev 229013)
+++ trunk/Source/WebCore/platform/vr/VRPlatformDisplay.h	2018-02-26 13:37:55 UTC (rev 229014)
@@ -47,6 +47,7 @@
     bool isConnected;
     bool isMounted;
     unsigned capabilityFlags;
+    uint32_t displayIdentifier;
 
     enum Eye { EyeLeft = 0, EyeRight, NumEyes };
     FloatPoint3D eyeTranslation[Eye::NumEyes];

Modified: trunk/Source/WebCore/platform/vr/openvr/VRPlatformDisplayOpenVR.cpp (229013 => 229014)


--- trunk/Source/WebCore/platform/vr/openvr/VRPlatformDisplayOpenVR.cpp	2018-02-26 13:22:26 UTC (rev 229013)
+++ trunk/Source/WebCore/platform/vr/openvr/VRPlatformDisplayOpenVR.cpp	2018-02-26 13:37:55 UTC (rev 229014)
@@ -27,11 +27,14 @@
 
 namespace WebCore {
 
+uint32_t VRPlatformDisplayOpenVR::s_displayIdentifier = 0;
+
 VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR(vr::IVRSystem* system, vr::IVRChaperone* chaperone, vr::IVRCompositor* compositor)
     : m_system(system)
     , m_chaperone(chaperone)
     , m_compositor(compositor)
 {
+    m_displayInfo.displayIdentifier = ++s_displayIdentifier;
     m_displayInfo.isConnected = m_system->IsTrackedDeviceConnected(vr::k_unTrackedDeviceIndex_Hmd);
 
     StringBuilder stringBuilder;

Modified: trunk/Source/WebCore/platform/vr/openvr/VRPlatformDisplayOpenVR.h (229013 => 229014)


--- trunk/Source/WebCore/platform/vr/openvr/VRPlatformDisplayOpenVR.h	2018-02-26 13:22:26 UTC (rev 229013)
+++ trunk/Source/WebCore/platform/vr/openvr/VRPlatformDisplayOpenVR.h	2018-02-26 13:37:55 UTC (rev 229014)
@@ -40,6 +40,8 @@
     void updateEyeParameters();
     void updateStageParameters();
 
+    static uint32_t s_displayIdentifier;
+
     vr::IVRSystem* m_system;
     vr::IVRChaperone* m_chaperone;
     vr::IVRCompositor* m_compositor;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to