Skip to content

Commit be036d5

Browse files
authored
Merge pull request #284 from cabanier/opacity
Add support for opacity to XRCompositionLayer
2 parents eed0701 + 877e316 commit be036d5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎webxrlayers-1.bs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ XRCompositionLayer defines a set of common attributes and behaviors across certa
321321

322322
attribute boolean blendTextureSourceAlpha;
323323
attribute boolean? chromaticAberrationCorrection;
324+
attribute float opacity;
324325
readonly attribute unsigned long mipLevels;
325326

326327
readonly attribute boolean needsRedraw;
@@ -338,6 +339,9 @@ enable optical chromatic aberration correction for the layer. If the user agent
338339
should return <code>null</code> on getting, and setting should be a <code>no-op</code>.
339340
If the {{XRCompositionLayer/chromaticAberrationCorrection}} was changed, it will take effect at the next {{XRFrame}}.
340341

342+
The <dfn attribute for="XRCompositionLayer">opacity</dfn> attribute sets the opacity that is applied to the pixels of the layer. The [=XR Compositor=] MUST multiply each pixel (in premultiplied space) by this value.
343+
{{XRCompositionLayer/opacity}} is <code>1.0</code> by default. Setting {{XRCompositionLayer/opacity}} to a value less than <code>0</code> will set it to <code>0</code> and setting it to a value higher than <code>1.0</code> will set it to <code>1.0</code>.
344+
341345
The <dfn attribute for="XRCompositionLayer">needsRedraw</dfn> attribute signals that the {{XRCompositionLayer}} should be
342346
rerendered in the next [=XR animation frame=]. It MAY be set when [=the underlying resources of a layer are lost=] or
343347
when the [=XR Compositor=] can no longer reproject the layer. Failing to redraw the content in the next [=XR animation frame=]
@@ -373,6 +377,7 @@ or a {{WebGL2RenderingContext}} |context|, the user agent MUST run the following
373377
<dt> Otherwise
374378
<dd> Set [=this=] {{XRCompositionLayer/chromaticAberrationCorrection}} to <code>null</code>.
375379
</dl>
380+
1. Set [=this=] {{XRCompositionLayer/opacity}} to <code>1.0</code>.
376381

377382
</div>
378383

@@ -2023,4 +2028,3 @@ Changes:
20232028
- Moved foveation to projection layer (<a href="https://github.com/immersive-web/layers/pull/247">GitHub #247</a>)
20242029
- Rename textureLayers to textureArrayLength (<a href="https://github.com/immersive-web/layers/pull/242">GitHub #242</a>)
20252030
- Clarify that opaque textures are always initialized at the start of the frame (<a href="https://github.com/immersive-web/layers/pull/234">GitHub #234</a>)
2026-

0 commit comments

Comments
 (0)