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