Skip to content

XRSessionInit has generic types and is not future proof #791

@cabanier

Description

@cabanier

XRSessionInit takes a sequence of DOMString but wouldn't it be better if it takes an enumeration? There's a predefined set of allowed values so it seems it should be restricted to those.

I think XRSessionInit should also be made a bit more forward looking. We might want to ask for additional features (anchors, meshing, hit testing, etc) and this would be a good place to do it.
What if we change the IDL to the following:

enum XRSpaceType {
  "local",
  "local-floor",
  "bounded-floor",
  "unbounded"
};

dictionary XRSessionFeatures {
  XRSpaceType space;
}

dictionary XRSessionInit {
  XRSessionFeatures requiredFeatures;
  XRSessionFeatures optionalFeatures;
};

Future extension spec can then extend the 'XRSessionFeatures' object with more than just a simple value ie

dictionary XRWorldMeshFeatures {
  readonly attribute FrozenArray<DOMPointReadOnly> boundsGeometry; 
  XRWorldMeshQuality quality;
};

dictionary XRSessionFeatures {
  XRSpaceType space;
  XRWorldMeshFeatures worldMesh;
};

Any thoughts @toji ?

Sorry that I didn't chime in earlier. I was on PTO in early July and didn't notice all these changes going in.

Metadata

Metadata

Assignees

Labels

fixed by pending PRA PR that is in review will resolve this issue.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions