iwer 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1902,35 +1902,15 @@ class XRView {
1902
1902
  * This source code is licensed under the MIT license found in the
1903
1903
  * LICENSE file in the root directory of this source tree.
1904
1904
  */
1905
- var XRHandJoint;
1906
- (function (XRHandJoint) {
1907
- XRHandJoint["Wrist"] = "wrist";
1908
- XRHandJoint["ThumbMetacarpal"] = "thumb-metacarpal";
1909
- XRHandJoint["ThumbPhalanxProximal"] = "thumb-phalanx-proximal";
1910
- XRHandJoint["ThumbPhalanxDistal"] = "thumb-phalanx-distal";
1911
- XRHandJoint["ThumbTip"] = "thumb-tip";
1912
- XRHandJoint["IndexFingerMetacarpal"] = "index-finger-metacarpal";
1913
- XRHandJoint["IndexFingerPhalanxProximal"] = "index-finger-phalanx-proximal";
1914
- XRHandJoint["IndexFingerPhalanxIntermediate"] = "index-finger-phalanx-intermediate";
1915
- XRHandJoint["IndexFingerPhalanxDistal"] = "index-finger-phalanx-distal";
1916
- XRHandJoint["IndexFingerTip"] = "index-finger-tip";
1917
- XRHandJoint["MiddleFingerMetacarpal"] = "middle-finger-metacarpal";
1918
- XRHandJoint["MiddleFingerPhalanxProximal"] = "middle-finger-phalanx-proximal";
1919
- XRHandJoint["MiddleFingerPhalanxIntermediate"] = "middle-finger-phalanx-intermediate";
1920
- XRHandJoint["MiddleFingerPhalanxDistal"] = "middle-finger-phalanx-distal";
1921
- XRHandJoint["MiddleFingerTip"] = "middle-finger-tip";
1922
- XRHandJoint["RingFingerMetacarpal"] = "ring-finger-metacarpal";
1923
- XRHandJoint["RingFingerPhalanxProximal"] = "ring-finger-phalanx-proximal";
1924
- XRHandJoint["RingFingerPhalanxIntermediate"] = "ring-finger-phalanx-intermediate";
1925
- XRHandJoint["RingFingerPhalanxDistal"] = "ring-finger-phalanx-distal";
1926
- XRHandJoint["RingFingerTip"] = "ring-finger-tip";
1927
- XRHandJoint["PinkyFingerMetacarpal"] = "pinky-finger-metacarpal";
1928
- XRHandJoint["PinkyFingerPhalanxProximal"] = "pinky-finger-phalanx-proximal";
1929
- XRHandJoint["PinkyFingerPhalanxIntermediate"] = "pinky-finger-phalanx-intermediate";
1930
- XRHandJoint["PinkyFingerPhalanxDistal"] = "pinky-finger-phalanx-distal";
1931
- XRHandJoint["PinkyFingerTip"] = "pinky-finger-tip";
1932
- })(XRHandJoint || (XRHandJoint = {}));
1933
- class XRHand extends Map {
1905
+ const PRIVATE$f = Symbol('@immersive-web-emulation-runtime/xr-joint-space');
1906
+ class XRJointSpace extends XRSpace {
1907
+ constructor(jointName, parentSpace, offsetMatrix) {
1908
+ super(parentSpace, offsetMatrix);
1909
+ this[PRIVATE$f] = { jointName, radius: 0 };
1910
+ }
1911
+ get jointName() {
1912
+ return this[PRIVATE$f].jointName;
1913
+ }
1934
1914
  }
1935
1915
 
1936
1916
  /**
@@ -1939,14 +1919,27 @@ class XRHand extends Map {
1939
1919
  * This source code is licensed under the MIT license found in the
1940
1920
  * LICENSE file in the root directory of this source tree.
1941
1921
  */
1942
- const PRIVATE$f = Symbol('@immersive-web-emulation-runtime/xr-joint-space');
1943
- class XRJointSpace extends XRSpace {
1944
- constructor(jointName, parentSpace, offsetMatrix) {
1945
- super(parentSpace, offsetMatrix);
1946
- this[PRIVATE$f] = { jointName, radius: 0 };
1922
+ const PRIVATE$e = Symbol('@immersive-web-emulation-runtime/xr-pose');
1923
+ class XRPose {
1924
+ constructor(transform, emulatedPosition = false, linearVelocity = undefined, angularVelocity = undefined) {
1925
+ this[PRIVATE$e] = {
1926
+ transform,
1927
+ emulatedPosition,
1928
+ linearVelocity,
1929
+ angularVelocity,
1930
+ };
1947
1931
  }
1948
- get jointName() {
1949
- return this[PRIVATE$f].jointName;
1932
+ get transform() {
1933
+ return this[PRIVATE$e].transform;
1934
+ }
1935
+ get emulatedPosition() {
1936
+ return this[PRIVATE$e].emulatedPosition;
1937
+ }
1938
+ get linearVelocity() {
1939
+ return this[PRIVATE$e].linearVelocity;
1940
+ }
1941
+ get angularVelocity() {
1942
+ return this[PRIVATE$e].angularVelocity;
1950
1943
  }
1951
1944
  }
1952
1945
 
@@ -1956,242 +1949,239 @@ class XRJointSpace extends XRSpace {
1956
1949
  * This source code is licensed under the MIT license found in the
1957
1950
  * LICENSE file in the root directory of this source tree.
1958
1951
  */
1959
- const pinchHandPose = {
1960
- jointTransforms: {
1961
- wrist: {
1962
- offsetMatrix: [
1963
- 0.9060805439949036, -0.1844543218612671, 0.3807799518108368, 0,
1964
- -0.08027800172567368, 0.8086723685264587, 0.5827555656433105, 0,
1965
- -0.4154181182384491, -0.5585917234420776, 0.7179155349731445, 0,
1966
- -0.06867414712905884, -0.009423808194696903, 0.10627774149179459, 1,
1967
- ],
1968
- radius: 0.021460847929120064,
1969
- },
1970
- 'thumb-metacarpal': {
1971
- offsetMatrix: [
1972
- -0.5012241005897522, -0.8650535345077515, -0.0213695727288723, 0,
1973
- 0.7415963411331177, -0.4421543478965759, 0.5045139193534851, 0,
1974
- -0.44587990641593933, 0.23702676594257355, 0.8631392121315002, 0,
1975
- -0.032122574746608734, -0.01196830440312624, 0.07194234430789948, 1,
1976
- ],
1977
- radius: 0.019382517784833908,
1978
- },
1979
- 'thumb-phalanx-proximal': {
1980
- offsetMatrix: [
1981
- -0.3175753057003021, -0.9460570216178894, -0.06419729441404343, 0,
1982
- 0.8958902955055237, -0.32153913378715515, 0.30658137798309326, 0,
1983
- -0.3106854259967804, 0.03984907269477844, 0.9496771097183228, 0,
1984
- -0.017625702545046806, -0.01967475935816765, 0.04387917369604111, 1,
1985
- ],
1986
- radius: 0.01228295173496008,
1987
- },
1988
- 'thumb-phalanx-distal': {
1989
- offsetMatrix: [
1990
- -0.4944636821746826, -0.8691971898078918, 0.001086252392269671, 0,
1991
- 0.8307800889015198, -0.4722411036491394, 0.2946045398712158, 0,
1992
- -0.25555649399757385, 0.14657381176948547, 0.9556186199188232, 0,
1993
- -0.007126678712666035, -0.021021386608481407, 0.011786630377173424, 1,
1994
- ],
1995
- radius: 0.009768804535269737,
1996
- },
1997
- 'thumb-tip': {
1998
- offsetMatrix: [
1999
- -0.4944636821746826, -0.8691971898078918, 0.001086252392269671, 0,
2000
- 0.8307800889015198, -0.4722411036491394, 0.2946045398712158, 0,
2001
- -0.25555649399757385, 0.14657381176948547, 0.9556186199188232, 0,
2002
- 0.0003423091256991029, -0.024528030306100845, -0.011410919018089771, 1,
2003
- ],
2004
- radius: 0.008768804371356964,
2005
- },
2006
- 'index-finger-metacarpal': {
2007
- offsetMatrix: [
2008
- 0.9060805439949036, -0.1844543218612671, 0.3807799518108368, 0,
2009
- -0.08027800172567368, 0.8086723685264587, 0.5827555656433105, 0,
2010
- -0.4154181182384491, -0.5585917234420776, 0.7179155349731445, 0,
2011
- -0.038037415593862534, -0.0020236473064869642, 0.07626739144325256, 1,
2012
- ],
2013
- radius: 0.021228281781077385,
2014
- },
2015
- 'index-finger-phalanx-proximal': {
2016
- offsetMatrix: [
2017
- 0.7986818552017212, -0.35985732078552246, 0.48229536414146423, 0,
2018
- 0.538311243057251, 0.7854709625244141, -0.30537736415863037, 0,
2019
- -0.2689369022846222, 0.5035246014595032, 0.8210577368736267, 0,
2020
- -0.006869405973702669, 0.033938243985176086, 0.04206443578004837, 1,
2021
- ],
2022
- radius: 0.010295259766280651,
2023
- },
2024
- 'index-finger-phalanx-intermediate': {
2025
- offsetMatrix: [
2026
- 0.8285930156707764, -0.32672837376594543, 0.4546217918395996, 0,
2027
- 0.5577570199966431, 0.4116027057170868, -0.7207564115524292, 0,
2028
- 0.04836784675717354, 0.8507823944091797, 0.5232869386672974, 0,
2029
- 0.0033306588884443045, 0.014840902760624886, 0.010923954658210278, 1,
2030
- ],
2031
- radius: 0.00853810179978609,
2032
- },
2033
- 'index-finger-phalanx-distal': {
2034
- offsetMatrix: [
2035
- 0.8412464261054993, -0.35794928669929504, 0.4051857888698578, 0,
2036
- 0.5139996409416199, 0.29711154103279114, -0.8046918511390686, 0,
2037
- 0.16765329241752625, 0.8852096796035767, 0.4339304566383362, 0,
2038
- 0.0021551470272243023, -0.0058362227864563465, -0.0017938464879989624,
2039
- 1,
2040
- ],
2041
- radius: 0.007636196445673704,
2042
- },
2043
- 'index-finger-tip': {
2044
- offsetMatrix: [
2045
- 0.8412464261054993, -0.35794928669929504, 0.4051857888698578, 0,
2046
- 0.5139996409416199, 0.29711154103279114, -0.8046918511390686, 0,
2047
- 0.16765329241752625, 0.8852096796035767, 0.4339304566383362, 0,
2048
- -0.00131594471167773, -0.025222131982445717, -0.012442642822861671, 1,
2049
- ],
2050
- radius: 0.006636196281760931,
2051
- },
2052
- 'middle-finger-metacarpal': {
2053
- offsetMatrix: [
2054
- 0.9060805439949036, -0.1844543218612671, 0.3807799518108368, 0,
2055
- -0.08027800172567368, 0.8086723685264587, 0.5827555656433105, 0,
2056
- -0.4154181182384491, -0.5585917234420776, 0.7179155349731445, 0,
2057
- -0.05395089089870453, 0.003063359996303916, 0.07402937114238739, 1,
2058
- ],
2059
- radius: 0.021231964230537415,
2060
- },
2061
- 'middle-finger-phalanx-proximal': {
2062
- offsetMatrix: [
2063
- 0.9187911748886108, -0.1530158370733261, 0.36387869715690613, 0,
2064
- 0.038666240870952606, 0.9522662162780762, 0.302808940410614, 0,
2065
- -0.3928440511226654, -0.26414817571640015, 0.8808513283729553, 0,
2066
- -0.02717282809317112, 0.04162866622209549, 0.03678669035434723, 1,
2067
- ],
2068
- radius: 0.01117393933236599,
2069
- },
2070
- 'middle-finger-phalanx-intermediate': {
2071
- offsetMatrix: [
2072
- 0.9228746294975281, -0.12856416404247284, 0.36300456523895264, 0,
2073
- 0.14524033665657043, 0.9892153143882751, -0.01890045404434204, 0,
2074
- -0.3566599190235138, 0.07016586512327194, 0.9315956234931946, 0,
2075
- -0.01030921470373869, 0.05296773463487625, -0.0010256498353555799, 1,
2076
- ],
2077
- radius: 0.008030958473682404,
2078
- },
2079
- 'middle-finger-phalanx-distal': {
2080
- offsetMatrix: [
2081
- 0.9325166344642639, -0.040404170751571655, 0.35885775089263916, 0,
2082
- 0.06836572289466858, 0.995502769947052, -0.0655682161450386, 0,
2083
- -0.3545948565006256, 0.08567725121974945, 0.9310863614082336, 0,
2084
- -0.0004833847051486373, 0.05103470757603645, -0.026690717786550522, 1,
2085
- ],
2086
- radius: 0.007629410829395056,
2087
- },
2088
- 'middle-finger-tip': {
2089
- offsetMatrix: [
2090
- 0.9325166344642639, -0.040404170751571655, 0.35885775089263916, 0,
2091
- 0.06836572289466858, 0.995502769947052, -0.0655682161450386, 0,
2092
- -0.3545948565006256, 0.08567725121974945, 0.9310863614082336, 0,
2093
- 0.008158999495208263, 0.05004044249653816, -0.050120558589696884, 1,
2094
- ],
2095
- radius: 0.006629410665482283,
2096
- },
2097
- 'ring-finger-metacarpal': {
2098
- offsetMatrix: [
2099
- 0.9060805439949036, -0.1844543218612671, 0.3807799518108368, 0,
2100
- -0.08027800172567368, 0.8086723685264587, 0.5827555656433105, 0,
2101
- -0.4154181182384491, -0.5585917234420776, 0.7179155349731445, 0,
2102
- -0.06732909381389618, 0.007902119308710098, 0.07209732383489609, 1,
2103
- ],
2104
- radius: 0.019088275730609894,
2105
- },
2106
- 'ring-finger-phalanx-proximal': {
2107
- offsetMatrix: [
2108
- 0.9391821026802063, -0.027994679287075996, 0.34227466583251953, 0,
2109
- -0.18282271921634674, 0.8029410243034363, 0.5673282742500305, 0,
2110
- -0.2907087206840515, -0.5954000353813171, 0.7489906549453735, 0,
2111
- -0.047129884362220764, 0.03806127607822418, 0.032147664576768875, 1,
2112
- ],
2113
- radius: 0.00992213748395443,
2114
- },
2115
- 'ring-finger-phalanx-intermediate': {
2116
- offsetMatrix: [
2117
- 0.9249380826950073, 0.03699534013867378, 0.3783116042613983, 0,
2118
- -0.12898847460746765, 0.9667453765869141, 0.2208271026611328, 0,
2119
- -0.3575615882873535, -0.25304901599884033, 0.8989526629447937, 0,
2120
- -0.03579339757561684, 0.06127955764532089, 0.002939916681498289, 1,
2121
- ],
2122
- radius: 0.007611672393977642,
2123
- },
2124
- 'ring-finger-phalanx-distal': {
2125
- offsetMatrix: [
2126
- 0.9001164436340332, 0.03983335196971893, 0.4338230490684509, 0,
2127
- -0.09662467986345291, 0.9892624020576477, 0.10964841395616531, 0,
2128
- -0.4247973561286926, -0.14061418175697327, 0.8943013548851013, 0,
2129
- -0.026291755959391594, 0.06800390034914017, -0.02094830758869648, 1,
2130
- ],
2131
- radius: 0.007231088820844889,
2132
- },
2133
- 'ring-finger-tip': {
2134
- offsetMatrix: [
2135
- 0.9001164436340332, 0.03983335196971893, 0.4338230490684509, 0,
2136
- -0.09662467986345291, 0.9892624020576477, 0.10964841395616531, 0,
2137
- -0.4247973561286926, -0.14061418175697327, 0.8943013548851013, 0,
2138
- -0.016345610842108727, 0.07300511747598648, -0.04263874143362045, 1,
2139
- ],
2140
- radius: 0.0062310886569321156,
2141
- },
2142
- 'pinky-finger-metacarpal': {
2143
- offsetMatrix: [
2144
- 0.8769711852073669, 0.31462907791137695, 0.36322021484375, 0,
2145
- -0.4506046175956726, 0.801031768321991, 0.39408499002456665, 0,
2146
- -0.16696058213710785, -0.5092697143554688, 0.8442559838294983, 0,
2147
- -0.07460174709558487, 0.0062340241856873035, 0.06756893545389175, 1,
2148
- ],
2149
- radius: 0.01808827556669712,
2150
- },
2151
- 'pinky-finger-phalanx-proximal': {
2152
- offsetMatrix: [
2153
- 0.9498357176780701, 0.1553308218717575, 0.2714462876319885, 0,
2154
- -0.3019258379936218, 0.6817675232887268, 0.6663586497306824, 0,
2155
- -0.08155745267868042, -0.7148879170417786, 0.694466233253479, 0,
2156
- -0.06697750836610794, 0.029482364654541016, 0.02902858518064022, 1,
2157
- ],
2158
- radius: 0.008483353070914745,
2159
- },
2160
- 'pinky-finger-phalanx-intermediate': {
2161
- offsetMatrix: [
2162
- 0.9214097261428833, 0.27928245067596436, 0.2701927423477173, 0,
2163
- -0.3670244514942169, 0.8538867831230164, 0.36901235580444336, 0,
2164
- -0.12765564024448395, -0.43917882442474365, 0.8892839550971985, 0,
2165
- -0.06447203457355499, 0.05144399777054787, 0.0076942890882492065, 1,
2166
- ],
2167
- radius: 0.0067641944624483585,
2168
- },
2169
- 'pinky-finger-phalanx-distal': {
2170
- offsetMatrix: [
2171
- 0.9038633704185486, 0.23618005216121674, 0.3567195236682892, 0,
2172
- -0.3532794713973999, 0.8823202252388, 0.3109731376171112, 0,
2173
- -0.24129553139209747, -0.4070987403392792, 0.8809353709220886, 0,
2174
- -0.06187915802001953, 0.060364335775375366, -0.010368337854743004, 1,
2175
- ],
2176
- radius: 0.0064259846694767475,
2177
- },
2178
- 'pinky-finger-tip': {
2179
- offsetMatrix: [
2180
- 0.9038633704185486, 0.23618005216121674, 0.3567195236682892, 0,
2181
- -0.3532794713973999, 0.8823202252388, 0.3109731376171112, 0,
2182
- -0.24129553139209747, -0.4070987403392792, 0.8809353709220886, 0,
2183
- -0.056796226650476456, 0.07042007893323898, -0.02921444922685623, 1,
2184
- ],
2185
- radius: 0.005425984505563974,
2186
- },
2187
- },
2188
- gripOffsetMatrix: [
2189
- 0.08027800917625427, -0.8086723685264587, -0.5827556252479553, 0,
2190
- -0.4154181480407715, -0.5585916638374329, 0.7179154753684998, 0,
2191
- -0.9060805439949036, 0.1844543218612671, -0.3807799518108368, 0,
2192
- -0.038054611533880234, -0.002910431008785963, 0.03720742464065552, 1,
2193
- ],
1952
+ const PRIVATE$d = Symbol('@immersive-web-emulation-runtime/xr-joint-pose');
1953
+ class XRJointPose extends XRPose {
1954
+ constructor(transform, radius, emulatedPosition = false, linearVelocity = undefined, angularVelocity = undefined) {
1955
+ super(transform, emulatedPosition, linearVelocity, angularVelocity);
1956
+ this[PRIVATE$d] = { radius };
1957
+ }
1958
+ get radius() {
1959
+ return this[PRIVATE$d].radius;
1960
+ }
1961
+ }
1962
+
1963
+ /**
1964
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
1965
+ *
1966
+ * This source code is licensed under the MIT license found in the
1967
+ * LICENSE file in the root directory of this source tree.
1968
+ */
1969
+ class PolyfillDOMPointReadOnly {
1970
+ constructor(x = 0, y = 0, z = 0, w = 1) {
1971
+ this.x = x;
1972
+ this.y = y;
1973
+ this.z = z;
1974
+ this.w = w;
1975
+ Object.freeze(this);
1976
+ }
1977
+ static fromPoint(other) {
1978
+ return new PolyfillDOMPointReadOnly(other.x, other.y, other.z, other.w);
1979
+ }
1980
+ matrixTransform(_matrix) {
1981
+ // Implement matrix transformation logic here
1982
+ // This is a placeholder implementation
1983
+ return new PolyfillDOMPointReadOnly();
1984
+ }
1985
+ toJSON() {
1986
+ // Implement toJSON logic here
1987
+ // This is a placeholder implementation
1988
+ return { x: this.x, y: this.y, z: this.z, w: this.w };
1989
+ }
1990
+ }
1991
+ const DOMPointReadOnly = typeof globalThis.DOMPointReadOnly !== 'undefined'
1992
+ ? globalThis.DOMPointReadOnly
1993
+ : PolyfillDOMPointReadOnly;
1994
+
1995
+ /**
1996
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
1997
+ *
1998
+ * This source code is licensed under the MIT license found in the
1999
+ * LICENSE file in the root directory of this source tree.
2000
+ */
2001
+ const PRIVATE$c = Symbol('@immersive-web-emulation-runtime/xr-rigid-transform');
2002
+ class XRRigidTransform {
2003
+ constructor(position, orientation) {
2004
+ // Default values
2005
+ const defaultPosition = fromValues$2(0, 0, 0);
2006
+ const defaultOrientation = create();
2007
+ this[PRIVATE$c] = {
2008
+ matrix: create$3(),
2009
+ position: position
2010
+ ? fromValues$2(position.x, position.y, position.z)
2011
+ : defaultPosition,
2012
+ orientation: orientation
2013
+ ? normalize(create(), fromValues(orientation.x, orientation.y, orientation.z, orientation.w))
2014
+ : defaultOrientation,
2015
+ inverse: null,
2016
+ };
2017
+ this.updateMatrix();
2018
+ }
2019
+ updateMatrix() {
2020
+ fromRotationTranslation(this[PRIVATE$c].matrix, this[PRIVATE$c].orientation, this[PRIVATE$c].position);
2021
+ }
2022
+ get matrix() {
2023
+ return this[PRIVATE$c].matrix;
2024
+ }
2025
+ get position() {
2026
+ const pos = this[PRIVATE$c].position;
2027
+ return new DOMPointReadOnly(pos[0], pos[1], pos[2], 1);
2028
+ }
2029
+ get orientation() {
2030
+ const ori = this[PRIVATE$c].orientation;
2031
+ return new DOMPointReadOnly(ori[0], ori[1], ori[2], ori[3]);
2032
+ }
2033
+ get inverse() {
2034
+ if (!this[PRIVATE$c].inverse) {
2035
+ const invMatrix = create$3();
2036
+ if (!invert(invMatrix, this[PRIVATE$c].matrix)) {
2037
+ throw new Error('Matrix is not invertible.');
2038
+ }
2039
+ // Decomposing the inverse matrix into position and orientation
2040
+ let invPosition = create$2();
2041
+ getTranslation(invPosition, invMatrix);
2042
+ let invOrientation = create();
2043
+ getRotation(invOrientation, invMatrix);
2044
+ // Creating a new XRRigidTransform for the inverse
2045
+ this[PRIVATE$c].inverse = new XRRigidTransform(new DOMPointReadOnly(invPosition[0], invPosition[1], invPosition[2], 1), new DOMPointReadOnly(invOrientation[0], invOrientation[1], invOrientation[2], invOrientation[3]));
2046
+ // Setting the inverse of the inverse to be this transform
2047
+ this[PRIVATE$c].inverse[PRIVATE$c].inverse = this;
2048
+ }
2049
+ return this[PRIVATE$c].inverse;
2050
+ }
2051
+ }
2052
+
2053
+ /**
2054
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
2055
+ *
2056
+ * This source code is licensed under the MIT license found in the
2057
+ * LICENSE file in the root directory of this source tree.
2058
+ */
2059
+ const PRIVATE$b = Symbol('@immersive-web-emulation-runtime/xr-viewer-pose');
2060
+ class XRViewerPose extends XRPose {
2061
+ constructor(transform, views, emulatedPosition = false, linearVelocity = undefined, angularVelocity = undefined) {
2062
+ super(transform, emulatedPosition, linearVelocity, angularVelocity);
2063
+ this[PRIVATE$b] = {
2064
+ views: Object.freeze(views),
2065
+ };
2066
+ }
2067
+ get views() {
2068
+ return this[PRIVATE$b].views;
2069
+ }
2070
+ }
2071
+
2072
+ /**
2073
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
2074
+ *
2075
+ * This source code is licensed under the MIT license found in the
2076
+ * LICENSE file in the root directory of this source tree.
2077
+ */
2078
+ const PRIVATE$a = Symbol('@immersive-web-emulation-runtime/xr-frame');
2079
+ const spaceGlobalMatrix = create$3();
2080
+ const baseSpaceGlobalMatrix = create$3();
2081
+ const baseSpaceGlobalMatrixInverse = create$3();
2082
+ const getOffsetMatrix = (offsetMatrix, space, baseSpace) => {
2083
+ XRSpaceUtils.calculateGlobalOffsetMatrix(space, spaceGlobalMatrix);
2084
+ XRSpaceUtils.calculateGlobalOffsetMatrix(baseSpace, baseSpaceGlobalMatrix);
2085
+ invert(baseSpaceGlobalMatrixInverse, baseSpaceGlobalMatrix);
2086
+ multiply$1(offsetMatrix, baseSpaceGlobalMatrixInverse, spaceGlobalMatrix);
2194
2087
  };
2088
+ class XRFrame {
2089
+ constructor(session, id, active, animationFrame, predictedDisplayTime) {
2090
+ this[PRIVATE$a] = {
2091
+ session,
2092
+ id,
2093
+ active,
2094
+ animationFrame,
2095
+ predictedDisplayTime,
2096
+ tempMat4: create$3(),
2097
+ };
2098
+ }
2099
+ get session() {
2100
+ return this[PRIVATE$a].session;
2101
+ }
2102
+ get predictedDisplayTime() {
2103
+ return this[PRIVATE$a].predictedDisplayTime;
2104
+ }
2105
+ getPose(space, baseSpace) {
2106
+ if (!this[PRIVATE$a].active) {
2107
+ throw new DOMException('XRFrame access outside the callback that produced it is invalid.', 'InvalidStateError');
2108
+ }
2109
+ getOffsetMatrix(this[PRIVATE$a].tempMat4, space, baseSpace);
2110
+ const position = create$2();
2111
+ getTranslation(position, this[PRIVATE$a].tempMat4);
2112
+ const orientation = create();
2113
+ getRotation(orientation, this[PRIVATE$a].tempMat4);
2114
+ return new XRPose(new XRRigidTransform({ x: position[0], y: position[1], z: position[2], w: 1.0 }, {
2115
+ x: orientation[0],
2116
+ y: orientation[1],
2117
+ z: orientation[2],
2118
+ w: orientation[3],
2119
+ }), space[PRIVATE$l].emulated);
2120
+ }
2121
+ getViewerPose(referenceSpace) {
2122
+ if (!this[PRIVATE$a].animationFrame) {
2123
+ throw new DOMException('getViewerPose can only be called on XRFrame objects passed to XRSession.requestAnimationFrame callbacks.', 'InvalidStateError');
2124
+ }
2125
+ const session = this[PRIVATE$a].session;
2126
+ const device = session[PRIVATE$6].device;
2127
+ const pose = this.getPose(device.viewerSpace, referenceSpace);
2128
+ const eyes = session[PRIVATE$6].mode === XRSessionMode.Inline
2129
+ ? [XREye.None]
2130
+ : [XREye.Left, XREye.Right];
2131
+ const views = [];
2132
+ eyes.forEach((eye) => {
2133
+ const viewSpace = device.viewSpaces[eye];
2134
+ const viewPose = this.getPose(viewSpace, referenceSpace);
2135
+ const projectionMatrix = session[PRIVATE$6].getProjectionMatrix(eye);
2136
+ const view = new XRView(eye, new Float32Array(projectionMatrix), viewPose.transform, session);
2137
+ views.push(view);
2138
+ });
2139
+ return new XRViewerPose(pose.transform, views, false);
2140
+ }
2141
+ getJointPose(joint, baseSpace) {
2142
+ const xrPose = this.getPose(joint, baseSpace);
2143
+ const radius = joint[PRIVATE$f].radius;
2144
+ return new XRJointPose(xrPose.transform, radius, false);
2145
+ }
2146
+ fillJointRadii(jointSpaces, radii) {
2147
+ // converting from sequence type to array
2148
+ jointSpaces = Array.from(jointSpaces);
2149
+ if (!this[PRIVATE$a].active) {
2150
+ throw new DOMException('XRFrame access outside the callback that produced it is invalid.', 'InvalidStateError');
2151
+ }
2152
+ if (jointSpaces.length > radii.length) {
2153
+ throw new DOMException('The length of jointSpaces is larger than the number of elements in radii', 'TypeError');
2154
+ }
2155
+ let allValid = true;
2156
+ for (let offset = 0; offset < jointSpaces.length; offset++) {
2157
+ if (!jointSpaces[offset][PRIVATE$f].radius) {
2158
+ radii[offset] = NaN;
2159
+ allValid = false;
2160
+ }
2161
+ else {
2162
+ radii[offset] = jointSpaces[offset][PRIVATE$f].radius;
2163
+ }
2164
+ }
2165
+ return allValid;
2166
+ }
2167
+ fillPoses(spaces, baseSpace, transforms) {
2168
+ // converting from sequence type to array
2169
+ spaces = Array.from(spaces);
2170
+ if (!this[PRIVATE$a].active) {
2171
+ throw new DOMException('XRFrame access outside the callback that produced it is invalid.', 'InvalidStateError');
2172
+ }
2173
+ if (spaces.length * 16 > transforms.length) {
2174
+ throw new DOMException('The length of spaces multiplied by 16 is larger than the number of elements in transforms', 'TypeError');
2175
+ }
2176
+ spaces.forEach((space, i) => {
2177
+ getOffsetMatrix(this[PRIVATE$a].tempMat4, space, baseSpace);
2178
+ for (let j = 0; j < 16; j++) {
2179
+ transforms[i * 16 + j] = this[PRIVATE$a].tempMat4[j];
2180
+ }
2181
+ });
2182
+ return true;
2183
+ }
2184
+ }
2195
2185
 
2196
2186
  /**
2197
2187
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -2199,241 +2189,23 @@ const pinchHandPose = {
2199
2189
  * This source code is licensed under the MIT license found in the
2200
2190
  * LICENSE file in the root directory of this source tree.
2201
2191
  */
2202
- const pointHandPose = {
2203
- jointTransforms: {
2204
- wrist: {
2205
- offsetMatrix: [
2206
- 0.9340395331382751, -0.13936476409435272, 0.32885703444480896, 0,
2207
- -0.005510995630174875, 0.914999783039093, 0.40341612696647644, 0,
2208
- -0.3571262061595917, -0.37861889600753784, 0.8538784384727478, 0,
2209
- -0.05789132043719292, 0.01670890860259533, 0.11183350533246994, 1,
2210
- ],
2211
- radius: 0.021460847929120064,
2212
- },
2213
- 'thumb-metacarpal': {
2214
- offsetMatrix: [
2215
- 0.02145560085773468, -0.9978390336036682, 0.0621047280728817, 0,
2216
- 0.41311800479888916, 0.06541631370782852, 0.9083252549171448, 0,
2217
- -0.9104245901107788, 0.006167683284729719, 0.4136286973953247, 0,
2218
- -0.016488194465637207, 0.012708572670817375, 0.08862338215112686, 1,
2219
- ],
2220
- radius: 0.019382517784833908,
2221
- },
2222
- 'thumb-phalanx-proximal': {
2223
- offsetMatrix: [
2224
- 0.21270370483398438, -0.966137707233429, 0.14606566727161407, 0,
2225
- 0.49890995025634766, 0.2359165996313095, 0.8339261412620544, 0,
2226
- -0.8401462435722351, -0.10450579971075058, 0.5321959853172302, 0,
2227
- 0.013112368993461132, 0.012508046813309193, 0.07517509907484055, 1,
2228
- ],
2229
- radius: 0.01228295173496008,
2230
- },
2231
- 'thumb-phalanx-distal': {
2232
- offsetMatrix: [
2233
- 0.01653280481696129, -0.9986647963523865, 0.048943229019641876, 0,
2234
- 0.26313456892967224, 0.051570065319538116, 0.9633802771568298, 0,
2235
- -0.9646173715591431, -0.0030490627977997065, 0.26363563537597656, 0,
2236
- 0.04150351136922836, 0.016039609909057617, 0.05719054117798805, 1,
2237
- ],
2238
- radius: 0.009768804535269737,
2239
- },
2240
- 'thumb-tip': {
2241
- offsetMatrix: [
2242
- 0.01653280481696129, -0.9986647963523865, 0.048943229019641876, 0,
2243
- 0.26313456892967224, 0.051570065319538116, 0.9633802771568298, 0,
2244
- -0.9646173715591431, -0.0030490627977997065, 0.26363563537597656, 0,
2245
- 0.06548332422971725, 0.01683700829744339, 0.0516640841960907, 1,
2246
- ],
2247
- radius: 0.008768804371356964,
2248
- },
2249
- 'index-finger-metacarpal': {
2250
- offsetMatrix: [
2251
- 0.9340395331382751, -0.13936476409435272, 0.32885703444480896, 0,
2252
- -0.005510995630174875, 0.914999783039093, 0.40341612696647644, 0,
2253
- -0.3571262061595917, -0.37861889600753784, 0.8538784384727478, 0,
2254
- -0.02592567168176174, 0.019982583820819855, 0.08479326963424683, 1,
2255
- ],
2256
- radius: 0.021228281781077385,
2257
- },
2258
- 'index-finger-phalanx-proximal': {
2259
- offsetMatrix: [
2260
- 0.9063700437545776, -0.21756279468536377, 0.3621589243412018, 0,
2261
- 0.0970839336514473, 0.9415287375450134, 0.3226419687271118, 0,
2262
- -0.41117796301841736, -0.2572731077671051, 0.8744958639144897, 0,
2263
- -0.0015709538711234927, 0.043078210204839706, 0.034657616168260574, 1,
2264
- ],
2265
- radius: 0.010295259766280651,
2266
- },
2267
- 'index-finger-phalanx-intermediate': {
2268
- offsetMatrix: [
2269
- 0.9159826040267944, -0.1651475727558136, 0.36565208435058594, 0,
2270
- 0.09755707532167435, 0.9756820797920227, 0.1962820291519165, 0,
2271
- -0.3891757130622864, -0.14411886036396027, 0.9098196625709534, 0,
2272
- 0.014023927971720695, 0.052835866808891296, 0.0014903299743309617, 1,
2273
- ],
2274
- radius: 0.00853810179978609,
2275
- },
2276
- 'index-finger-phalanx-distal': {
2277
- offsetMatrix: [
2278
- 0.9378057718276978, -0.12329639494419098, 0.3245268166065216, 0,
2279
- 0.032558172941207886, 0.9619227051734924, 0.2713746726512909, 0,
2280
- -0.3456292748451233, -0.2439306229352951, 0.9061115384101868, 0,
2281
- 0.023482320830225945, 0.05633850023150444, -0.020621655508875847, 1,
2282
- ],
2283
- radius: 0.007636196445673704,
2284
- },
2285
- 'index-finger-tip': {
2286
- offsetMatrix: [
2287
- 0.9378057718276978, -0.12329639494419098, 0.3245268166065216, 0,
2288
- 0.032558172941207886, 0.9619227051734924, 0.2713746726512909, 0,
2289
- -0.3456292748451233, -0.2439306229352951, 0.9061115384101868, 0,
2290
- 0.03096788562834263, 0.06281610578298569, -0.040703095495700836, 1,
2291
- ],
2292
- radius: 0.006636196281760931,
2293
- },
2294
- 'middle-finger-metacarpal': {
2295
- offsetMatrix: [
2296
- 0.9340395331382751, -0.13936476409435272, 0.32885703444480896, 0,
2297
- -0.005510995630174875, 0.914999783039093, 0.40341612696647644, 0,
2298
- -0.3571262061595917, -0.37861889600753784, 0.8538784384727478, 0,
2299
- -0.04184452444314957, 0.022474845871329308, 0.08177298307418823, 1,
2300
- ],
2301
- radius: 0.021231964230537415,
2302
- },
2303
- 'middle-finger-phalanx-proximal': {
2304
- offsetMatrix: [
2305
- 0.9720265865325928, -0.08313076198101044, 0.21966552734375, 0,
2306
- 0.20477405190467834, 0.7580050826072693, -0.6192700862884521, 0,
2307
- -0.11502730846405029, 0.6469289064407349, 0.7538246512413025, 0,
2308
- -0.022107340395450592, 0.05035499855875969, 0.02970452979207039, 1,
2309
- ],
2310
- radius: 0.01117393933236599,
2311
- },
2312
- 'middle-finger-phalanx-intermediate': {
2313
- offsetMatrix: [
2314
- 0.9779140949249268, -0.07129573822021484, 0.19646917283535004, 0,
2315
- 0.1287083923816681, -0.5352076292037964, -0.8348574042320251, 0,
2316
- 0.1646735966205597, 0.8417060971260071, -0.5142109394073486, 0,
2317
- -0.017169542610645294, 0.022584279999136925, -0.00265491777099669, 1,
2318
- ],
2319
- radius: 0.008030958473682404,
2320
- },
2321
- 'middle-finger-phalanx-distal': {
2322
- offsetMatrix: [
2323
- 0.9774913787841797, -0.19657190144062042, 0.07661263644695282, 0,
2324
- -0.1924918293952942, -0.9796126484870911, -0.05749811604619026, 0,
2325
- 0.08635343611240387, 0.041456472128629684, -0.995401918888092, 0,
2326
- -0.02170622907578945, -0.0006043742760084569, 0.011511396616697311, 1,
2327
- ],
2328
- radius: 0.007629410829395056,
2329
- },
2330
- 'middle-finger-tip': {
2331
- offsetMatrix: [
2332
- 0.9774913787841797, -0.19657190144062042, 0.07661263644695282, 0,
2333
- -0.1924918293952942, -0.9796126484870911, -0.05749811604619026, 0,
2334
- 0.08635343611240387, 0.041456472128629684, -0.995401918888092, 0,
2335
- -0.02438267692923546, -0.0026927536819130182, 0.03627248480916023, 1,
2336
- ],
2337
- radius: 0.006629410665482283,
2338
- },
2339
- 'ring-finger-metacarpal': {
2340
- offsetMatrix: [
2341
- 0.9340395331382751, -0.13936476409435272, 0.32885703444480896, 0,
2342
- -0.005510995630174875, 0.914999783039093, 0.40341612696647644, 0,
2343
- -0.3571262061595917, -0.37861889600753784, 0.8538784384727478, 0,
2344
- -0.05944233387708664, 0.0264605600386858, 0.07478221505880356, 1,
2345
- ],
2346
- radius: 0.019088275730609894,
2347
- },
2348
- 'ring-finger-phalanx-proximal': {
2349
- offsetMatrix: [
2350
- 0.9842101335525513, 0.024470895528793335, 0.1753024309873581, 0,
2351
- 0.12200043350458145, 0.6237703561782837, -0.7720272541046143, 0,
2352
- -0.12824076414108276, 0.7812241315841675, 0.610936164855957, 0,
2353
- -0.04249368980526924, 0.0467497780919075, 0.027722163125872612, 1,
2354
- ],
2355
- radius: 0.00992213748395443,
2356
- },
2357
- 'ring-finger-phalanx-intermediate': {
2358
- offsetMatrix: [
2359
- 0.9941774606704712, 0.05949164181947708, 0.08983955532312393, 0,
2360
- 0.10504482686519623, -0.7208291888237, -0.6851072907447815, 0,
2361
- 0.024001073092222214, 0.6905553936958313, -0.7228817939758301, 0,
2362
- -0.0374927744269371, 0.016285063698887825, 0.0038980208337306976, 1,
2363
- ],
2364
- radius: 0.007611672393977642,
2365
- },
2366
- 'ring-finger-phalanx-distal': {
2367
- offsetMatrix: [
2368
- 0.9995742440223694, 0.01638498157262802, 0.02412819117307663, 0,
2369
- 0.007813597097992897, -0.9474818110466003, 0.31971633434295654, 0,
2370
- 0.028100071474909782, -0.31939181685447693, -0.9472070932388306, 0,
2371
- -0.038130562752485275, -0.0020653479732573032, 0.02310742810368538, 1,
2372
- ],
2373
- radius: 0.007231088820844889,
2374
- },
2375
- 'ring-finger-tip': {
2376
- offsetMatrix: [
2377
- 0.9995742440223694, 0.01638498157262802, 0.02412819117307663, 0,
2378
- 0.007813597097992897, -0.9474818110466003, 0.31971633434295654, 0,
2379
- 0.028100071474909782, -0.31939181685447693, -0.9472070932388306, 0,
2380
- -0.0390593595802784, 0.004176302347332239, 0.0466572530567646, 1,
2381
- ],
2382
- radius: 0.0062310886569321156,
2383
- },
2384
- 'pinky-finger-metacarpal': {
2385
- offsetMatrix: [
2386
- 0.9147363901138306, 0.3458845317363739, 0.20885537564754486, 0,
2387
- -0.3923271894454956, 0.8839452862739563, 0.2544005811214447, 0,
2388
- -0.09662359952926636, -0.3146490156650543, 0.9442773461341858, 0,
2389
- -0.06715242564678192, 0.024195827543735504, 0.07137546688318253, 1,
2390
- ],
2391
- radius: 0.01808827556669712,
2392
- },
2393
- 'pinky-finger-phalanx-proximal': {
2394
- offsetMatrix: [
2395
- 0.9613109827041626, 0.22439135611057281, 0.15977802872657776, 0,
2396
- 0.01002211682498455, 0.5511574745178223, -0.8343409299850464, 0,
2397
- -0.27528178691864014, 0.8036624789237976, 0.5275853276252747, 0,
2398
- -0.06273911893367767, 0.038559623062610626, 0.028268879279494286, 1,
2399
- ],
2400
- radius: 0.008483353070914745,
2401
- },
2402
- 'pinky-finger-phalanx-intermediate': {
2403
- offsetMatrix: [
2404
- 0.9820972084999084, 0.18811029195785522, -0.00995189044624567, 0,
2405
- 0.14063723385334015, -0.7673450708389282, -0.6256227493286133, 0,
2406
- -0.12532226741313934, 0.6130226850509644, -0.7800630927085876, 0,
2407
- -0.05428232625126839, 0.013870777562260628, 0.012061242014169693, 1,
2408
- ],
2409
- radius: 0.0067641944624483585,
2410
- },
2411
- 'pinky-finger-phalanx-distal': {
2412
- offsetMatrix: [
2413
- 0.9744614362716675, 0.20454788208007812, -0.09265263378620148, 0,
2414
- 0.22429193556308746, -0.9065253138542175, 0.35764020681381226, 0,
2415
- -0.010836843401193619, -0.3692878782749176, -0.9292529225349426, 0,
2416
- -0.05173685774207115, 0.0014194445684552193, 0.02790539152920246, 1,
2417
- ],
2418
- radius: 0.0064259846694767475,
2419
- },
2420
- 'pinky-finger-tip': {
2421
- offsetMatrix: [
2422
- 0.9744614362716675, 0.20454788208007812, -0.09265263378620148, 0,
2423
- 0.22429193556308746, -0.9065253138542175, 0.35764020681381226, 0,
2424
- -0.010836843401193619, -0.3692878782749176, -0.9292529225349426, 0,
2425
- -0.05098633095622063, 0.008463085629045963, 0.048688892275094986, 1,
2426
- ],
2427
- radius: 0.005425984505563974,
2428
- },
2429
- },
2430
- gripOffsetMatrix: [
2431
- 0.005510995630174875, -0.9149997234344482, -0.40341615676879883, 0,
2432
- -0.3571262061595917, -0.37861889600753784, 0.8538784384727478, 0,
2433
- -0.9340395331382751, 0.13936474919319153, -0.32885703444480896, 0,
2434
- -0.031803809106349945, 0.007837686687707901, 0.04313928261399269, 1,
2435
- ],
2436
- };
2192
+ class XRInputSourcesChangeEvent extends Event {
2193
+ constructor(type, eventInitDict) {
2194
+ super(type, eventInitDict);
2195
+ if (!eventInitDict.session) {
2196
+ throw new Error('XRInputSourcesChangeEventInit.session is required');
2197
+ }
2198
+ if (!eventInitDict.added) {
2199
+ throw new Error('XRInputSourcesChangeEventInit.added is required');
2200
+ }
2201
+ if (!eventInitDict.removed) {
2202
+ throw new Error('XRInputSourcesChangeEventInit.removed is required');
2203
+ }
2204
+ this.session = eventInitDict.session;
2205
+ this.added = eventInitDict.added;
2206
+ this.removed = eventInitDict.removed;
2207
+ }
2208
+ }
2437
2209
 
2438
2210
  /**
2439
2211
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -2441,241 +2213,46 @@ const pointHandPose = {
2441
2213
  * This source code is licensed under the MIT license found in the
2442
2214
  * LICENSE file in the root directory of this source tree.
2443
2215
  */
2444
- const relaxedHandPose = {
2445
- jointTransforms: {
2446
- wrist: {
2447
- offsetMatrix: [
2448
- 0.9616971015930176, -0.13805118203163147, 0.2368120402097702, 0,
2449
- 0.0005348679260350764, 0.8648636937141418, 0.5020061135292053, 0,
2450
- -0.2741127610206604, -0.48265108466148376, 0.8318111300468445, 0,
2451
- -0.04913589730858803, 0.0021463718730956316, 0.11701996624469757, 1,
2452
- ],
2453
- radius: 0.021460847929120064,
2454
- },
2455
- 'thumb-metacarpal': {
2456
- offsetMatrix: [
2457
- -0.07536252588033676, -0.9959676265716553, -0.04867160692811012, 0,
2458
- 0.5877083539962769, -0.08379616588354111, 0.8047218918800354, 0,
2459
- -0.8055551648139954, 0.032041035592556, 0.5916536450386047, 0,
2460
- -0.010643752291798592, 0.0006936835707165301, 0.08736639469861984, 1,
2461
- ],
2462
- radius: 0.019382517784833908,
2463
- },
2464
- 'thumb-phalanx-proximal': {
2465
- offsetMatrix: [
2466
- 0.1374533325433731, -0.9904957413673401, 0.004982374142855406, 0,
2467
- 0.5534393787384033, 0.08097179979085922, 0.8289443850517273, 0,
2468
- -0.8214688897132874, -0.11118389666080475, 0.559309184551239, 0,
2469
- 0.015547193586826324, -0.0003480653394944966, 0.0681300163269043, 1,
2470
- ],
2471
- radius: 0.01228295173496008,
2472
- },
2473
- 'thumb-phalanx-distal': {
2474
- offsetMatrix: [
2475
- -0.04659227654337883, -0.9974699020385742, -0.05369402840733528, 0,
2476
- 0.6812446117401123, -0.07104194164276123, 0.728600800037384, 0,
2477
- -0.7305715084075928, -0.002631746232509613, 0.6828309893608093, 0,
2478
- 0.04330715537071228, 0.003409178927540779, 0.0492292083799839, 1,
2479
- ],
2480
- radius: 0.009768804535269737,
2481
- },
2482
- 'thumb-tip': {
2483
- offsetMatrix: [
2484
- -0.04659227654337883, -0.9974699020385742, -0.05369402840733528, 0,
2485
- 0.6812446117401123, -0.07104194164276123, 0.728600800037384, 0,
2486
- -0.7305715084075928, -0.002631746232509613, 0.6828309893608093, 0,
2487
- 0.062003348022699356, 0.004069602582603693, 0.03322213143110275, 1,
2488
- ],
2489
- radius: 0.008768804371356964,
2490
- },
2491
- 'index-finger-metacarpal': {
2492
- offsetMatrix: [
2493
- 0.9616971015930176, -0.13805118203163147, 0.2368120402097702, 0,
2494
- 0.0005348679260350764, 0.8648636937141418, 0.5020061135292053, 0,
2495
- -0.2741127610206604, -0.48265108466148376, 0.8318111300468445, 0,
2496
- -0.02009812369942665, 0.008770795539021492, 0.08660387247800827, 1,
2497
- ],
2498
- radius: 0.021228281781077385,
2499
- },
2500
- 'index-finger-phalanx-proximal': {
2501
- offsetMatrix: [
2502
- 0.9001791477203369, -0.2598813474178314, 0.3494834005832672, 0,
2503
- 0.06073702871799469, 0.8695210218429565, 0.490146666765213, 0,
2504
- -0.4312632381916046, -0.41999316215515137, 0.7985095381736755, 0,
2505
- -0.00017739279428496957, 0.03890012577176094, 0.039073407649993896, 1,
2506
- ],
2507
- radius: 0.010295259766280651,
2508
- },
2509
- 'index-finger-phalanx-intermediate': {
2510
- offsetMatrix: [
2511
- 0.9082008600234985, -0.20898112654685974, 0.36262574791908264, 0,
2512
- 0.11045389622449875, 0.9553793668746948, 0.27395179867744446, 0,
2513
- -0.40369608998298645, -0.20874978601932526, 0.8907597661018372, 0,
2514
- 0.01617925800383091, 0.05482936650514603, 0.008788082748651505, 1,
2515
- ],
2516
- radius: 0.00853810179978609,
2517
- },
2518
- 'index-finger-phalanx-distal': {
2519
- offsetMatrix: [
2520
- 0.9309692978858948, -0.16783711314201355, 0.32423174381256104, 0,
2521
- 0.1080828532576561, 0.9749603867530823, 0.1943446695804596, 0,
2522
- -0.34873148798942566, -0.14588497579097748, 0.9257990717887878, 0,
2523
- 0.02599053829908371, 0.059902746230363846, -0.012860597111284733, 1,
2524
- ],
2525
- radius: 0.007636196445673704,
2526
- },
2527
- 'index-finger-tip': {
2528
- offsetMatrix: [
2529
- 0.9309692978858948, -0.16783711314201355, 0.32423174381256104, 0,
2530
- 0.1080828532576561, 0.9749603867530823, 0.1943446695804596, 0,
2531
- -0.34873148798942566, -0.14588497579097748, 0.9257990717887878, 0,
2532
- 0.03362493962049484, 0.06421422213315964, -0.033461250364780426, 1,
2533
- ],
2534
- radius: 0.006636196281760931,
2535
- },
2536
- 'middle-finger-metacarpal': {
2537
- offsetMatrix: [
2538
- 0.9616971015930176, -0.13805118203163147, 0.2368120402097702, 0,
2539
- 0.0005348679260350764, 0.8648636937141418, 0.5020061135292053, 0,
2540
- -0.2741127610206604, -0.48265108466148376, 0.8318111300468445, 0,
2541
- -0.03627845644950867, 0.011579737067222595, 0.08550142496824265, 1,
2542
- ],
2543
- radius: 0.021231964230537415,
2544
- },
2545
- 'middle-finger-phalanx-proximal': {
2546
- offsetMatrix: [
2547
- 0.9876697659492493, -0.06786545366048813, 0.1410750150680542, 0,
2548
- -0.015095947310328484, 0.855663537979126, 0.5173118710517883, 0,
2549
- -0.15582047402858734, -0.5130629539489746, 0.8440889716148376, 0,
2550
- -0.021259509027004242, 0.04587256908416748, 0.03659208118915558, 1,
2551
- ],
2552
- radius: 0.01117393933236599,
2553
- },
2554
- 'middle-finger-phalanx-intermediate': {
2555
- offsetMatrix: [
2556
- 0.988391637802124, -0.04354291781783104, 0.14555205404758453, 0,
2557
- 0.008894841186702251, 0.9729899168014526, 0.23067504167556763, 0,
2558
- -0.15166506171226501, -0.22670257091522217, 0.9620829224586487, 0,
2559
- -0.014570588245987892, 0.06789684295654297, 0.0003578895702958107, 1,
2560
- ],
2561
- radius: 0.008030958473682404,
2562
- },
2563
- 'middle-finger-phalanx-distal': {
2564
- offsetMatrix: [
2565
- 0.9853697419166565, 0.044260796159505844, 0.16458062827587128, 0,
2566
- -0.0757969319820404, 0.9787378311157227, 0.19059516489505768, 0,
2567
- -0.1526455283164978, -0.20028135180473328, 0.9677740931510925, 0,
2568
- -0.010392282158136368, 0.07414241135120392, -0.026147106662392616, 1,
2569
- ],
2570
- radius: 0.007629410829395056,
2571
- },
2572
- 'middle-finger-tip': {
2573
- offsetMatrix: [
2574
- 0.9853697419166565, 0.044260796159505844, 0.16458062827587128, 0,
2575
- -0.0757969319820404, 0.9787378311157227, 0.19059516489505768, 0,
2576
- -0.1526455283164978, -0.20028135180473328, 0.9677740931510925, 0,
2577
- -0.0069718430750072, 0.08024183660745621, -0.05014154314994812, 1,
2578
- ],
2579
- radius: 0.006629410665482283,
2580
- },
2581
- 'ring-finger-metacarpal': {
2582
- offsetMatrix: [
2583
- 0.9616971015930176, -0.13805118203163147, 0.2368120402097702, 0,
2584
- 0.0005348679260350764, 0.8648636937141418, 0.5020061135292053, 0,
2585
- -0.2741127610206604, -0.48265108466148376, 0.8318111300468445, 0,
2586
- -0.05402477830648422, 0.015797706320881844, 0.08152295649051666, 1,
2587
- ],
2588
- radius: 0.019088275730609894,
2589
- },
2590
- 'ring-finger-phalanx-proximal': {
2591
- offsetMatrix: [
2592
- 0.9940828680992126, 0.05735103040933609, 0.09224652498960495, 0,
2593
- -0.10022822767496109, 0.8116500377655029, 0.5754809379577637, 0,
2594
- -0.041867565363645554, -0.5813214182853699, 0.8125960826873779, 0,
2595
- -0.041623555123806, 0.04171867296099663, 0.03582974523305893, 1,
2596
- ],
2597
- radius: 0.00992213748395443,
2598
- },
2599
- 'ring-finger-phalanx-intermediate': {
2600
- offsetMatrix: [
2601
- 0.9843675494194031, 0.12044742703437805, 0.12850022315979004, 0,
2602
- -0.15629759430885315, 0.9337108135223389, 0.3221098482608795, 0,
2603
- -0.08118485659360886, -0.3371586799621582, 0.937940776348114, 0,
2604
- -0.039990875869989395, 0.06438793987035751, 0.004141641780734062, 1,
2605
- ],
2606
- radius: 0.007611672393977642,
2607
- },
2608
- 'ring-finger-phalanx-distal': {
2609
- offsetMatrix: [
2610
- 0.9748351573944092, 0.11857274919748306, 0.18877571821212769, 0,
2611
- -0.15575434267520905, 0.9681083559989929, 0.19623035192489624, 0,
2612
- -0.15948788821697235, -0.22069483995437622, 0.9622148275375366, 0,
2613
- -0.03783353418111801, 0.07334739714860916, -0.020782606676220894, 1,
2614
- ],
2615
- radius: 0.007231088820844889,
2616
- },
2617
- 'ring-finger-tip': {
2618
- offsetMatrix: [
2619
- 0.9748351573944092, 0.11857274919748306, 0.18877571821212769, 0,
2620
- -0.15575434267520905, 0.9681083559989929, 0.19623035192489624, 0,
2621
- -0.15948788821697235, -0.22069483995437622, 0.9622148275375366, 0,
2622
- -0.03445569798350334, 0.0802423357963562, -0.04392268508672714, 1,
2623
- ],
2624
- radius: 0.0062310886569321156,
2625
- },
2626
- 'pinky-finger-metacarpal': {
2627
- offsetMatrix: [
2628
- 0.9181402921676636, 0.35625091195106506, 0.17350243031978607, 0,
2629
- -0.39615097641944885, 0.8352503180503845, 0.38134080171585083, 0,
2630
- -0.009065053425729275, -0.41885748505592346, 0.9080066680908203, 0,
2631
- -0.06191859766840935, 0.013620133511722088, 0.07850203663110733, 1,
2632
- ],
2633
- radius: 0.01808827556669712,
2634
- },
2635
- 'pinky-finger-phalanx-proximal': {
2636
- offsetMatrix: [
2637
- 0.9714386463165283, 0.236698180437088, -0.016745081171393394, 0,
2638
- -0.18462024629116058, 0.7982627749443054, 0.5733163952827454, 0,
2639
- 0.14906984567642212, -0.5538501739501953, 0.8191629648208618, 0,
2640
- -0.061502378433942795, 0.032741155475378036, 0.03705105185508728, 1,
2641
- ],
2642
- radius: 0.008483353070914745,
2643
- },
2644
- 'pinky-finger-phalanx-intermediate': {
2645
- offsetMatrix: [
2646
- 0.9337416291236877, 0.35620439052581787, -0.03527557849884033, 0,
2647
- -0.33203884959220886, 0.8987522721290588, 0.28634607791900635, 0,
2648
- 0.13370157778263092, -0.2556603252887726, 0.9574766755104065, 0,
2649
- -0.06608185172080994, 0.049755651503801346, 0.011886020191013813, 1,
2650
- ],
2651
- radius: 0.0067641944624483585,
2652
- },
2653
- 'pinky-finger-phalanx-distal': {
2654
- offsetMatrix: [
2655
- 0.9419984817504883, 0.3303581774234772, 0.059175245463848114, 0,
2656
- -0.33483216166496277, 0.9130291938781738, 0.23294763267040253, 0,
2657
- 0.02292730286717415, -0.2392500638961792, 0.970687210559845, 0,
2658
- -0.0687975287437439, 0.054948460310697556, -0.007561664097011089, 1,
2659
- ],
2660
- radius: 0.0064259846694767475,
2661
- },
2662
- 'pinky-finger-tip': {
2663
- offsetMatrix: [
2664
- 0.9419984817504883, 0.3303581774234772, 0.059175245463848114, 0,
2665
- -0.33483216166496277, 0.9130291938781738, 0.23294763267040253, 0,
2666
- 0.02292730286717415, -0.2392500638961792, 0.970687210559845, 0,
2667
- -0.06947512179613113, 0.0613851435482502, -0.028543535619974136, 1,
2668
- ],
2669
- radius: 0.005425984505563974,
2670
- },
2671
- },
2672
- gripOffsetMatrix: [
2673
- -0.0005348679260350764, -0.8648636937141418, -0.5020061135292053, 0,
2674
- -0.2741127908229828, -0.48265108466148376, 0.8318111896514893, 0,
2675
- -0.9616971015930176, 0.13805119693279266, -0.2368120402097702, 0,
2676
- -0.02878567762672901, 0.0017147823236882687, 0.04536811262369156, 1,
2677
- ],
2678
- };
2216
+ var _a;
2217
+ const PRIVATE$9 = Symbol('@immersive-web-emulation-runtime/xr-reference-space');
2218
+ var XRReferenceSpaceType;
2219
+ (function (XRReferenceSpaceType) {
2220
+ XRReferenceSpaceType["Viewer"] = "viewer";
2221
+ XRReferenceSpaceType["Local"] = "local";
2222
+ XRReferenceSpaceType["LocalFloor"] = "local-floor";
2223
+ XRReferenceSpaceType["BoundedFloor"] = "bounded-floor";
2224
+ XRReferenceSpaceType["Unbounded"] = "unbounded";
2225
+ })(XRReferenceSpaceType || (XRReferenceSpaceType = {}));
2226
+ class XRReferenceSpace extends XRSpace {
2227
+ constructor(type, parentSpace, offsetMatrix) {
2228
+ super(parentSpace, offsetMatrix);
2229
+ this[_a] = {
2230
+ type: null,
2231
+ onreset: () => { },
2232
+ };
2233
+ this[PRIVATE$9].type = type;
2234
+ }
2235
+ get onreset() {
2236
+ var _b;
2237
+ return (_b = this[PRIVATE$9].onreset) !== null && _b !== void 0 ? _b : (() => { });
2238
+ }
2239
+ set onreset(callback) {
2240
+ if (this[PRIVATE$9].onreset) {
2241
+ this.removeEventListener('reset', this[PRIVATE$9].onreset);
2242
+ }
2243
+ this[PRIVATE$9].onreset = callback;
2244
+ if (callback) {
2245
+ this.addEventListener('reset', callback);
2246
+ }
2247
+ }
2248
+ // Create a new XRReferenceSpace with an offset from the current space
2249
+ getOffsetReferenceSpace(originOffset) {
2250
+ // Create a new XRReferenceSpace with the originOffset as its offsetMatrix
2251
+ // The new space's parent is set to 'this' (the current XRReferenceSpace)
2252
+ return new XRReferenceSpace(this[PRIVATE$9].type, this, originOffset);
2253
+ }
2254
+ }
2255
+ _a = PRIVATE$9;
2679
2256
 
2680
2257
  /**
2681
2258
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -2683,126 +2260,29 @@ const relaxedHandPose = {
2683
2260
  * This source code is licensed under the MIT license found in the
2684
2261
  * LICENSE file in the root directory of this source tree.
2685
2262
  */
2686
- const oculusHandConfig = {
2687
- profileId: 'oculus-hand',
2688
- fallbackProfileIds: [
2689
- 'generic-hand',
2690
- 'generic-hand-select',
2691
- 'generic-trigger',
2692
- ],
2693
- poses: {
2694
- default: relaxedHandPose,
2695
- pinch: pinchHandPose,
2696
- point: pointHandPose,
2697
- },
2698
- };
2699
- const XRHandGamepadConfig = {
2700
- mapping: GamepadMappingType.None,
2701
- buttons: [{ id: 'pinch', type: 'analog', eventTrigger: 'select' }],
2702
- axes: [],
2703
- };
2704
- const fromPosition = create$2();
2705
- const fromQuaternion = create();
2706
- const fromScale = create$2();
2707
- const toPosition = create$2();
2708
- const toQuaternion = create();
2709
- const toScale = create$2();
2710
- const interpolatedPosition = create$2();
2711
- const interpolatedQuaternion = create();
2712
- const interpolatedScale = create$2();
2713
- const interpolateMatrix = (out, fromMatrix, toMatrix, alpha) => {
2714
- getTranslation(fromPosition, fromMatrix);
2715
- getRotation(fromQuaternion, fromMatrix);
2716
- getScaling(fromScale, fromMatrix);
2717
- getTranslation(toPosition, toMatrix);
2718
- getRotation(toQuaternion, toMatrix);
2719
- getScaling(toScale, toMatrix);
2720
- lerp(interpolatedPosition, fromPosition, toPosition, alpha);
2721
- slerp(interpolatedQuaternion, fromQuaternion, toQuaternion, alpha);
2722
- lerp(interpolatedScale, fromScale, toScale, alpha);
2723
- fromRotationTranslationScale(out, interpolatedQuaternion, interpolatedPosition, interpolatedScale);
2724
- return out;
2725
- };
2726
- const mirrorMultiplierMatrix = [
2727
- 1, -1, -1, 0, -1, 1, 1, 0, -1, 1, 1, 0, -1, 1, 1, 1,
2728
- ];
2729
- const mirrorMatrixToRight = (matrixLeft) => {
2730
- for (let i = 0; i < 16; i++) {
2731
- matrixLeft[i] *= mirrorMultiplierMatrix[i];
2732
- }
2733
- };
2734
- const PRIVATE$e = Symbol('@immersive-web-emulation-runtime/xr-hand-input');
2735
- class XRHandInput extends XRTrackedInput {
2736
- constructor(handInputConfig, handedness, globalSpace) {
2737
- if (handedness !== XRHandedness.Left && handedness !== XRHandedness.Right) {
2738
- throw new DOMException('handedness for XRHandInput must be either "left" or "right"', 'InvalidStateError');
2739
- }
2740
- if (!handInputConfig.poses.default || !handInputConfig.poses.pinch) {
2741
- throw new DOMException('"default" and "pinch" hand pose configs are required', 'InvalidStateError');
2742
- }
2743
- const targetRaySpace = new XRSpace(globalSpace);
2744
- const gripSpace = new XRSpace(targetRaySpace);
2745
- const profiles = [
2746
- handInputConfig.profileId,
2747
- ...handInputConfig.fallbackProfileIds,
2748
- ];
2749
- const hand = new XRHand();
2750
- Object.values(XRHandJoint).forEach((jointName) => {
2751
- hand.set(jointName, new XRJointSpace(jointName, targetRaySpace));
2752
- });
2753
- const inputSource = new XRInputSource(handedness, XRTargetRayMode.TrackedPointer, profiles, targetRaySpace, new Gamepad(XRHandGamepadConfig), gripSpace, hand);
2754
- super(inputSource);
2755
- this[PRIVATE$e] = {
2756
- poseId: 'default',
2757
- poses: handInputConfig.poses,
2263
+ const PRIVATE$8 = Symbol('@immersive-web-emulation-runtime/xr-render-state');
2264
+ class XRRenderState {
2265
+ constructor(init = {}, oldState) {
2266
+ this[PRIVATE$8] = {
2267
+ depthNear: init.depthNear || (oldState === null || oldState === void 0 ? void 0 : oldState.depthNear) || 0.1,
2268
+ depthFar: init.depthFar || (oldState === null || oldState === void 0 ? void 0 : oldState.depthFar) || 1000.0,
2269
+ inlineVerticalFieldOfView: init.inlineVerticalFieldOfView ||
2270
+ (oldState === null || oldState === void 0 ? void 0 : oldState.inlineVerticalFieldOfView) ||
2271
+ null,
2272
+ baseLayer: init.baseLayer || (oldState === null || oldState === void 0 ? void 0 : oldState.baseLayer) || null,
2758
2273
  };
2759
- this.updateHandPose();
2760
- }
2761
- get poseId() {
2762
- return this[PRIVATE$e].poseId;
2763
- }
2764
- set poseId(poseId) {
2765
- if (!this[PRIVATE$e].poses[poseId]) {
2766
- console.warn(`Pose config ${poseId} not found`);
2767
- return;
2768
- }
2769
- this[PRIVATE$e].poseId = poseId;
2770
2274
  }
2771
- updateHandPose() {
2772
- const targetPose = this[PRIVATE$e].poses[this[PRIVATE$e].poseId];
2773
- const pinchPose = this[PRIVATE$e].poses.pinch;
2774
- Object.values(XRHandJoint).forEach((jointName) => {
2775
- const targetJointMatrix = targetPose.jointTransforms[jointName].offsetMatrix;
2776
- const pinchJointMatrix = pinchPose.jointTransforms[jointName].offsetMatrix;
2777
- const jointSpace = this.inputSource.hand.get(jointName);
2778
- interpolateMatrix(jointSpace[PRIVATE$l].offsetMatrix, targetJointMatrix, pinchJointMatrix, this.pinchValue);
2779
- if (this.inputSource.handedness === XRHandedness.Right) {
2780
- mirrorMatrixToRight(jointSpace[PRIVATE$l].offsetMatrix);
2781
- }
2782
- jointSpace[PRIVATE$f].radius =
2783
- (1 - this.pinchValue) * targetPose.jointTransforms[jointName].radius +
2784
- this.pinchValue * pinchPose.jointTransforms[jointName].radius;
2785
- });
2786
- if (targetPose.gripOffsetMatrix && pinchPose.gripOffsetMatrix) {
2787
- interpolateMatrix(this.inputSource.gripSpace[PRIVATE$l].offsetMatrix, targetPose.gripOffsetMatrix, pinchPose.gripOffsetMatrix, this.pinchValue);
2788
- }
2275
+ get depthNear() {
2276
+ return this[PRIVATE$8].depthNear;
2789
2277
  }
2790
- get pinchValue() {
2791
- return this[PRIVATE$i].inputSource.gamepad[PRIVATE$k]
2792
- .buttonsMap['pinch'].value;
2278
+ get depthFar() {
2279
+ return this[PRIVATE$8].depthFar;
2793
2280
  }
2794
- updatePinchValue(value) {
2795
- if (value > 1 || value < 0) {
2796
- console.warn(`Out-of-range value ${value} provided for pinch`);
2797
- return;
2798
- }
2799
- const gamepadButton = this[PRIVATE$i].inputSource.gamepad[PRIVATE$k]
2800
- .buttonsMap['pinch'];
2801
- gamepadButton[PRIVATE$k].pendingValue = value;
2281
+ get inlineVerticalFieldOfView() {
2282
+ return this[PRIVATE$8].inlineVerticalFieldOfView;
2802
2283
  }
2803
- onFrameStart(frame) {
2804
- super.onFrameStart(frame);
2805
- this.updateHandPose();
2284
+ get baseLayer() {
2285
+ return this[PRIVATE$8].baseLayer;
2806
2286
  }
2807
2287
  }
2808
2288
 
@@ -2812,27 +2292,13 @@ class XRHandInput extends XRTrackedInput {
2812
2292
  * This source code is licensed under the MIT license found in the
2813
2293
  * LICENSE file in the root directory of this source tree.
2814
2294
  */
2815
- const PRIVATE$d = Symbol('@immersive-web-emulation-runtime/xr-pose');
2816
- class XRPose {
2817
- constructor(transform, emulatedPosition = false, linearVelocity = undefined, angularVelocity = undefined) {
2818
- this[PRIVATE$d] = {
2819
- transform,
2820
- emulatedPosition,
2821
- linearVelocity,
2822
- angularVelocity,
2823
- };
2824
- }
2825
- get transform() {
2826
- return this[PRIVATE$d].transform;
2827
- }
2828
- get emulatedPosition() {
2829
- return this[PRIVATE$d].emulatedPosition;
2830
- }
2831
- get linearVelocity() {
2832
- return this[PRIVATE$d].linearVelocity;
2833
- }
2834
- get angularVelocity() {
2835
- return this[PRIVATE$d].angularVelocity;
2295
+ class XRSessionEvent extends Event {
2296
+ constructor(type, eventInitDict) {
2297
+ super(type, eventInitDict);
2298
+ if (!eventInitDict.session) {
2299
+ throw new Error('XRSessionEventInit.session is required');
2300
+ }
2301
+ this.session = eventInitDict.session;
2836
2302
  }
2837
2303
  }
2838
2304
 
@@ -2842,356 +2308,67 @@ class XRPose {
2842
2308
  * This source code is licensed under the MIT license found in the
2843
2309
  * LICENSE file in the root directory of this source tree.
2844
2310
  */
2845
- const PRIVATE$c = Symbol('@immersive-web-emulation-runtime/xr-joint-pose');
2846
- class XRJointPose extends XRPose {
2847
- constructor(transform, radius, emulatedPosition = false, linearVelocity = undefined, angularVelocity = undefined) {
2848
- super(transform, emulatedPosition, linearVelocity, angularVelocity);
2849
- this[PRIVATE$c] = { radius };
2850
- }
2851
- get radius() {
2852
- return this[PRIVATE$c].radius;
2853
- }
2311
+ class XRLayer extends EventTarget {
2854
2312
  }
2855
-
2856
- /**
2857
- * Copyright (c) Meta Platforms, Inc. and affiliates.
2858
- *
2859
- * This source code is licensed under the MIT license found in the
2860
- * LICENSE file in the root directory of this source tree.
2861
- */
2862
- class PolyfillDOMPointReadOnly {
2863
- constructor(x = 0, y = 0, z = 0, w = 1) {
2864
- this.x = x;
2865
- this.y = y;
2866
- this.z = z;
2867
- this.w = w;
2868
- Object.freeze(this);
2869
- }
2870
- static fromPoint(other) {
2871
- return new PolyfillDOMPointReadOnly(other.x, other.y, other.z, other.w);
2313
+ const PRIVATE$7 = Symbol('@immersive-web-emulation-runtime/XRWebGLLayer');
2314
+ const defaultLayerInit = {
2315
+ antialias: true,
2316
+ depth: true,
2317
+ stencil: false,
2318
+ alpha: true,
2319
+ ignoreDepthValues: false,
2320
+ framebufferScaleFactor: 1.0,
2321
+ };
2322
+ class XRWebGLLayer extends XRLayer {
2323
+ constructor(session, context, layerInit = {}) {
2324
+ super();
2325
+ if (session[PRIVATE$6].ended) {
2326
+ throw new DOMException('Session has ended', 'InvalidStateError');
2327
+ }
2328
+ // TO-DO: Check that the context attribute has xrCompatible set to true
2329
+ // may require polyfilling the context and perhaps canvas.getContext
2330
+ // Default values for XRWebGLLayerInit, can be overridden by layerInit
2331
+ const config = { ...defaultLayerInit, ...layerInit };
2332
+ this[PRIVATE$7] = {
2333
+ session,
2334
+ context,
2335
+ antialias: config.antialias,
2336
+ };
2872
2337
  }
2873
- matrixTransform(_matrix) {
2874
- // Implement matrix transformation logic here
2875
- // This is a placeholder implementation
2876
- return new PolyfillDOMPointReadOnly();
2338
+ get context() {
2339
+ return this[PRIVATE$7].context;
2877
2340
  }
2878
- toJSON() {
2879
- // Implement toJSON logic here
2880
- // This is a placeholder implementation
2881
- return { x: this.x, y: this.y, z: this.z, w: this.w };
2341
+ get antialias() {
2342
+ return this[PRIVATE$7].antialias;
2882
2343
  }
2883
- }
2884
- const DOMPointReadOnly = typeof globalThis.DOMPointReadOnly !== 'undefined'
2885
- ? globalThis.DOMPointReadOnly
2886
- : PolyfillDOMPointReadOnly;
2887
-
2888
- /**
2889
- * Copyright (c) Meta Platforms, Inc. and affiliates.
2890
- *
2891
- * This source code is licensed under the MIT license found in the
2892
- * LICENSE file in the root directory of this source tree.
2893
- */
2894
- const PRIVATE$b = Symbol('@immersive-web-emulation-runtime/xr-rigid-transform');
2895
- class XRRigidTransform {
2896
- constructor(position, orientation) {
2897
- // Default values
2898
- const defaultPosition = fromValues$2(0, 0, 0);
2899
- const defaultOrientation = create();
2900
- this[PRIVATE$b] = {
2901
- matrix: create$3(),
2902
- position: position
2903
- ? fromValues$2(position.x, position.y, position.z)
2904
- : defaultPosition,
2905
- orientation: orientation
2906
- ? normalize(create(), fromValues(orientation.x, orientation.y, orientation.z, orientation.w))
2907
- : defaultOrientation,
2908
- inverse: null,
2909
- };
2910
- this.updateMatrix();
2344
+ get ignoreDepthValues() {
2345
+ return true;
2911
2346
  }
2912
- updateMatrix() {
2913
- fromRotationTranslation(this[PRIVATE$b].matrix, this[PRIVATE$b].orientation, this[PRIVATE$b].position);
2347
+ get framebuffer() {
2348
+ return null;
2914
2349
  }
2915
- get matrix() {
2916
- return this[PRIVATE$b].matrix;
2350
+ get framebufferWidth() {
2351
+ return this[PRIVATE$7].context.drawingBufferWidth;
2917
2352
  }
2918
- get position() {
2919
- const pos = this[PRIVATE$b].position;
2920
- return new DOMPointReadOnly(pos[0], pos[1], pos[2], 1);
2353
+ get framebufferHeight() {
2354
+ return this[PRIVATE$7].context.drawingBufferHeight;
2921
2355
  }
2922
- get orientation() {
2923
- const ori = this[PRIVATE$b].orientation;
2924
- return new DOMPointReadOnly(ori[0], ori[1], ori[2], ori[3]);
2356
+ getViewport(view) {
2357
+ if (view[PRIVATE$g].session !== this[PRIVATE$7].session) {
2358
+ throw new DOMException("View's session differs from Layer's session", 'InvalidStateError');
2359
+ }
2360
+ // TO-DO: check frame
2361
+ return this[PRIVATE$7].session[PRIVATE$6].device[PRIVATE$1].getViewport(this, view);
2925
2362
  }
2926
- get inverse() {
2927
- if (!this[PRIVATE$b].inverse) {
2928
- const invMatrix = create$3();
2929
- if (!invert(invMatrix, this[PRIVATE$b].matrix)) {
2930
- throw new Error('Matrix is not invertible.');
2931
- }
2932
- // Decomposing the inverse matrix into position and orientation
2933
- let invPosition = create$2();
2934
- getTranslation(invPosition, invMatrix);
2935
- let invOrientation = create();
2936
- getRotation(invOrientation, invMatrix);
2937
- // Creating a new XRRigidTransform for the inverse
2938
- this[PRIVATE$b].inverse = new XRRigidTransform(new DOMPointReadOnly(invPosition[0], invPosition[1], invPosition[2], 1), new DOMPointReadOnly(invOrientation[0], invOrientation[1], invOrientation[2], invOrientation[3]));
2939
- // Setting the inverse of the inverse to be this transform
2940
- this[PRIVATE$b].inverse[PRIVATE$b].inverse = this;
2363
+ static getNativeFramebufferScaleFactor(session) {
2364
+ if (!(session instanceof XRSession)) {
2365
+ throw new TypeError('getNativeFramebufferScaleFactor must be passed a session.');
2366
+ }
2367
+ if (session[PRIVATE$6].ended) {
2368
+ return 0.0;
2941
2369
  }
2942
- return this[PRIVATE$b].inverse;
2943
- }
2944
- }
2945
-
2946
- /**
2947
- * Copyright (c) Meta Platforms, Inc. and affiliates.
2948
- *
2949
- * This source code is licensed under the MIT license found in the
2950
- * LICENSE file in the root directory of this source tree.
2951
- */
2952
- const PRIVATE$a = Symbol('@immersive-web-emulation-runtime/xr-viewer-pose');
2953
- class XRViewerPose extends XRPose {
2954
- constructor(transform, views, emulatedPosition = false, linearVelocity = undefined, angularVelocity = undefined) {
2955
- super(transform, emulatedPosition, linearVelocity, angularVelocity);
2956
- this[PRIVATE$a] = {
2957
- views: Object.freeze(views),
2958
- };
2959
- }
2960
- get views() {
2961
- return this[PRIVATE$a].views;
2962
- }
2963
- }
2964
-
2965
- /**
2966
- * Copyright (c) Meta Platforms, Inc. and affiliates.
2967
- *
2968
- * This source code is licensed under the MIT license found in the
2969
- * LICENSE file in the root directory of this source tree.
2970
- */
2971
- const PRIVATE$9 = Symbol('@immersive-web-emulation-runtime/xr-frame');
2972
- const spaceGlobalMatrix = create$3();
2973
- const baseSpaceGlobalMatrix = create$3();
2974
- const baseSpaceGlobalMatrixInverse = create$3();
2975
- const getOffsetMatrix = (offsetMatrix, space, baseSpace) => {
2976
- XRSpaceUtils.calculateGlobalOffsetMatrix(space, spaceGlobalMatrix);
2977
- XRSpaceUtils.calculateGlobalOffsetMatrix(baseSpace, baseSpaceGlobalMatrix);
2978
- invert(baseSpaceGlobalMatrixInverse, baseSpaceGlobalMatrix);
2979
- multiply$1(offsetMatrix, baseSpaceGlobalMatrixInverse, spaceGlobalMatrix);
2980
- };
2981
- class XRFrame {
2982
- constructor(session, id, active, animationFrame, predictedDisplayTime) {
2983
- this[PRIVATE$9] = {
2984
- session,
2985
- id,
2986
- active,
2987
- animationFrame,
2988
- predictedDisplayTime,
2989
- tempMat4: create$3(),
2990
- };
2991
- }
2992
- get session() {
2993
- return this[PRIVATE$9].session;
2994
- }
2995
- get predictedDisplayTime() {
2996
- return this[PRIVATE$9].predictedDisplayTime;
2997
- }
2998
- getPose(space, baseSpace) {
2999
- if (!this[PRIVATE$9].active) {
3000
- throw new DOMException('XRFrame access outside the callback that produced it is invalid.', 'InvalidStateError');
3001
- }
3002
- getOffsetMatrix(this[PRIVATE$9].tempMat4, space, baseSpace);
3003
- const position = create$2();
3004
- getTranslation(position, this[PRIVATE$9].tempMat4);
3005
- const orientation = create();
3006
- getRotation(orientation, this[PRIVATE$9].tempMat4);
3007
- return new XRPose(new XRRigidTransform({ x: position[0], y: position[1], z: position[2], w: 1.0 }, {
3008
- x: orientation[0],
3009
- y: orientation[1],
3010
- z: orientation[2],
3011
- w: orientation[3],
3012
- }), space[PRIVATE$l].emulated);
3013
- }
3014
- getViewerPose(referenceSpace) {
3015
- if (!this[PRIVATE$9].animationFrame) {
3016
- throw new DOMException('getViewerPose can only be called on XRFrame objects passed to XRSession.requestAnimationFrame callbacks.', 'InvalidStateError');
3017
- }
3018
- const session = this[PRIVATE$9].session;
3019
- const device = session[PRIVATE$6].device;
3020
- const pose = this.getPose(device.viewerSpace, referenceSpace);
3021
- const eyes = session[PRIVATE$6].mode === XRSessionMode.Inline
3022
- ? [XREye.None]
3023
- : [XREye.Left, XREye.Right];
3024
- const views = [];
3025
- eyes.forEach((eye) => {
3026
- const viewSpace = device.viewSpaces[eye];
3027
- const viewPose = this.getPose(viewSpace, referenceSpace);
3028
- const projectionMatrix = session[PRIVATE$6].getProjectionMatrix(eye);
3029
- const view = new XRView(eye, new Float32Array(projectionMatrix), viewPose.transform, session);
3030
- views.push(view);
3031
- });
3032
- return new XRViewerPose(pose.transform, views, false);
3033
- }
3034
- getJointPose(joint, baseSpace) {
3035
- const xrPose = this.getPose(joint, baseSpace);
3036
- const radius = joint[PRIVATE$f].radius;
3037
- return new XRJointPose(xrPose.transform, radius, false);
3038
- }
3039
- fillJointRadii(jointSpaces, radii) {
3040
- // converting from sequence type to array
3041
- jointSpaces = Array.from(jointSpaces);
3042
- if (!this[PRIVATE$9].active) {
3043
- throw new DOMException('XRFrame access outside the callback that produced it is invalid.', 'InvalidStateError');
3044
- }
3045
- if (jointSpaces.length > radii.length) {
3046
- throw new DOMException('The length of jointSpaces is larger than the number of elements in radii', 'TypeError');
3047
- }
3048
- let allValid = true;
3049
- for (let offset = 0; offset < jointSpaces.length; offset++) {
3050
- if (!jointSpaces[offset][PRIVATE$f].radius) {
3051
- radii[offset] = NaN;
3052
- allValid = false;
3053
- }
3054
- else {
3055
- radii[offset] = jointSpaces[offset][PRIVATE$f].radius;
3056
- }
3057
- }
3058
- return allValid;
3059
- }
3060
- fillPoses(spaces, baseSpace, transforms) {
3061
- // converting from sequence type to array
3062
- spaces = Array.from(spaces);
3063
- if (!this[PRIVATE$9].active) {
3064
- throw new DOMException('XRFrame access outside the callback that produced it is invalid.', 'InvalidStateError');
3065
- }
3066
- if (spaces.length * 16 > transforms.length) {
3067
- throw new DOMException('The length of spaces multiplied by 16 is larger than the number of elements in transforms', 'TypeError');
3068
- }
3069
- spaces.forEach((space, i) => {
3070
- getOffsetMatrix(this[PRIVATE$9].tempMat4, space, baseSpace);
3071
- for (let j = 0; j < 16; j++) {
3072
- transforms[i * 16 + j] = this[PRIVATE$9].tempMat4[j];
3073
- }
3074
- });
3075
- return true;
3076
- }
3077
- }
3078
-
3079
- /**
3080
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3081
- *
3082
- * This source code is licensed under the MIT license found in the
3083
- * LICENSE file in the root directory of this source tree.
3084
- */
3085
- class XRInputSourcesChangeEvent extends Event {
3086
- constructor(type, eventInitDict) {
3087
- super(type, eventInitDict);
3088
- if (!eventInitDict.session) {
3089
- throw new Error('XRInputSourcesChangeEventInit.session is required');
3090
- }
3091
- if (!eventInitDict.added) {
3092
- throw new Error('XRInputSourcesChangeEventInit.added is required');
3093
- }
3094
- if (!eventInitDict.removed) {
3095
- throw new Error('XRInputSourcesChangeEventInit.removed is required');
3096
- }
3097
- this.session = eventInitDict.session;
3098
- this.added = eventInitDict.added;
3099
- this.removed = eventInitDict.removed;
3100
- }
3101
- }
3102
-
3103
- /**
3104
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3105
- *
3106
- * This source code is licensed under the MIT license found in the
3107
- * LICENSE file in the root directory of this source tree.
3108
- */
3109
- var _a;
3110
- const PRIVATE$8 = Symbol('@immersive-web-emulation-runtime/xr-reference-space');
3111
- var XRReferenceSpaceType;
3112
- (function (XRReferenceSpaceType) {
3113
- XRReferenceSpaceType["Viewer"] = "viewer";
3114
- XRReferenceSpaceType["Local"] = "local";
3115
- XRReferenceSpaceType["LocalFloor"] = "local-floor";
3116
- XRReferenceSpaceType["BoundedFloor"] = "bounded-floor";
3117
- XRReferenceSpaceType["Unbounded"] = "unbounded";
3118
- })(XRReferenceSpaceType || (XRReferenceSpaceType = {}));
3119
- class XRReferenceSpace extends XRSpace {
3120
- constructor(type, parentSpace, offsetMatrix) {
3121
- super(parentSpace, offsetMatrix);
3122
- this[_a] = {
3123
- type: null,
3124
- onreset: () => { },
3125
- };
3126
- this[PRIVATE$8].type = type;
3127
- }
3128
- get onreset() {
3129
- var _b;
3130
- return (_b = this[PRIVATE$8].onreset) !== null && _b !== void 0 ? _b : (() => { });
3131
- }
3132
- set onreset(callback) {
3133
- if (this[PRIVATE$8].onreset) {
3134
- this.removeEventListener('reset', this[PRIVATE$8].onreset);
3135
- }
3136
- this[PRIVATE$8].onreset = callback;
3137
- if (callback) {
3138
- this.addEventListener('reset', callback);
3139
- }
3140
- }
3141
- // Create a new XRReferenceSpace with an offset from the current space
3142
- getOffsetReferenceSpace(originOffset) {
3143
- // Create a new XRReferenceSpace with the originOffset as its offsetMatrix
3144
- // The new space's parent is set to 'this' (the current XRReferenceSpace)
3145
- return new XRReferenceSpace(this[PRIVATE$8].type, this, originOffset);
3146
- }
3147
- }
3148
- _a = PRIVATE$8;
3149
-
3150
- /**
3151
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3152
- *
3153
- * This source code is licensed under the MIT license found in the
3154
- * LICENSE file in the root directory of this source tree.
3155
- */
3156
- const PRIVATE$7 = Symbol('@immersive-web-emulation-runtime/xr-render-state');
3157
- class XRRenderState {
3158
- constructor(init = {}, oldState) {
3159
- this[PRIVATE$7] = {
3160
- depthNear: init.depthNear || (oldState === null || oldState === void 0 ? void 0 : oldState.depthNear) || 0.1,
3161
- depthFar: init.depthFar || (oldState === null || oldState === void 0 ? void 0 : oldState.depthFar) || 1000.0,
3162
- inlineVerticalFieldOfView: init.inlineVerticalFieldOfView ||
3163
- (oldState === null || oldState === void 0 ? void 0 : oldState.inlineVerticalFieldOfView) ||
3164
- null,
3165
- baseLayer: init.baseLayer || (oldState === null || oldState === void 0 ? void 0 : oldState.baseLayer) || null,
3166
- };
3167
- }
3168
- get depthNear() {
3169
- return this[PRIVATE$7].depthNear;
3170
- }
3171
- get depthFar() {
3172
- return this[PRIVATE$7].depthFar;
3173
- }
3174
- get inlineVerticalFieldOfView() {
3175
- return this[PRIVATE$7].inlineVerticalFieldOfView;
3176
- }
3177
- get baseLayer() {
3178
- return this[PRIVATE$7].baseLayer;
3179
- }
3180
- }
3181
-
3182
- /**
3183
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3184
- *
3185
- * This source code is licensed under the MIT license found in the
3186
- * LICENSE file in the root directory of this source tree.
3187
- */
3188
- class XRSessionEvent extends Event {
3189
- constructor(type, eventInitDict) {
3190
- super(type, eventInitDict);
3191
- if (!eventInitDict.session) {
3192
- throw new Error('XRSessionEventInit.session is required');
3193
- }
3194
- this.session = eventInitDict.session;
2370
+ // Return 1.0 for simplicity, actual implementation might vary based on the device capabilities
2371
+ return 1.0;
3195
2372
  }
3196
2373
  }
3197
2374
 
@@ -3213,6 +2390,17 @@ var XRSessionMode;
3213
2390
  XRSessionMode["ImmersiveVR"] = "immersive-vr";
3214
2391
  XRSessionMode["ImmersiveAR"] = "immersive-ar";
3215
2392
  })(XRSessionMode || (XRSessionMode = {}));
2393
+ var XREnvironmentBlendMode;
2394
+ (function (XREnvironmentBlendMode) {
2395
+ XREnvironmentBlendMode["Opaque"] = "opaque";
2396
+ XREnvironmentBlendMode["AlphaBlend"] = "alpha-blend";
2397
+ XREnvironmentBlendMode["Additive"] = "additive";
2398
+ })(XREnvironmentBlendMode || (XREnvironmentBlendMode = {}));
2399
+ var XRInteractionMode;
2400
+ (function (XRInteractionMode) {
2401
+ XRInteractionMode["ScreenSpace"] = "screen-space";
2402
+ XRInteractionMode["WorldSpace"] = "world-space";
2403
+ })(XRInteractionMode || (XRInteractionMode = {}));
3216
2404
  const PRIVATE$6 = Symbol('@immersive-web-emulation-runtime/xr-session');
3217
2405
  class XRSession extends EventTarget {
3218
2406
  constructor(device, mode, enabledFeatures) {
@@ -3348,7 +2536,7 @@ class XRSession extends EventTarget {
3348
2536
  }
3349
2537
  this[PRIVATE$6].currentFrameCallbacks = null;
3350
2538
  // - Set frame’s active boolean to false.
3351
- frame[PRIVATE$9].active = false;
2539
+ frame[PRIVATE$a].active = false;
3352
2540
  },
3353
2541
  nominalFrameRate: device.internalNominalFrameRate,
3354
2542
  referenceSpaces: [],
@@ -3360,6 +2548,7 @@ class XRSession extends EventTarget {
3360
2548
  const currInputs = this[PRIVATE$6].device.inputSources.filter((inputSource) => !inputSource.hand || handTrackingOn);
3361
2549
  const added = currInputs.filter((item) => !prevInputs.includes(item));
3362
2550
  const removed = prevInputs.filter((item) => !currInputs.includes(item));
2551
+ this[PRIVATE$6].activeInputSources = currInputs;
3363
2552
  if (added.length > 0 || removed.length > 0) {
3364
2553
  this.dispatchEvent(new XRInputSourcesChangeEvent('inputsourceschange', {
3365
2554
  session: this,
@@ -3367,7 +2556,6 @@ class XRSession extends EventTarget {
3367
2556
  removed,
3368
2557
  }));
3369
2558
  }
3370
- this[PRIVATE$6].activeInputSources = currInputs;
3371
2559
  },
3372
2560
  onend: null,
3373
2561
  oninputsourceschange: null,
@@ -3409,13 +2597,20 @@ class XRSession extends EventTarget {
3409
2597
  get isSystemKeyboardSupported() {
3410
2598
  return this[PRIVATE$6].isSystemKeyboardSupported;
3411
2599
  }
2600
+ get environmentBlendMode() {
2601
+ var _a;
2602
+ return ((_a = this[PRIVATE$6].device[PRIVATE$1].environmentBlendModes[this[PRIVATE$6].mode]) !== null && _a !== void 0 ? _a : XREnvironmentBlendMode.Opaque);
2603
+ }
2604
+ get interactionMode() {
2605
+ return this[PRIVATE$6].device[PRIVATE$1].interactionMode;
2606
+ }
3412
2607
  updateRenderState(state = {}) {
3413
2608
  var _a, _b, _c, _d;
3414
2609
  if (this[PRIVATE$6].ended) {
3415
2610
  throw new DOMException('XRSession has already ended.', 'InvalidStateError');
3416
2611
  }
3417
2612
  if (state.baseLayer &&
3418
- state.baseLayer[PRIVATE$5].session !== this) {
2613
+ state.baseLayer[PRIVATE$7].session !== this) {
3419
2614
  throw new DOMException('Base layer was created by a different XRSession', 'InvalidStateError');
3420
2615
  }
3421
2616
  if (state.inlineVerticalFieldOfView != null &&
@@ -3671,67 +2866,890 @@ class XRSession extends EventTarget {
3671
2866
  * This source code is licensed under the MIT license found in the
3672
2867
  * LICENSE file in the root directory of this source tree.
3673
2868
  */
3674
- class XRLayer extends EventTarget {
3675
- }
3676
- const PRIVATE$5 = Symbol('@immersive-web-emulation-runtime/XRWebGLLayer');
3677
- const defaultLayerInit = {
3678
- antialias: true,
3679
- depth: true,
3680
- stencil: false,
3681
- alpha: true,
3682
- ignoreDepthValues: false,
3683
- framebufferScaleFactor: 1.0,
2869
+ var XRHandJoint;
2870
+ (function (XRHandJoint) {
2871
+ XRHandJoint["Wrist"] = "wrist";
2872
+ XRHandJoint["ThumbMetacarpal"] = "thumb-metacarpal";
2873
+ XRHandJoint["ThumbPhalanxProximal"] = "thumb-phalanx-proximal";
2874
+ XRHandJoint["ThumbPhalanxDistal"] = "thumb-phalanx-distal";
2875
+ XRHandJoint["ThumbTip"] = "thumb-tip";
2876
+ XRHandJoint["IndexFingerMetacarpal"] = "index-finger-metacarpal";
2877
+ XRHandJoint["IndexFingerPhalanxProximal"] = "index-finger-phalanx-proximal";
2878
+ XRHandJoint["IndexFingerPhalanxIntermediate"] = "index-finger-phalanx-intermediate";
2879
+ XRHandJoint["IndexFingerPhalanxDistal"] = "index-finger-phalanx-distal";
2880
+ XRHandJoint["IndexFingerTip"] = "index-finger-tip";
2881
+ XRHandJoint["MiddleFingerMetacarpal"] = "middle-finger-metacarpal";
2882
+ XRHandJoint["MiddleFingerPhalanxProximal"] = "middle-finger-phalanx-proximal";
2883
+ XRHandJoint["MiddleFingerPhalanxIntermediate"] = "middle-finger-phalanx-intermediate";
2884
+ XRHandJoint["MiddleFingerPhalanxDistal"] = "middle-finger-phalanx-distal";
2885
+ XRHandJoint["MiddleFingerTip"] = "middle-finger-tip";
2886
+ XRHandJoint["RingFingerMetacarpal"] = "ring-finger-metacarpal";
2887
+ XRHandJoint["RingFingerPhalanxProximal"] = "ring-finger-phalanx-proximal";
2888
+ XRHandJoint["RingFingerPhalanxIntermediate"] = "ring-finger-phalanx-intermediate";
2889
+ XRHandJoint["RingFingerPhalanxDistal"] = "ring-finger-phalanx-distal";
2890
+ XRHandJoint["RingFingerTip"] = "ring-finger-tip";
2891
+ XRHandJoint["PinkyFingerMetacarpal"] = "pinky-finger-metacarpal";
2892
+ XRHandJoint["PinkyFingerPhalanxProximal"] = "pinky-finger-phalanx-proximal";
2893
+ XRHandJoint["PinkyFingerPhalanxIntermediate"] = "pinky-finger-phalanx-intermediate";
2894
+ XRHandJoint["PinkyFingerPhalanxDistal"] = "pinky-finger-phalanx-distal";
2895
+ XRHandJoint["PinkyFingerTip"] = "pinky-finger-tip";
2896
+ })(XRHandJoint || (XRHandJoint = {}));
2897
+ class XRHand extends Map {
2898
+ }
2899
+
2900
+ /**
2901
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
2902
+ *
2903
+ * This source code is licensed under the MIT license found in the
2904
+ * LICENSE file in the root directory of this source tree.
2905
+ */
2906
+ const pinchHandPose = {
2907
+ jointTransforms: {
2908
+ wrist: {
2909
+ offsetMatrix: [
2910
+ 0.9060805439949036, -0.1844543218612671, 0.3807799518108368, 0,
2911
+ -0.08027800172567368, 0.8086723685264587, 0.5827555656433105, 0,
2912
+ -0.4154181182384491, -0.5585917234420776, 0.7179155349731445, 0,
2913
+ -0.06867414712905884, -0.009423808194696903, 0.10627774149179459, 1,
2914
+ ],
2915
+ radius: 0.021460847929120064,
2916
+ },
2917
+ 'thumb-metacarpal': {
2918
+ offsetMatrix: [
2919
+ -0.5012241005897522, -0.8650535345077515, -0.0213695727288723, 0,
2920
+ 0.7415963411331177, -0.4421543478965759, 0.5045139193534851, 0,
2921
+ -0.44587990641593933, 0.23702676594257355, 0.8631392121315002, 0,
2922
+ -0.032122574746608734, -0.01196830440312624, 0.07194234430789948, 1,
2923
+ ],
2924
+ radius: 0.019382517784833908,
2925
+ },
2926
+ 'thumb-phalanx-proximal': {
2927
+ offsetMatrix: [
2928
+ -0.3175753057003021, -0.9460570216178894, -0.06419729441404343, 0,
2929
+ 0.8958902955055237, -0.32153913378715515, 0.30658137798309326, 0,
2930
+ -0.3106854259967804, 0.03984907269477844, 0.9496771097183228, 0,
2931
+ -0.017625702545046806, -0.01967475935816765, 0.04387917369604111, 1,
2932
+ ],
2933
+ radius: 0.01228295173496008,
2934
+ },
2935
+ 'thumb-phalanx-distal': {
2936
+ offsetMatrix: [
2937
+ -0.4944636821746826, -0.8691971898078918, 0.001086252392269671, 0,
2938
+ 0.8307800889015198, -0.4722411036491394, 0.2946045398712158, 0,
2939
+ -0.25555649399757385, 0.14657381176948547, 0.9556186199188232, 0,
2940
+ -0.007126678712666035, -0.021021386608481407, 0.011786630377173424, 1,
2941
+ ],
2942
+ radius: 0.009768804535269737,
2943
+ },
2944
+ 'thumb-tip': {
2945
+ offsetMatrix: [
2946
+ -0.4944636821746826, -0.8691971898078918, 0.001086252392269671, 0,
2947
+ 0.8307800889015198, -0.4722411036491394, 0.2946045398712158, 0,
2948
+ -0.25555649399757385, 0.14657381176948547, 0.9556186199188232, 0,
2949
+ 0.0003423091256991029, -0.024528030306100845, -0.011410919018089771, 1,
2950
+ ],
2951
+ radius: 0.008768804371356964,
2952
+ },
2953
+ 'index-finger-metacarpal': {
2954
+ offsetMatrix: [
2955
+ 0.9060805439949036, -0.1844543218612671, 0.3807799518108368, 0,
2956
+ -0.08027800172567368, 0.8086723685264587, 0.5827555656433105, 0,
2957
+ -0.4154181182384491, -0.5585917234420776, 0.7179155349731445, 0,
2958
+ -0.038037415593862534, -0.0020236473064869642, 0.07626739144325256, 1,
2959
+ ],
2960
+ radius: 0.021228281781077385,
2961
+ },
2962
+ 'index-finger-phalanx-proximal': {
2963
+ offsetMatrix: [
2964
+ 0.7986818552017212, -0.35985732078552246, 0.48229536414146423, 0,
2965
+ 0.538311243057251, 0.7854709625244141, -0.30537736415863037, 0,
2966
+ -0.2689369022846222, 0.5035246014595032, 0.8210577368736267, 0,
2967
+ -0.006869405973702669, 0.033938243985176086, 0.04206443578004837, 1,
2968
+ ],
2969
+ radius: 0.010295259766280651,
2970
+ },
2971
+ 'index-finger-phalanx-intermediate': {
2972
+ offsetMatrix: [
2973
+ 0.8285930156707764, -0.32672837376594543, 0.4546217918395996, 0,
2974
+ 0.5577570199966431, 0.4116027057170868, -0.7207564115524292, 0,
2975
+ 0.04836784675717354, 0.8507823944091797, 0.5232869386672974, 0,
2976
+ 0.0033306588884443045, 0.014840902760624886, 0.010923954658210278, 1,
2977
+ ],
2978
+ radius: 0.00853810179978609,
2979
+ },
2980
+ 'index-finger-phalanx-distal': {
2981
+ offsetMatrix: [
2982
+ 0.8412464261054993, -0.35794928669929504, 0.4051857888698578, 0,
2983
+ 0.5139996409416199, 0.29711154103279114, -0.8046918511390686, 0,
2984
+ 0.16765329241752625, 0.8852096796035767, 0.4339304566383362, 0,
2985
+ 0.0021551470272243023, -0.0058362227864563465, -0.0017938464879989624,
2986
+ 1,
2987
+ ],
2988
+ radius: 0.007636196445673704,
2989
+ },
2990
+ 'index-finger-tip': {
2991
+ offsetMatrix: [
2992
+ 0.8412464261054993, -0.35794928669929504, 0.4051857888698578, 0,
2993
+ 0.5139996409416199, 0.29711154103279114, -0.8046918511390686, 0,
2994
+ 0.16765329241752625, 0.8852096796035767, 0.4339304566383362, 0,
2995
+ -0.00131594471167773, -0.025222131982445717, -0.012442642822861671, 1,
2996
+ ],
2997
+ radius: 0.006636196281760931,
2998
+ },
2999
+ 'middle-finger-metacarpal': {
3000
+ offsetMatrix: [
3001
+ 0.9060805439949036, -0.1844543218612671, 0.3807799518108368, 0,
3002
+ -0.08027800172567368, 0.8086723685264587, 0.5827555656433105, 0,
3003
+ -0.4154181182384491, -0.5585917234420776, 0.7179155349731445, 0,
3004
+ -0.05395089089870453, 0.003063359996303916, 0.07402937114238739, 1,
3005
+ ],
3006
+ radius: 0.021231964230537415,
3007
+ },
3008
+ 'middle-finger-phalanx-proximal': {
3009
+ offsetMatrix: [
3010
+ 0.9187911748886108, -0.1530158370733261, 0.36387869715690613, 0,
3011
+ 0.038666240870952606, 0.9522662162780762, 0.302808940410614, 0,
3012
+ -0.3928440511226654, -0.26414817571640015, 0.8808513283729553, 0,
3013
+ -0.02717282809317112, 0.04162866622209549, 0.03678669035434723, 1,
3014
+ ],
3015
+ radius: 0.01117393933236599,
3016
+ },
3017
+ 'middle-finger-phalanx-intermediate': {
3018
+ offsetMatrix: [
3019
+ 0.9228746294975281, -0.12856416404247284, 0.36300456523895264, 0,
3020
+ 0.14524033665657043, 0.9892153143882751, -0.01890045404434204, 0,
3021
+ -0.3566599190235138, 0.07016586512327194, 0.9315956234931946, 0,
3022
+ -0.01030921470373869, 0.05296773463487625, -0.0010256498353555799, 1,
3023
+ ],
3024
+ radius: 0.008030958473682404,
3025
+ },
3026
+ 'middle-finger-phalanx-distal': {
3027
+ offsetMatrix: [
3028
+ 0.9325166344642639, -0.040404170751571655, 0.35885775089263916, 0,
3029
+ 0.06836572289466858, 0.995502769947052, -0.0655682161450386, 0,
3030
+ -0.3545948565006256, 0.08567725121974945, 0.9310863614082336, 0,
3031
+ -0.0004833847051486373, 0.05103470757603645, -0.026690717786550522, 1,
3032
+ ],
3033
+ radius: 0.007629410829395056,
3034
+ },
3035
+ 'middle-finger-tip': {
3036
+ offsetMatrix: [
3037
+ 0.9325166344642639, -0.040404170751571655, 0.35885775089263916, 0,
3038
+ 0.06836572289466858, 0.995502769947052, -0.0655682161450386, 0,
3039
+ -0.3545948565006256, 0.08567725121974945, 0.9310863614082336, 0,
3040
+ 0.008158999495208263, 0.05004044249653816, -0.050120558589696884, 1,
3041
+ ],
3042
+ radius: 0.006629410665482283,
3043
+ },
3044
+ 'ring-finger-metacarpal': {
3045
+ offsetMatrix: [
3046
+ 0.9060805439949036, -0.1844543218612671, 0.3807799518108368, 0,
3047
+ -0.08027800172567368, 0.8086723685264587, 0.5827555656433105, 0,
3048
+ -0.4154181182384491, -0.5585917234420776, 0.7179155349731445, 0,
3049
+ -0.06732909381389618, 0.007902119308710098, 0.07209732383489609, 1,
3050
+ ],
3051
+ radius: 0.019088275730609894,
3052
+ },
3053
+ 'ring-finger-phalanx-proximal': {
3054
+ offsetMatrix: [
3055
+ 0.9391821026802063, -0.027994679287075996, 0.34227466583251953, 0,
3056
+ -0.18282271921634674, 0.8029410243034363, 0.5673282742500305, 0,
3057
+ -0.2907087206840515, -0.5954000353813171, 0.7489906549453735, 0,
3058
+ -0.047129884362220764, 0.03806127607822418, 0.032147664576768875, 1,
3059
+ ],
3060
+ radius: 0.00992213748395443,
3061
+ },
3062
+ 'ring-finger-phalanx-intermediate': {
3063
+ offsetMatrix: [
3064
+ 0.9249380826950073, 0.03699534013867378, 0.3783116042613983, 0,
3065
+ -0.12898847460746765, 0.9667453765869141, 0.2208271026611328, 0,
3066
+ -0.3575615882873535, -0.25304901599884033, 0.8989526629447937, 0,
3067
+ -0.03579339757561684, 0.06127955764532089, 0.002939916681498289, 1,
3068
+ ],
3069
+ radius: 0.007611672393977642,
3070
+ },
3071
+ 'ring-finger-phalanx-distal': {
3072
+ offsetMatrix: [
3073
+ 0.9001164436340332, 0.03983335196971893, 0.4338230490684509, 0,
3074
+ -0.09662467986345291, 0.9892624020576477, 0.10964841395616531, 0,
3075
+ -0.4247973561286926, -0.14061418175697327, 0.8943013548851013, 0,
3076
+ -0.026291755959391594, 0.06800390034914017, -0.02094830758869648, 1,
3077
+ ],
3078
+ radius: 0.007231088820844889,
3079
+ },
3080
+ 'ring-finger-tip': {
3081
+ offsetMatrix: [
3082
+ 0.9001164436340332, 0.03983335196971893, 0.4338230490684509, 0,
3083
+ -0.09662467986345291, 0.9892624020576477, 0.10964841395616531, 0,
3084
+ -0.4247973561286926, -0.14061418175697327, 0.8943013548851013, 0,
3085
+ -0.016345610842108727, 0.07300511747598648, -0.04263874143362045, 1,
3086
+ ],
3087
+ radius: 0.0062310886569321156,
3088
+ },
3089
+ 'pinky-finger-metacarpal': {
3090
+ offsetMatrix: [
3091
+ 0.8769711852073669, 0.31462907791137695, 0.36322021484375, 0,
3092
+ -0.4506046175956726, 0.801031768321991, 0.39408499002456665, 0,
3093
+ -0.16696058213710785, -0.5092697143554688, 0.8442559838294983, 0,
3094
+ -0.07460174709558487, 0.0062340241856873035, 0.06756893545389175, 1,
3095
+ ],
3096
+ radius: 0.01808827556669712,
3097
+ },
3098
+ 'pinky-finger-phalanx-proximal': {
3099
+ offsetMatrix: [
3100
+ 0.9498357176780701, 0.1553308218717575, 0.2714462876319885, 0,
3101
+ -0.3019258379936218, 0.6817675232887268, 0.6663586497306824, 0,
3102
+ -0.08155745267868042, -0.7148879170417786, 0.694466233253479, 0,
3103
+ -0.06697750836610794, 0.029482364654541016, 0.02902858518064022, 1,
3104
+ ],
3105
+ radius: 0.008483353070914745,
3106
+ },
3107
+ 'pinky-finger-phalanx-intermediate': {
3108
+ offsetMatrix: [
3109
+ 0.9214097261428833, 0.27928245067596436, 0.2701927423477173, 0,
3110
+ -0.3670244514942169, 0.8538867831230164, 0.36901235580444336, 0,
3111
+ -0.12765564024448395, -0.43917882442474365, 0.8892839550971985, 0,
3112
+ -0.06447203457355499, 0.05144399777054787, 0.0076942890882492065, 1,
3113
+ ],
3114
+ radius: 0.0067641944624483585,
3115
+ },
3116
+ 'pinky-finger-phalanx-distal': {
3117
+ offsetMatrix: [
3118
+ 0.9038633704185486, 0.23618005216121674, 0.3567195236682892, 0,
3119
+ -0.3532794713973999, 0.8823202252388, 0.3109731376171112, 0,
3120
+ -0.24129553139209747, -0.4070987403392792, 0.8809353709220886, 0,
3121
+ -0.06187915802001953, 0.060364335775375366, -0.010368337854743004, 1,
3122
+ ],
3123
+ radius: 0.0064259846694767475,
3124
+ },
3125
+ 'pinky-finger-tip': {
3126
+ offsetMatrix: [
3127
+ 0.9038633704185486, 0.23618005216121674, 0.3567195236682892, 0,
3128
+ -0.3532794713973999, 0.8823202252388, 0.3109731376171112, 0,
3129
+ -0.24129553139209747, -0.4070987403392792, 0.8809353709220886, 0,
3130
+ -0.056796226650476456, 0.07042007893323898, -0.02921444922685623, 1,
3131
+ ],
3132
+ radius: 0.005425984505563974,
3133
+ },
3134
+ },
3135
+ gripOffsetMatrix: [
3136
+ 0.08027800917625427, -0.8086723685264587, -0.5827556252479553, 0,
3137
+ -0.4154181480407715, -0.5585916638374329, 0.7179154753684998, 0,
3138
+ -0.9060805439949036, 0.1844543218612671, -0.3807799518108368, 0,
3139
+ -0.038054611533880234, -0.002910431008785963, 0.03720742464065552, 1,
3140
+ ],
3141
+ };
3142
+
3143
+ /**
3144
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3145
+ *
3146
+ * This source code is licensed under the MIT license found in the
3147
+ * LICENSE file in the root directory of this source tree.
3148
+ */
3149
+ const pointHandPose = {
3150
+ jointTransforms: {
3151
+ wrist: {
3152
+ offsetMatrix: [
3153
+ 0.9340395331382751, -0.13936476409435272, 0.32885703444480896, 0,
3154
+ -0.005510995630174875, 0.914999783039093, 0.40341612696647644, 0,
3155
+ -0.3571262061595917, -0.37861889600753784, 0.8538784384727478, 0,
3156
+ -0.05789132043719292, 0.01670890860259533, 0.11183350533246994, 1,
3157
+ ],
3158
+ radius: 0.021460847929120064,
3159
+ },
3160
+ 'thumb-metacarpal': {
3161
+ offsetMatrix: [
3162
+ 0.02145560085773468, -0.9978390336036682, 0.0621047280728817, 0,
3163
+ 0.41311800479888916, 0.06541631370782852, 0.9083252549171448, 0,
3164
+ -0.9104245901107788, 0.006167683284729719, 0.4136286973953247, 0,
3165
+ -0.016488194465637207, 0.012708572670817375, 0.08862338215112686, 1,
3166
+ ],
3167
+ radius: 0.019382517784833908,
3168
+ },
3169
+ 'thumb-phalanx-proximal': {
3170
+ offsetMatrix: [
3171
+ 0.21270370483398438, -0.966137707233429, 0.14606566727161407, 0,
3172
+ 0.49890995025634766, 0.2359165996313095, 0.8339261412620544, 0,
3173
+ -0.8401462435722351, -0.10450579971075058, 0.5321959853172302, 0,
3174
+ 0.013112368993461132, 0.012508046813309193, 0.07517509907484055, 1,
3175
+ ],
3176
+ radius: 0.01228295173496008,
3177
+ },
3178
+ 'thumb-phalanx-distal': {
3179
+ offsetMatrix: [
3180
+ 0.01653280481696129, -0.9986647963523865, 0.048943229019641876, 0,
3181
+ 0.26313456892967224, 0.051570065319538116, 0.9633802771568298, 0,
3182
+ -0.9646173715591431, -0.0030490627977997065, 0.26363563537597656, 0,
3183
+ 0.04150351136922836, 0.016039609909057617, 0.05719054117798805, 1,
3184
+ ],
3185
+ radius: 0.009768804535269737,
3186
+ },
3187
+ 'thumb-tip': {
3188
+ offsetMatrix: [
3189
+ 0.01653280481696129, -0.9986647963523865, 0.048943229019641876, 0,
3190
+ 0.26313456892967224, 0.051570065319538116, 0.9633802771568298, 0,
3191
+ -0.9646173715591431, -0.0030490627977997065, 0.26363563537597656, 0,
3192
+ 0.06548332422971725, 0.01683700829744339, 0.0516640841960907, 1,
3193
+ ],
3194
+ radius: 0.008768804371356964,
3195
+ },
3196
+ 'index-finger-metacarpal': {
3197
+ offsetMatrix: [
3198
+ 0.9340395331382751, -0.13936476409435272, 0.32885703444480896, 0,
3199
+ -0.005510995630174875, 0.914999783039093, 0.40341612696647644, 0,
3200
+ -0.3571262061595917, -0.37861889600753784, 0.8538784384727478, 0,
3201
+ -0.02592567168176174, 0.019982583820819855, 0.08479326963424683, 1,
3202
+ ],
3203
+ radius: 0.021228281781077385,
3204
+ },
3205
+ 'index-finger-phalanx-proximal': {
3206
+ offsetMatrix: [
3207
+ 0.9063700437545776, -0.21756279468536377, 0.3621589243412018, 0,
3208
+ 0.0970839336514473, 0.9415287375450134, 0.3226419687271118, 0,
3209
+ -0.41117796301841736, -0.2572731077671051, 0.8744958639144897, 0,
3210
+ -0.0015709538711234927, 0.043078210204839706, 0.034657616168260574, 1,
3211
+ ],
3212
+ radius: 0.010295259766280651,
3213
+ },
3214
+ 'index-finger-phalanx-intermediate': {
3215
+ offsetMatrix: [
3216
+ 0.9159826040267944, -0.1651475727558136, 0.36565208435058594, 0,
3217
+ 0.09755707532167435, 0.9756820797920227, 0.1962820291519165, 0,
3218
+ -0.3891757130622864, -0.14411886036396027, 0.9098196625709534, 0,
3219
+ 0.014023927971720695, 0.052835866808891296, 0.0014903299743309617, 1,
3220
+ ],
3221
+ radius: 0.00853810179978609,
3222
+ },
3223
+ 'index-finger-phalanx-distal': {
3224
+ offsetMatrix: [
3225
+ 0.9378057718276978, -0.12329639494419098, 0.3245268166065216, 0,
3226
+ 0.032558172941207886, 0.9619227051734924, 0.2713746726512909, 0,
3227
+ -0.3456292748451233, -0.2439306229352951, 0.9061115384101868, 0,
3228
+ 0.023482320830225945, 0.05633850023150444, -0.020621655508875847, 1,
3229
+ ],
3230
+ radius: 0.007636196445673704,
3231
+ },
3232
+ 'index-finger-tip': {
3233
+ offsetMatrix: [
3234
+ 0.9378057718276978, -0.12329639494419098, 0.3245268166065216, 0,
3235
+ 0.032558172941207886, 0.9619227051734924, 0.2713746726512909, 0,
3236
+ -0.3456292748451233, -0.2439306229352951, 0.9061115384101868, 0,
3237
+ 0.03096788562834263, 0.06281610578298569, -0.040703095495700836, 1,
3238
+ ],
3239
+ radius: 0.006636196281760931,
3240
+ },
3241
+ 'middle-finger-metacarpal': {
3242
+ offsetMatrix: [
3243
+ 0.9340395331382751, -0.13936476409435272, 0.32885703444480896, 0,
3244
+ -0.005510995630174875, 0.914999783039093, 0.40341612696647644, 0,
3245
+ -0.3571262061595917, -0.37861889600753784, 0.8538784384727478, 0,
3246
+ -0.04184452444314957, 0.022474845871329308, 0.08177298307418823, 1,
3247
+ ],
3248
+ radius: 0.021231964230537415,
3249
+ },
3250
+ 'middle-finger-phalanx-proximal': {
3251
+ offsetMatrix: [
3252
+ 0.9720265865325928, -0.08313076198101044, 0.21966552734375, 0,
3253
+ 0.20477405190467834, 0.7580050826072693, -0.6192700862884521, 0,
3254
+ -0.11502730846405029, 0.6469289064407349, 0.7538246512413025, 0,
3255
+ -0.022107340395450592, 0.05035499855875969, 0.02970452979207039, 1,
3256
+ ],
3257
+ radius: 0.01117393933236599,
3258
+ },
3259
+ 'middle-finger-phalanx-intermediate': {
3260
+ offsetMatrix: [
3261
+ 0.9779140949249268, -0.07129573822021484, 0.19646917283535004, 0,
3262
+ 0.1287083923816681, -0.5352076292037964, -0.8348574042320251, 0,
3263
+ 0.1646735966205597, 0.8417060971260071, -0.5142109394073486, 0,
3264
+ -0.017169542610645294, 0.022584279999136925, -0.00265491777099669, 1,
3265
+ ],
3266
+ radius: 0.008030958473682404,
3267
+ },
3268
+ 'middle-finger-phalanx-distal': {
3269
+ offsetMatrix: [
3270
+ 0.9774913787841797, -0.19657190144062042, 0.07661263644695282, 0,
3271
+ -0.1924918293952942, -0.9796126484870911, -0.05749811604619026, 0,
3272
+ 0.08635343611240387, 0.041456472128629684, -0.995401918888092, 0,
3273
+ -0.02170622907578945, -0.0006043742760084569, 0.011511396616697311, 1,
3274
+ ],
3275
+ radius: 0.007629410829395056,
3276
+ },
3277
+ 'middle-finger-tip': {
3278
+ offsetMatrix: [
3279
+ 0.9774913787841797, -0.19657190144062042, 0.07661263644695282, 0,
3280
+ -0.1924918293952942, -0.9796126484870911, -0.05749811604619026, 0,
3281
+ 0.08635343611240387, 0.041456472128629684, -0.995401918888092, 0,
3282
+ -0.02438267692923546, -0.0026927536819130182, 0.03627248480916023, 1,
3283
+ ],
3284
+ radius: 0.006629410665482283,
3285
+ },
3286
+ 'ring-finger-metacarpal': {
3287
+ offsetMatrix: [
3288
+ 0.9340395331382751, -0.13936476409435272, 0.32885703444480896, 0,
3289
+ -0.005510995630174875, 0.914999783039093, 0.40341612696647644, 0,
3290
+ -0.3571262061595917, -0.37861889600753784, 0.8538784384727478, 0,
3291
+ -0.05944233387708664, 0.0264605600386858, 0.07478221505880356, 1,
3292
+ ],
3293
+ radius: 0.019088275730609894,
3294
+ },
3295
+ 'ring-finger-phalanx-proximal': {
3296
+ offsetMatrix: [
3297
+ 0.9842101335525513, 0.024470895528793335, 0.1753024309873581, 0,
3298
+ 0.12200043350458145, 0.6237703561782837, -0.7720272541046143, 0,
3299
+ -0.12824076414108276, 0.7812241315841675, 0.610936164855957, 0,
3300
+ -0.04249368980526924, 0.0467497780919075, 0.027722163125872612, 1,
3301
+ ],
3302
+ radius: 0.00992213748395443,
3303
+ },
3304
+ 'ring-finger-phalanx-intermediate': {
3305
+ offsetMatrix: [
3306
+ 0.9941774606704712, 0.05949164181947708, 0.08983955532312393, 0,
3307
+ 0.10504482686519623, -0.7208291888237, -0.6851072907447815, 0,
3308
+ 0.024001073092222214, 0.6905553936958313, -0.7228817939758301, 0,
3309
+ -0.0374927744269371, 0.016285063698887825, 0.0038980208337306976, 1,
3310
+ ],
3311
+ radius: 0.007611672393977642,
3312
+ },
3313
+ 'ring-finger-phalanx-distal': {
3314
+ offsetMatrix: [
3315
+ 0.9995742440223694, 0.01638498157262802, 0.02412819117307663, 0,
3316
+ 0.007813597097992897, -0.9474818110466003, 0.31971633434295654, 0,
3317
+ 0.028100071474909782, -0.31939181685447693, -0.9472070932388306, 0,
3318
+ -0.038130562752485275, -0.0020653479732573032, 0.02310742810368538, 1,
3319
+ ],
3320
+ radius: 0.007231088820844889,
3321
+ },
3322
+ 'ring-finger-tip': {
3323
+ offsetMatrix: [
3324
+ 0.9995742440223694, 0.01638498157262802, 0.02412819117307663, 0,
3325
+ 0.007813597097992897, -0.9474818110466003, 0.31971633434295654, 0,
3326
+ 0.028100071474909782, -0.31939181685447693, -0.9472070932388306, 0,
3327
+ -0.0390593595802784, 0.004176302347332239, 0.0466572530567646, 1,
3328
+ ],
3329
+ radius: 0.0062310886569321156,
3330
+ },
3331
+ 'pinky-finger-metacarpal': {
3332
+ offsetMatrix: [
3333
+ 0.9147363901138306, 0.3458845317363739, 0.20885537564754486, 0,
3334
+ -0.3923271894454956, 0.8839452862739563, 0.2544005811214447, 0,
3335
+ -0.09662359952926636, -0.3146490156650543, 0.9442773461341858, 0,
3336
+ -0.06715242564678192, 0.024195827543735504, 0.07137546688318253, 1,
3337
+ ],
3338
+ radius: 0.01808827556669712,
3339
+ },
3340
+ 'pinky-finger-phalanx-proximal': {
3341
+ offsetMatrix: [
3342
+ 0.9613109827041626, 0.22439135611057281, 0.15977802872657776, 0,
3343
+ 0.01002211682498455, 0.5511574745178223, -0.8343409299850464, 0,
3344
+ -0.27528178691864014, 0.8036624789237976, 0.5275853276252747, 0,
3345
+ -0.06273911893367767, 0.038559623062610626, 0.028268879279494286, 1,
3346
+ ],
3347
+ radius: 0.008483353070914745,
3348
+ },
3349
+ 'pinky-finger-phalanx-intermediate': {
3350
+ offsetMatrix: [
3351
+ 0.9820972084999084, 0.18811029195785522, -0.00995189044624567, 0,
3352
+ 0.14063723385334015, -0.7673450708389282, -0.6256227493286133, 0,
3353
+ -0.12532226741313934, 0.6130226850509644, -0.7800630927085876, 0,
3354
+ -0.05428232625126839, 0.013870777562260628, 0.012061242014169693, 1,
3355
+ ],
3356
+ radius: 0.0067641944624483585,
3357
+ },
3358
+ 'pinky-finger-phalanx-distal': {
3359
+ offsetMatrix: [
3360
+ 0.9744614362716675, 0.20454788208007812, -0.09265263378620148, 0,
3361
+ 0.22429193556308746, -0.9065253138542175, 0.35764020681381226, 0,
3362
+ -0.010836843401193619, -0.3692878782749176, -0.9292529225349426, 0,
3363
+ -0.05173685774207115, 0.0014194445684552193, 0.02790539152920246, 1,
3364
+ ],
3365
+ radius: 0.0064259846694767475,
3366
+ },
3367
+ 'pinky-finger-tip': {
3368
+ offsetMatrix: [
3369
+ 0.9744614362716675, 0.20454788208007812, -0.09265263378620148, 0,
3370
+ 0.22429193556308746, -0.9065253138542175, 0.35764020681381226, 0,
3371
+ -0.010836843401193619, -0.3692878782749176, -0.9292529225349426, 0,
3372
+ -0.05098633095622063, 0.008463085629045963, 0.048688892275094986, 1,
3373
+ ],
3374
+ radius: 0.005425984505563974,
3375
+ },
3376
+ },
3377
+ gripOffsetMatrix: [
3378
+ 0.005510995630174875, -0.9149997234344482, -0.40341615676879883, 0,
3379
+ -0.3571262061595917, -0.37861889600753784, 0.8538784384727478, 0,
3380
+ -0.9340395331382751, 0.13936474919319153, -0.32885703444480896, 0,
3381
+ -0.031803809106349945, 0.007837686687707901, 0.04313928261399269, 1,
3382
+ ],
3383
+ };
3384
+
3385
+ /**
3386
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3387
+ *
3388
+ * This source code is licensed under the MIT license found in the
3389
+ * LICENSE file in the root directory of this source tree.
3390
+ */
3391
+ const relaxedHandPose = {
3392
+ jointTransforms: {
3393
+ wrist: {
3394
+ offsetMatrix: [
3395
+ 0.9616971015930176, -0.13805118203163147, 0.2368120402097702, 0,
3396
+ 0.0005348679260350764, 0.8648636937141418, 0.5020061135292053, 0,
3397
+ -0.2741127610206604, -0.48265108466148376, 0.8318111300468445, 0,
3398
+ -0.04913589730858803, 0.0021463718730956316, 0.11701996624469757, 1,
3399
+ ],
3400
+ radius: 0.021460847929120064,
3401
+ },
3402
+ 'thumb-metacarpal': {
3403
+ offsetMatrix: [
3404
+ -0.07536252588033676, -0.9959676265716553, -0.04867160692811012, 0,
3405
+ 0.5877083539962769, -0.08379616588354111, 0.8047218918800354, 0,
3406
+ -0.8055551648139954, 0.032041035592556, 0.5916536450386047, 0,
3407
+ -0.010643752291798592, 0.0006936835707165301, 0.08736639469861984, 1,
3408
+ ],
3409
+ radius: 0.019382517784833908,
3410
+ },
3411
+ 'thumb-phalanx-proximal': {
3412
+ offsetMatrix: [
3413
+ 0.1374533325433731, -0.9904957413673401, 0.004982374142855406, 0,
3414
+ 0.5534393787384033, 0.08097179979085922, 0.8289443850517273, 0,
3415
+ -0.8214688897132874, -0.11118389666080475, 0.559309184551239, 0,
3416
+ 0.015547193586826324, -0.0003480653394944966, 0.0681300163269043, 1,
3417
+ ],
3418
+ radius: 0.01228295173496008,
3419
+ },
3420
+ 'thumb-phalanx-distal': {
3421
+ offsetMatrix: [
3422
+ -0.04659227654337883, -0.9974699020385742, -0.05369402840733528, 0,
3423
+ 0.6812446117401123, -0.07104194164276123, 0.728600800037384, 0,
3424
+ -0.7305715084075928, -0.002631746232509613, 0.6828309893608093, 0,
3425
+ 0.04330715537071228, 0.003409178927540779, 0.0492292083799839, 1,
3426
+ ],
3427
+ radius: 0.009768804535269737,
3428
+ },
3429
+ 'thumb-tip': {
3430
+ offsetMatrix: [
3431
+ -0.04659227654337883, -0.9974699020385742, -0.05369402840733528, 0,
3432
+ 0.6812446117401123, -0.07104194164276123, 0.728600800037384, 0,
3433
+ -0.7305715084075928, -0.002631746232509613, 0.6828309893608093, 0,
3434
+ 0.062003348022699356, 0.004069602582603693, 0.03322213143110275, 1,
3435
+ ],
3436
+ radius: 0.008768804371356964,
3437
+ },
3438
+ 'index-finger-metacarpal': {
3439
+ offsetMatrix: [
3440
+ 0.9616971015930176, -0.13805118203163147, 0.2368120402097702, 0,
3441
+ 0.0005348679260350764, 0.8648636937141418, 0.5020061135292053, 0,
3442
+ -0.2741127610206604, -0.48265108466148376, 0.8318111300468445, 0,
3443
+ -0.02009812369942665, 0.008770795539021492, 0.08660387247800827, 1,
3444
+ ],
3445
+ radius: 0.021228281781077385,
3446
+ },
3447
+ 'index-finger-phalanx-proximal': {
3448
+ offsetMatrix: [
3449
+ 0.9001791477203369, -0.2598813474178314, 0.3494834005832672, 0,
3450
+ 0.06073702871799469, 0.8695210218429565, 0.490146666765213, 0,
3451
+ -0.4312632381916046, -0.41999316215515137, 0.7985095381736755, 0,
3452
+ -0.00017739279428496957, 0.03890012577176094, 0.039073407649993896, 1,
3453
+ ],
3454
+ radius: 0.010295259766280651,
3455
+ },
3456
+ 'index-finger-phalanx-intermediate': {
3457
+ offsetMatrix: [
3458
+ 0.9082008600234985, -0.20898112654685974, 0.36262574791908264, 0,
3459
+ 0.11045389622449875, 0.9553793668746948, 0.27395179867744446, 0,
3460
+ -0.40369608998298645, -0.20874978601932526, 0.8907597661018372, 0,
3461
+ 0.01617925800383091, 0.05482936650514603, 0.008788082748651505, 1,
3462
+ ],
3463
+ radius: 0.00853810179978609,
3464
+ },
3465
+ 'index-finger-phalanx-distal': {
3466
+ offsetMatrix: [
3467
+ 0.9309692978858948, -0.16783711314201355, 0.32423174381256104, 0,
3468
+ 0.1080828532576561, 0.9749603867530823, 0.1943446695804596, 0,
3469
+ -0.34873148798942566, -0.14588497579097748, 0.9257990717887878, 0,
3470
+ 0.02599053829908371, 0.059902746230363846, -0.012860597111284733, 1,
3471
+ ],
3472
+ radius: 0.007636196445673704,
3473
+ },
3474
+ 'index-finger-tip': {
3475
+ offsetMatrix: [
3476
+ 0.9309692978858948, -0.16783711314201355, 0.32423174381256104, 0,
3477
+ 0.1080828532576561, 0.9749603867530823, 0.1943446695804596, 0,
3478
+ -0.34873148798942566, -0.14588497579097748, 0.9257990717887878, 0,
3479
+ 0.03362493962049484, 0.06421422213315964, -0.033461250364780426, 1,
3480
+ ],
3481
+ radius: 0.006636196281760931,
3482
+ },
3483
+ 'middle-finger-metacarpal': {
3484
+ offsetMatrix: [
3485
+ 0.9616971015930176, -0.13805118203163147, 0.2368120402097702, 0,
3486
+ 0.0005348679260350764, 0.8648636937141418, 0.5020061135292053, 0,
3487
+ -0.2741127610206604, -0.48265108466148376, 0.8318111300468445, 0,
3488
+ -0.03627845644950867, 0.011579737067222595, 0.08550142496824265, 1,
3489
+ ],
3490
+ radius: 0.021231964230537415,
3491
+ },
3492
+ 'middle-finger-phalanx-proximal': {
3493
+ offsetMatrix: [
3494
+ 0.9876697659492493, -0.06786545366048813, 0.1410750150680542, 0,
3495
+ -0.015095947310328484, 0.855663537979126, 0.5173118710517883, 0,
3496
+ -0.15582047402858734, -0.5130629539489746, 0.8440889716148376, 0,
3497
+ -0.021259509027004242, 0.04587256908416748, 0.03659208118915558, 1,
3498
+ ],
3499
+ radius: 0.01117393933236599,
3500
+ },
3501
+ 'middle-finger-phalanx-intermediate': {
3502
+ offsetMatrix: [
3503
+ 0.988391637802124, -0.04354291781783104, 0.14555205404758453, 0,
3504
+ 0.008894841186702251, 0.9729899168014526, 0.23067504167556763, 0,
3505
+ -0.15166506171226501, -0.22670257091522217, 0.9620829224586487, 0,
3506
+ -0.014570588245987892, 0.06789684295654297, 0.0003578895702958107, 1,
3507
+ ],
3508
+ radius: 0.008030958473682404,
3509
+ },
3510
+ 'middle-finger-phalanx-distal': {
3511
+ offsetMatrix: [
3512
+ 0.9853697419166565, 0.044260796159505844, 0.16458062827587128, 0,
3513
+ -0.0757969319820404, 0.9787378311157227, 0.19059516489505768, 0,
3514
+ -0.1526455283164978, -0.20028135180473328, 0.9677740931510925, 0,
3515
+ -0.010392282158136368, 0.07414241135120392, -0.026147106662392616, 1,
3516
+ ],
3517
+ radius: 0.007629410829395056,
3518
+ },
3519
+ 'middle-finger-tip': {
3520
+ offsetMatrix: [
3521
+ 0.9853697419166565, 0.044260796159505844, 0.16458062827587128, 0,
3522
+ -0.0757969319820404, 0.9787378311157227, 0.19059516489505768, 0,
3523
+ -0.1526455283164978, -0.20028135180473328, 0.9677740931510925, 0,
3524
+ -0.0069718430750072, 0.08024183660745621, -0.05014154314994812, 1,
3525
+ ],
3526
+ radius: 0.006629410665482283,
3527
+ },
3528
+ 'ring-finger-metacarpal': {
3529
+ offsetMatrix: [
3530
+ 0.9616971015930176, -0.13805118203163147, 0.2368120402097702, 0,
3531
+ 0.0005348679260350764, 0.8648636937141418, 0.5020061135292053, 0,
3532
+ -0.2741127610206604, -0.48265108466148376, 0.8318111300468445, 0,
3533
+ -0.05402477830648422, 0.015797706320881844, 0.08152295649051666, 1,
3534
+ ],
3535
+ radius: 0.019088275730609894,
3536
+ },
3537
+ 'ring-finger-phalanx-proximal': {
3538
+ offsetMatrix: [
3539
+ 0.9940828680992126, 0.05735103040933609, 0.09224652498960495, 0,
3540
+ -0.10022822767496109, 0.8116500377655029, 0.5754809379577637, 0,
3541
+ -0.041867565363645554, -0.5813214182853699, 0.8125960826873779, 0,
3542
+ -0.041623555123806, 0.04171867296099663, 0.03582974523305893, 1,
3543
+ ],
3544
+ radius: 0.00992213748395443,
3545
+ },
3546
+ 'ring-finger-phalanx-intermediate': {
3547
+ offsetMatrix: [
3548
+ 0.9843675494194031, 0.12044742703437805, 0.12850022315979004, 0,
3549
+ -0.15629759430885315, 0.9337108135223389, 0.3221098482608795, 0,
3550
+ -0.08118485659360886, -0.3371586799621582, 0.937940776348114, 0,
3551
+ -0.039990875869989395, 0.06438793987035751, 0.004141641780734062, 1,
3552
+ ],
3553
+ radius: 0.007611672393977642,
3554
+ },
3555
+ 'ring-finger-phalanx-distal': {
3556
+ offsetMatrix: [
3557
+ 0.9748351573944092, 0.11857274919748306, 0.18877571821212769, 0,
3558
+ -0.15575434267520905, 0.9681083559989929, 0.19623035192489624, 0,
3559
+ -0.15948788821697235, -0.22069483995437622, 0.9622148275375366, 0,
3560
+ -0.03783353418111801, 0.07334739714860916, -0.020782606676220894, 1,
3561
+ ],
3562
+ radius: 0.007231088820844889,
3563
+ },
3564
+ 'ring-finger-tip': {
3565
+ offsetMatrix: [
3566
+ 0.9748351573944092, 0.11857274919748306, 0.18877571821212769, 0,
3567
+ -0.15575434267520905, 0.9681083559989929, 0.19623035192489624, 0,
3568
+ -0.15948788821697235, -0.22069483995437622, 0.9622148275375366, 0,
3569
+ -0.03445569798350334, 0.0802423357963562, -0.04392268508672714, 1,
3570
+ ],
3571
+ radius: 0.0062310886569321156,
3572
+ },
3573
+ 'pinky-finger-metacarpal': {
3574
+ offsetMatrix: [
3575
+ 0.9181402921676636, 0.35625091195106506, 0.17350243031978607, 0,
3576
+ -0.39615097641944885, 0.8352503180503845, 0.38134080171585083, 0,
3577
+ -0.009065053425729275, -0.41885748505592346, 0.9080066680908203, 0,
3578
+ -0.06191859766840935, 0.013620133511722088, 0.07850203663110733, 1,
3579
+ ],
3580
+ radius: 0.01808827556669712,
3581
+ },
3582
+ 'pinky-finger-phalanx-proximal': {
3583
+ offsetMatrix: [
3584
+ 0.9714386463165283, 0.236698180437088, -0.016745081171393394, 0,
3585
+ -0.18462024629116058, 0.7982627749443054, 0.5733163952827454, 0,
3586
+ 0.14906984567642212, -0.5538501739501953, 0.8191629648208618, 0,
3587
+ -0.061502378433942795, 0.032741155475378036, 0.03705105185508728, 1,
3588
+ ],
3589
+ radius: 0.008483353070914745,
3590
+ },
3591
+ 'pinky-finger-phalanx-intermediate': {
3592
+ offsetMatrix: [
3593
+ 0.9337416291236877, 0.35620439052581787, -0.03527557849884033, 0,
3594
+ -0.33203884959220886, 0.8987522721290588, 0.28634607791900635, 0,
3595
+ 0.13370157778263092, -0.2556603252887726, 0.9574766755104065, 0,
3596
+ -0.06608185172080994, 0.049755651503801346, 0.011886020191013813, 1,
3597
+ ],
3598
+ radius: 0.0067641944624483585,
3599
+ },
3600
+ 'pinky-finger-phalanx-distal': {
3601
+ offsetMatrix: [
3602
+ 0.9419984817504883, 0.3303581774234772, 0.059175245463848114, 0,
3603
+ -0.33483216166496277, 0.9130291938781738, 0.23294763267040253, 0,
3604
+ 0.02292730286717415, -0.2392500638961792, 0.970687210559845, 0,
3605
+ -0.0687975287437439, 0.054948460310697556, -0.007561664097011089, 1,
3606
+ ],
3607
+ radius: 0.0064259846694767475,
3608
+ },
3609
+ 'pinky-finger-tip': {
3610
+ offsetMatrix: [
3611
+ 0.9419984817504883, 0.3303581774234772, 0.059175245463848114, 0,
3612
+ -0.33483216166496277, 0.9130291938781738, 0.23294763267040253, 0,
3613
+ 0.02292730286717415, -0.2392500638961792, 0.970687210559845, 0,
3614
+ -0.06947512179613113, 0.0613851435482502, -0.028543535619974136, 1,
3615
+ ],
3616
+ radius: 0.005425984505563974,
3617
+ },
3618
+ },
3619
+ gripOffsetMatrix: [
3620
+ -0.0005348679260350764, -0.8648636937141418, -0.5020061135292053, 0,
3621
+ -0.2741127908229828, -0.48265108466148376, 0.8318111896514893, 0,
3622
+ -0.9616971015930176, 0.13805119693279266, -0.2368120402097702, 0,
3623
+ -0.02878567762672901, 0.0017147823236882687, 0.04536811262369156, 1,
3624
+ ],
3625
+ };
3626
+
3627
+ /**
3628
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3629
+ *
3630
+ * This source code is licensed under the MIT license found in the
3631
+ * LICENSE file in the root directory of this source tree.
3632
+ */
3633
+ const oculusHandConfig = {
3634
+ profileId: 'oculus-hand',
3635
+ fallbackProfileIds: [
3636
+ 'generic-hand',
3637
+ 'generic-hand-select',
3638
+ 'generic-trigger',
3639
+ ],
3640
+ poses: {
3641
+ default: relaxedHandPose,
3642
+ pinch: pinchHandPose,
3643
+ point: pointHandPose,
3644
+ },
3684
3645
  };
3685
- class XRWebGLLayer extends XRLayer {
3686
- constructor(session, context, layerInit = {}) {
3687
- super();
3688
- if (session[PRIVATE$6].ended) {
3689
- throw new DOMException('Session has ended', 'InvalidStateError');
3646
+ const XRHandGamepadConfig = {
3647
+ mapping: GamepadMappingType.None,
3648
+ buttons: [{ id: 'pinch', type: 'analog', eventTrigger: 'select' }],
3649
+ axes: [],
3650
+ };
3651
+ const fromPosition = create$2();
3652
+ const fromQuaternion = create();
3653
+ const fromScale = create$2();
3654
+ const toPosition = create$2();
3655
+ const toQuaternion = create();
3656
+ const toScale = create$2();
3657
+ const interpolatedPosition = create$2();
3658
+ const interpolatedQuaternion = create();
3659
+ const interpolatedScale = create$2();
3660
+ const interpolateMatrix = (out, fromMatrix, toMatrix, alpha) => {
3661
+ getTranslation(fromPosition, fromMatrix);
3662
+ getRotation(fromQuaternion, fromMatrix);
3663
+ getScaling(fromScale, fromMatrix);
3664
+ getTranslation(toPosition, toMatrix);
3665
+ getRotation(toQuaternion, toMatrix);
3666
+ getScaling(toScale, toMatrix);
3667
+ lerp(interpolatedPosition, fromPosition, toPosition, alpha);
3668
+ slerp(interpolatedQuaternion, fromQuaternion, toQuaternion, alpha);
3669
+ lerp(interpolatedScale, fromScale, toScale, alpha);
3670
+ fromRotationTranslationScale(out, interpolatedQuaternion, interpolatedPosition, interpolatedScale);
3671
+ return out;
3672
+ };
3673
+ const mirrorMultiplierMatrix = [
3674
+ 1, -1, -1, 0, -1, 1, 1, 0, -1, 1, 1, 0, -1, 1, 1, 1,
3675
+ ];
3676
+ const mirrorMatrixToRight = (matrixLeft) => {
3677
+ for (let i = 0; i < 16; i++) {
3678
+ matrixLeft[i] *= mirrorMultiplierMatrix[i];
3679
+ }
3680
+ };
3681
+ const PRIVATE$5 = Symbol('@immersive-web-emulation-runtime/xr-hand-input');
3682
+ class XRHandInput extends XRTrackedInput {
3683
+ constructor(handInputConfig, handedness, globalSpace) {
3684
+ if (handedness !== XRHandedness.Left && handedness !== XRHandedness.Right) {
3685
+ throw new DOMException('handedness for XRHandInput must be either "left" or "right"', 'InvalidStateError');
3690
3686
  }
3691
- // TO-DO: Check that the context attribute has xrCompatible set to true
3692
- // may require polyfilling the context and perhaps canvas.getContext
3693
- // Default values for XRWebGLLayerInit, can be overridden by layerInit
3694
- const config = { ...defaultLayerInit, ...layerInit };
3687
+ if (!handInputConfig.poses.default || !handInputConfig.poses.pinch) {
3688
+ throw new DOMException('"default" and "pinch" hand pose configs are required', 'InvalidStateError');
3689
+ }
3690
+ const targetRaySpace = new XRSpace(globalSpace);
3691
+ const gripSpace = new XRSpace(targetRaySpace);
3692
+ const profiles = [
3693
+ handInputConfig.profileId,
3694
+ ...handInputConfig.fallbackProfileIds,
3695
+ ];
3696
+ const hand = new XRHand();
3697
+ Object.values(XRHandJoint).forEach((jointName) => {
3698
+ hand.set(jointName, new XRJointSpace(jointName, targetRaySpace));
3699
+ });
3700
+ const inputSource = new XRInputSource(handedness, XRTargetRayMode.TrackedPointer, profiles, targetRaySpace, new Gamepad(XRHandGamepadConfig), gripSpace, hand);
3701
+ super(inputSource);
3695
3702
  this[PRIVATE$5] = {
3696
- session,
3697
- context,
3698
- antialias: config.antialias,
3703
+ poseId: 'default',
3704
+ poses: handInputConfig.poses,
3699
3705
  };
3706
+ this.updateHandPose();
3700
3707
  }
3701
- get context() {
3702
- return this[PRIVATE$5].context;
3703
- }
3704
- get antialias() {
3705
- return this[PRIVATE$5].antialias;
3706
- }
3707
- get ignoreDepthValues() {
3708
- return true;
3708
+ get poseId() {
3709
+ return this[PRIVATE$5].poseId;
3709
3710
  }
3710
- get framebuffer() {
3711
- return null;
3711
+ set poseId(poseId) {
3712
+ if (!this[PRIVATE$5].poses[poseId]) {
3713
+ console.warn(`Pose config ${poseId} not found`);
3714
+ return;
3715
+ }
3716
+ this[PRIVATE$5].poseId = poseId;
3712
3717
  }
3713
- get framebufferWidth() {
3714
- return this[PRIVATE$5].context.drawingBufferWidth;
3718
+ updateHandPose() {
3719
+ const targetPose = this[PRIVATE$5].poses[this[PRIVATE$5].poseId];
3720
+ const pinchPose = this[PRIVATE$5].poses.pinch;
3721
+ Object.values(XRHandJoint).forEach((jointName) => {
3722
+ const targetJointMatrix = targetPose.jointTransforms[jointName].offsetMatrix;
3723
+ const pinchJointMatrix = pinchPose.jointTransforms[jointName].offsetMatrix;
3724
+ const jointSpace = this.inputSource.hand.get(jointName);
3725
+ interpolateMatrix(jointSpace[PRIVATE$l].offsetMatrix, targetJointMatrix, pinchJointMatrix, this.pinchValue);
3726
+ if (this.inputSource.handedness === XRHandedness.Right) {
3727
+ mirrorMatrixToRight(jointSpace[PRIVATE$l].offsetMatrix);
3728
+ }
3729
+ jointSpace[PRIVATE$f].radius =
3730
+ (1 - this.pinchValue) * targetPose.jointTransforms[jointName].radius +
3731
+ this.pinchValue * pinchPose.jointTransforms[jointName].radius;
3732
+ });
3733
+ if (targetPose.gripOffsetMatrix && pinchPose.gripOffsetMatrix) {
3734
+ interpolateMatrix(this.inputSource.gripSpace[PRIVATE$l].offsetMatrix, targetPose.gripOffsetMatrix, pinchPose.gripOffsetMatrix, this.pinchValue);
3735
+ }
3715
3736
  }
3716
- get framebufferHeight() {
3717
- return this[PRIVATE$5].context.drawingBufferHeight;
3737
+ get pinchValue() {
3738
+ return this[PRIVATE$i].inputSource.gamepad[PRIVATE$k]
3739
+ .buttonsMap['pinch'].value;
3718
3740
  }
3719
- getViewport(view) {
3720
- if (view[PRIVATE$g].session !== this[PRIVATE$5].session) {
3721
- throw new DOMException("View's session differs from Layer's session", 'InvalidStateError');
3741
+ updatePinchValue(value) {
3742
+ if (value > 1 || value < 0) {
3743
+ console.warn(`Out-of-range value ${value} provided for pinch`);
3744
+ return;
3722
3745
  }
3723
- // TO-DO: check frame
3724
- return this[PRIVATE$5].session[PRIVATE$6].device[PRIVATE$1].getViewport(this, view);
3746
+ const gamepadButton = this[PRIVATE$i].inputSource.gamepad[PRIVATE$k]
3747
+ .buttonsMap['pinch'];
3748
+ gamepadButton[PRIVATE$k].pendingValue = value;
3725
3749
  }
3726
- static getNativeFramebufferScaleFactor(session) {
3727
- if (!(session instanceof XRSession)) {
3728
- throw new TypeError('getNativeFramebufferScaleFactor must be passed a session.');
3729
- }
3730
- if (session[PRIVATE$6].ended) {
3731
- return 0.0;
3732
- }
3733
- // Return 1.0 for simplicity, actual implementation might vary based on the device capabilities
3734
- return 1.0;
3750
+ onFrameStart(frame) {
3751
+ super.onFrameStart(frame);
3752
+ this.updateHandPose();
3735
3753
  }
3736
3754
  }
3737
3755
 
@@ -4000,7 +4018,7 @@ class ActionPlayer {
4000
4018
  }
4001
4019
  }
4002
4020
 
4003
- const VERSION = "1.0.2";
4021
+ const VERSION = "1.0.4";
4004
4022
 
4005
4023
  /**
4006
4024
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -4119,6 +4137,8 @@ class XRDevice {
4119
4137
  supportedFrameRates: deviceConfig.supportedFrameRates,
4120
4138
  isSystemKeyboardSupported: deviceConfig.isSystemKeyboardSupported,
4121
4139
  internalNominalFrameRate: deviceConfig.internalNominalFrameRate,
4140
+ environmentBlendModes: deviceConfig.environmentBlendModes,
4141
+ interactionMode: deviceConfig.interactionMode,
4122
4142
  userAgent: deviceConfig.userAgent,
4123
4143
  position: (_b = deviceOptions.headsetPosition) !== null && _b !== void 0 ? _b : DEFAULTS.headsetPosition.clone(),
4124
4144
  quaternion: (_c = deviceOptions.headsetQuaternion) !== null && _c !== void 0 ? _c : DEFAULTS.headsetQuaternion.clone(),
@@ -4211,7 +4231,7 @@ class XRDevice {
4211
4231
  }
4212
4232
  if (this[PRIVATE$1].pendingReferenceSpaceReset) {
4213
4233
  session[PRIVATE$6].referenceSpaces.forEach((referenceSpace) => {
4214
- switch (referenceSpace[PRIVATE$8].type) {
4234
+ switch (referenceSpace[PRIVATE$9].type) {
4215
4235
  case XRReferenceSpaceType.Local:
4216
4236
  case XRReferenceSpaceType.LocalFloor:
4217
4237
  case XRReferenceSpaceType.BoundedFloor:
@@ -4588,6 +4608,11 @@ const oculusQuest1 = {
4588
4608
  supportedFrameRates: [72, 80, 90],
4589
4609
  isSystemKeyboardSupported: true,
4590
4610
  internalNominalFrameRate: 72,
4611
+ environmentBlendModes: {
4612
+ [XRSessionMode.ImmersiveVR]: XREnvironmentBlendMode.Opaque,
4613
+ [XRSessionMode.ImmersiveAR]: XREnvironmentBlendMode.AlphaBlend,
4614
+ },
4615
+ interactionMode: XRInteractionMode.WorldSpace,
4591
4616
  userAgent: 'Mozilla/5.0 (X11; Linux x86_64; Quest 1) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36',
4592
4617
  };
4593
4618
  const metaQuest2 = {
@@ -4613,6 +4638,11 @@ const metaQuest2 = {
4613
4638
  supportedFrameRates: [72, 80, 90, 120],
4614
4639
  isSystemKeyboardSupported: true,
4615
4640
  internalNominalFrameRate: 72,
4641
+ environmentBlendModes: {
4642
+ [XRSessionMode.ImmersiveVR]: XREnvironmentBlendMode.Opaque,
4643
+ [XRSessionMode.ImmersiveAR]: XREnvironmentBlendMode.AlphaBlend,
4644
+ },
4645
+ interactionMode: XRInteractionMode.WorldSpace,
4616
4646
  userAgent: 'Mozilla/5.0 (X11; Linux x86_64; Quest 2) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36',
4617
4647
  };
4618
4648
  const metaQuestPro = {
@@ -4638,6 +4668,11 @@ const metaQuestPro = {
4638
4668
  supportedFrameRates: [72, 80, 90, 120],
4639
4669
  isSystemKeyboardSupported: true,
4640
4670
  internalNominalFrameRate: 90,
4671
+ environmentBlendModes: {
4672
+ [XRSessionMode.ImmersiveVR]: XREnvironmentBlendMode.Opaque,
4673
+ [XRSessionMode.ImmersiveAR]: XREnvironmentBlendMode.AlphaBlend,
4674
+ },
4675
+ interactionMode: XRInteractionMode.WorldSpace,
4641
4676
  userAgent: 'Mozilla/5.0 (X11; Linux x86_64; Quest Pro) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36',
4642
4677
  };
4643
4678
  const metaQuest3 = {
@@ -4664,6 +4699,11 @@ const metaQuest3 = {
4664
4699
  supportedFrameRates: [72, 80, 90, 120],
4665
4700
  isSystemKeyboardSupported: true,
4666
4701
  internalNominalFrameRate: 90,
4702
+ environmentBlendModes: {
4703
+ [XRSessionMode.ImmersiveVR]: XREnvironmentBlendMode.Opaque,
4704
+ [XRSessionMode.ImmersiveAR]: XREnvironmentBlendMode.AlphaBlend,
4705
+ },
4706
+ interactionMode: XRInteractionMode.WorldSpace,
4667
4707
  userAgent: 'Mozilla/5.0 (X11; Linux x86_64; Quest 3) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36',
4668
4708
  };
4669
4709