dom / latest / xrcompositionlayer / miplevels.html /

XRCompositionLayer.mipLevels

The read-only mipLevels property of the XRCompositionLayer interface is a layer's number of mip levels in the color and texture data. See also Mipmap on Wikipedia.

The desired number of mip levels can be specified when creating layers. However, if the user agent can't create the requested number, it can create less. Use mipLevels to determine the actual number of mip levels for a layer.

The viewPixelWidth and viewPixelHeight need to be powers of two as they get successively halved at each mip level.

Value

A number equal or smaller to the requested mip levels when a layer has been created.

Examples

Getting a layer's mip levels

The mipLevels property indicates the actual number of mip levels that have been created. In this example, the desired number of 5 mip levels that had been requested for an XRQuadLayer could be full-filled.

let xrGLBinding = new XRWebGLBinding(session, gl);
let quadLayer = xrGLBinding.createQuadLayer({
  space: refSpace,
  viewPixelHeight: 512,
  viewPixelWidth: 512,
  width: 1.0,
  height: 1.0,
  mipLevels: 5,
  transform : new XRRigidTransform({ /* ... */}),
});

quadLayer.mipLevels; // 5

Specifications

No specification found

No specification data found for api.XRCompositionLayer.mipLevels.
Check for problems with this page or contribute a missing spec_url to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

Browser compatibility

No compatibility data found for api.XRCompositionLayer.mipLevels.
Check for problems with this page or contribute missing data to mdn/browser-compat-data.

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/XRCompositionLayer/mipLevels