diff --git a/webxrlayers-1.bs b/webxrlayers-1.bs index 21d9274..f265951 100755 --- a/webxrlayers-1.bs +++ b/webxrlayers-1.bs @@ -627,20 +627,30 @@ The aspectRatio attribute controls th description of the parameters of a cylinder layer +
+ +To validate cylinder layer parameters given a float |radius|, a float |centralAngle|, and a float |aspectRatio|, the user agent MUST run the following steps: + 1. If |radius|, |centralAngle|, or |aspectRatio| is not finite, throw a {{TypeError}} and abort these steps. + 1. If |radius| is less than 0, throw a {{TypeError}} and abort these steps. + 1. If |centralAngle| is less than 0 or greater than 2π, throw a {{TypeError}} and abort these steps. + 1. If |aspectRatio| is less than or equal to 0, throw a {{TypeError}} and abort these steps. + +
+
-When initializing an {{XRCylinderLayer}} |layer| with an {{XRCylinderLayerInit}} |init|, the user agent MUST run the following steps: - 1. Initialize |layer|'s {{XRCylinderLayer/radius}} to |init|'s {{XRCylinderLayerInit/radius}}. - 1. Initialize |layer|'s {{XRCylinderLayer/centralAngle}} to |init|'s {{XRCylinderLayerInit/centralAngle}}. - 1. Initialize |layer|'s {{XRCylinderLayer/aspectRatio}} to |init|'s {{XRCylinderLayerInit/aspectRatio}}. - 1. Let |layer|'s {{XRCylinderLayer/space}} be the |init|'s {{XRLayerInit/space}}. +When initializing an {{XRCylinderLayer}} |layer| with an {{XRSpace}} |space|, an {{XRRigidTransform}} or null |transform|, floats |radius|, |centralAngle|, and |aspectRatio|, and a boolean |isStatic|, the user agent MUST run the following steps: + 1. Initialize |layer|'s {{XRCylinderLayer/radius}} to |radius|. + 1. Initialize |layer|'s {{XRCylinderLayer/centralAngle}} to |centralAngle|. + 1. Initialize |layer|'s {{XRCylinderLayer/aspectRatio}} to |aspectRatio|. + 1. Let |layer|'s {{XRCylinderLayer/space}} be |space|. 1. Initialize |layer|'s {{XRCylinderLayer/transform}} as follows:
-
If |init|'s {{XRCylinderLayerInit/transform}} is set -
Let |layer|'s {{XRCylinderLayer/transform}} be a [=new=] {{XRRigidTransform}} in the [=relevant realm=] of |layer| initialized with {{XRRigidTransform/position}} and {{XRRigidTransform/orientation}} of |init|'s {{XRCylinderLayerInit/transform}}. +
If |transform| is not null +
Let |layer|'s {{XRCylinderLayer/transform}} be a [=new=] {{XRRigidTransform}} in the [=relevant realm=] of |layer| initialized with |transform|'s {{XRRigidTransform/position}} and {{XRRigidTransform/orientation}}.
Otherwise
Let |layer|'s {{XRCylinderLayer/transform}} be a [=new=] {{XRRigidTransform}} in the [=relevant realm=] of |layer| initialized with a {{DOMPointInit}} position of { x: 0.0, y: 0.0, z: 0.0, w: 1.0 }.
- 1. Initialize |layer|'s [=XRCompositionLayer/isStatic=] to |init|'s {{XRLayerInit/isStatic}} + 1. Initialize |layer|'s [=XRCompositionLayer/isStatic=] to |isStatic|.
@@ -673,7 +683,7 @@ The transform attribute sets and retu {{XREquirectLayer/space}}. The {{XREquirectLayer/transform}} attribute and the {{XREquirectLayer/space}} establish the spatial relationship of the layer within the user’s physical environment. -The radius attribute is the non-negative radius in meters of the sphere. Values of zero or infinity are treated as an infinite sphere. +The radius attribute is the non-negative radius in meters of the sphere. A value of zero is treated as an infinite sphere. Setting {{XREquirectLayer/radius}} to a value less than 0 will set it to 0. @@ -700,20 +710,27 @@ When setting the space on an equirect layer with {{XRSpace}} |
-When initializing an {{XREquirectLayer}} |layer| with an {{XREquirectLayerInit}} |init|, the user agent MUST run the following steps: - 1. Initialize |layer|'s {{XREquirectLayer/radius}} to |init|'s {{XREquirectLayerInit/radius}}. - 1. Initialize |layer|'s {{XREquirectLayer/centralHorizontalAngle}} to |init|'s {{XREquirectLayerInit/centralHorizontalAngle}}. - 1. Initialize |layer|'s {{XREquirectLayer/upperVerticalAngle}} to |init|'s {{XREquirectLayerInit/upperVerticalAngle}}. - 1. Initialize |layer|'s {{XREquirectLayer/lowerVerticalAngle}} to |init|'s {{XREquirectLayerInit/lowerVerticalAngle}}. - 1. Let |layer|'s {{XREquirectLayer/space}} be the |init|'s {{XRLayerInit/space}}. +When initializing an {{XREquirectLayer}} |layer| with an {{XRSpace}} |space|, an {{XRRigidTransform}} or null |transform|, floats |radius|, |centralHorizontalAngle|, |upperVerticalAngle|, and |lowerVerticalAngle|, and a boolean |isStatic|, the user agent MUST run the following steps: + 1. Initialize |layer|'s {{XREquirectLayer/radius}} to |radius|. + 1. If |layer|'s {{XREquirectLayer/radius}} is less than 0, set it to 0. + 1. Initialize |layer|'s {{XREquirectLayer/centralHorizontalAngle}} to |centralHorizontalAngle|. + 1. If |layer|'s {{XREquirectLayer/centralHorizontalAngle}} is less than 0, set it to 0. + 1. If |layer|'s {{XREquirectLayer/centralHorizontalAngle}} is greater than 2π, set it to 2π. + 1. Initialize |layer|'s {{XREquirectLayer/upperVerticalAngle}} to |upperVerticalAngle|. + 1. If |layer|'s {{XREquirectLayer/upperVerticalAngle}} is less than -π/2, set it to -π/2. + 1. If |layer|'s {{XREquirectLayer/upperVerticalAngle}} is greater than π/2, set it to π/2. + 1. Initialize |layer|'s {{XREquirectLayer/lowerVerticalAngle}} to |lowerVerticalAngle|. + 1. If |layer|'s {{XREquirectLayer/lowerVerticalAngle}} is less than -π/2, set it to -π/2. + 1. If |layer|'s {{XREquirectLayer/lowerVerticalAngle}} is greater than π/2, set it to π/2. + 1. Let |layer|'s {{XREquirectLayer/space}} be |space|. 1. Initialize |layer|'s {{XREquirectLayer/transform}} as follows:
-
If |init|'s {{XREquirectLayerInit/transform}} is set -
Let |layer|'s {{XREquirectLayer/transform}} be a [=new=] {{XRRigidTransform}} in the [=relevant realm=] of |layer| initialized with {{XRRigidTransform/position}} and {{XRRigidTransform/orientation}} of |init|'s {{XREquirectLayerInit/transform}}. +
If |transform| is not null +
Let |layer|'s {{XREquirectLayer/transform}} be a [=new=] {{XRRigidTransform}} in the [=relevant realm=] of |layer| initialized with |transform|'s {{XRRigidTransform/position}} and {{XRRigidTransform/orientation}}.
Otherwise
Let |layer|'s {{XREquirectLayer/transform}} be a [=new=] {{XRRigidTransform}} in the [=relevant realm=] of |layer|.
- 1. Initialize |layer|'s [=XRCompositionLayer/isStatic=] to |init|'s {{XRLayerInit/isStatic}} + 1. Initialize |layer|'s [=XRCompositionLayer/isStatic=] to |isStatic|.
@@ -1543,9 +1560,10 @@ When this method is invoked, the user agent MUST run the following steps: 1. If |session|'s {{XRSession/ended}} value is true, throw {{InvalidStateError}} and abort these steps. 1. If |context| is lost, throw {{InvalidStateError}} and abort these steps. 1. If |layout| is {{XRLayerLayout/"default"}}, throw {{TypeError}} and abort these steps. + 1. Run [=validate cylinder layer parameters=] with |init|'s {{XRCylinderLayerInit/radius}}, {{XRCylinderLayerInit/centralAngle}}, and {{XRCylinderLayerInit/aspectRatio}}. 1. Let |layer| be a [=new=] {{XRCylinderLayer}} in the [=relevant realm=] of [=this=]. 1. Run [=initialize a composition layer=] on |layer| with |session| and |context|. - 1. Run [=initialize a cylinder layer=] with |layer| and |init|. + 1. Run [=initialize a cylinder layer=] with |layer|, |init|'s {{XRLayerInit/space}}, {{XRCylinderLayerInit/transform}}, {{XRCylinderLayerInit/radius}}, {{XRCylinderLayerInit/centralAngle}}, {{XRCylinderLayerInit/aspectRatio}}, and {{XRLayerInit/isStatic}}. 1. let |layout| be the result of [=determine the layout attribute|determining the layout attribute=] with |init|'s {{XRLayerInit/textureType}}, |context| and |init|'s {{XRLayerInit/layout}}. 1. Initialize |layer|'s {{XRCompositionLayer/layout}} to |layout|. 1. Initialize |layer|'s {{XRCompositionLayer/needsRedraw}} to true. @@ -1572,7 +1590,7 @@ When this method is invoked, the user agent MUST run the following steps: 1. If |init|'s {{XRLayerInit/space}} has a [=XRReferenceSpace/type=] of {{XRReferenceSpaceType/"viewer"}}, throw {{TypeError}} and abort these steps. 1. Let |layer| be a [=new=] {{XREquirectLayer}} in the [=relevant realm=] of [=this=]. 1. Run [=initialize a composition layer=] on |layer| with |session| and |context|. - 1. Run [=initialize a equirect layer=] with |layer| and |init|. + 1. Run [=initialize a equirect layer=] with |layer|, |init|'s {{XRLayerInit/space}}, {{XREquirectLayerInit/transform}}, {{XREquirectLayerInit/radius}}, {{XREquirectLayerInit/centralHorizontalAngle}}, {{XREquirectLayerInit/upperVerticalAngle}}, {{XREquirectLayerInit/lowerVerticalAngle}}, and {{XRLayerInit/isStatic}}. 1. let |layout| be the result of [=determine the layout attribute|determining the layout attribute=] with |init|'s {{XRLayerInit/textureType}}, |context| and |init|'s {{XRLayerInit/layout}}. 1. Initialize |layer|'s {{XRCompositionLayer/layout}} to |layout|. 1. Initialize |layer|'s {{XRCompositionLayer/needsRedraw}} to true. @@ -2033,13 +2051,13 @@ When this method is invoked, the user agent MUST run the following steps: 1. If |session| was not created with "[=feature descriptor/layers=]" enabled, throw a {{NotSupportedError}} and abort these steps. 1. If |session|'s {{XRSession/ended}} value is true, throw {{InvalidStateError}} and abort these steps. 1. If |init|'s {{XRMediaLayerInit/layout}} is {{XRLayerLayout/"default"}}, throw a {{TypeError}} and abort these steps. + 1. Let |aspectRatio| be |init|'s {{XRMediaCylinderLayerInit/aspectRatio}} if the member is present and not null; otherwise, let |aspectRatio| be the result of [=calculate the aspect ratio=] with |video| and |init|'s {{XRMediaLayerInit/layout}}. + 1. Run [=validate cylinder layer parameters=] with |init|'s {{XRMediaCylinderLayerInit/radius}}, {{XRMediaCylinderLayerInit/centralAngle}}, and |aspectRatio|. 1. Let |layer| be a [=new=] {{XRCylinderLayer}} in the [=relevant realm=] of [=this=]. 1. Run [=initialize a composition layer=] on |layer| with |session|. 1. Initialize |layer|'s [=XRCompositionLayer/media=] to |video|. 1. Initialize |layer|'s {{XRCompositionLayer/needsRedraw}} to false. - 1. Let |aspectRatio| be the result of [=calculate the aspect ratio=] with |video| and |init|'s {{XRMediaLayerInit/layout}}. - 1. If |init|'s {{XRMediaCylinderLayerInit/aspectRatio}} is undefined, set {{XRMediaCylinderLayerInit/aspectRatio}} to |aspectRatio|. - 1. Run [=initialize a cylinder layer=] with |layer| and |init|. + 1. Run [=initialize a cylinder layer=] with |layer|, |init|'s {{XRMediaLayerInit/space}}, {{XRMediaCylinderLayerInit/transform}}, {{XRMediaCylinderLayerInit/radius}}, {{XRMediaCylinderLayerInit/centralAngle}}, |aspectRatio|, and false. 1. If the [=XR Compositor=] knows that it will be unable to create the resources for the |layer| for any reason, throw an {{OperationError}} and abort these steps. 1. return |layer|. @@ -2054,13 +2072,13 @@ When this method is invoked, the user agent MUST run the following steps: 1. If |session| was not created with "[=feature descriptor/layers=]" enabled, throw a {{NotSupportedError}} and abort these steps. 1. If |session|'s {{XRSession/ended}} value is true, throw {{InvalidStateError}} and abort these steps. 1. If |init|'s {{XRMediaLayerInit/layout}} is {{XRLayerLayout/"default"}}, throw a {{TypeError}} and abort these steps. - 1. If |init|'s {{XRLayerInit/space}} is not an instance of type {{XRReferenceSpace}}, throw {{InvalidStateError}} and abort these steps. - 1. If |init|'s {{XRLayerInit/space}} has a [=XRReferenceSpace/type=] of {{XRReferenceSpaceType/"viewer"}}, throw {{InvalidStateError}} and abort these steps. + 1. If |init|'s {{XRMediaLayerInit/space}} is not an instance of type {{XRReferenceSpace}}, throw {{InvalidStateError}} and abort these steps. + 1. If |init|'s {{XRMediaLayerInit/space}} has a [=XRReferenceSpace/type=] of {{XRReferenceSpaceType/"viewer"}}, throw {{InvalidStateError}} and abort these steps. 1. Let |layer| be a [=new=] {{XREquirectLayer}} in the [=relevant realm=] of [=this=]. 1. Run [=initialize a composition layer=] on |layer| with |session|. 1. Initialize |layer|'s [=XRCompositionLayer/media=] to |video|. 1. Initialize |layer|'s {{XRCompositionLayer/needsRedraw}} to false. - 1. Run [=initialize a equirect layer=] with |layer| and |init|. + 1. Run [=initialize a equirect layer=] with |layer|, |init|'s {{XRMediaLayerInit/space}}, {{XRMediaEquirectLayerInit/transform}}, {{XRMediaEquirectLayerInit/radius}}, {{XRMediaEquirectLayerInit/centralHorizontalAngle}}, {{XRMediaEquirectLayerInit/upperVerticalAngle}}, {{XRMediaEquirectLayerInit/lowerVerticalAngle}}, and false. 1. If the [=XR Compositor=] knows that it will be unable to create the resources for the |layer| for any reason, throw an {{OperationError}} and abort these steps. 1. return |layer|. @@ -2292,6 +2310,7 @@ New features: Changes: +- Define initialization validation for cylinder and equirect layers (GitHub #333) - fixed small issue in layout algo and in clearing of opaque textures (GitHub #257) - Clarify aspectratio (GitHub #256) - Added some language about the layer memory allocation (GitHub #255)