@onerjs/core 8.28.0 → 8.28.1
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/Behaviors/Meshes/handConstraintBehavior.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Materials/Textures/texture.js +9 -2
- package/Materials/Textures/texture.js.map +1 -1
- package/Particles/gpuParticleSystem.js +2 -1
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.js +4 -3
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +6 -1
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Shaders/geometry.fragment.js +3 -1
- package/Shaders/geometry.fragment.js.map +1 -1
- package/Shaders/geometry.vertex.js +10 -2
- package/Shaders/geometry.vertex.js.map +1 -1
- package/ShadersWGSL/geometry.fragment.js +3 -1
- package/ShadersWGSL/geometry.fragment.js.map +1 -1
- package/ShadersWGSL/geometry.vertex.js +10 -2
- package/ShadersWGSL/geometry.vertex.js.map +1 -1
- package/XR/features/WebXRAnchorSystem.d.ts +1 -1
- package/XR/features/WebXRBackgroundRemover.d.ts +1 -1
- package/XR/features/WebXRControllerMovement.d.ts +1 -1
- package/XR/features/WebXRControllerPhysics.d.ts +1 -1
- package/XR/features/WebXRControllerPointerSelection.d.ts +1 -1
- package/XR/features/WebXRControllerTeleportation.d.ts +1 -1
- package/XR/features/WebXRDOMOverlay.d.ts +1 -1
- package/XR/features/WebXRDepthSensing.d.ts +1 -1
- package/XR/features/WebXREyeTracking.d.ts +1 -1
- package/XR/features/WebXRFeaturePointSystem.d.ts +1 -1
- package/XR/features/WebXRHandTracking.d.ts +1 -1
- package/XR/features/WebXRHitTest.d.ts +1 -1
- package/XR/features/WebXRHitTestLegacy.d.ts +1 -1
- package/XR/features/WebXRImageTracking.d.ts +1 -1
- package/XR/features/WebXRLayers.d.ts +1 -1
- package/XR/features/WebXRLightEstimation.d.ts +1 -1
- package/XR/features/WebXRMeshDetector.d.ts +1 -1
- package/XR/features/WebXRNearInteraction.d.ts +1 -1
- package/XR/features/WebXRPlaneDetector.d.ts +1 -1
- package/XR/features/WebXRRawCameraAccess.d.ts +1 -1
- package/XR/features/WebXRSpaceWarp.d.ts +1 -1
- package/XR/webXRDefaultExperience.js +1 -1
- package/XR/webXRDefaultExperience.js.map +1 -1
- package/XR/webXRFeaturesManager.d.ts +116 -27
- package/XR/webXRFeaturesManager.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/geometry.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,kDAAkD,CAAC;AAC1D,OAAO,sDAAsD,CAAC;AAC9D,OAAO,gDAAgD,CAAC;AACxD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,4CAA4C,CAAC;AACpD,OAAO,yCAAyC,CAAC;AACjD,OAAO,6CAA6C,CAAC;AACrD,OAAO,2CAA2C,CAAC;AACnD,OAAO,qCAAqC,CAAC;AAC7C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,8BAA8B,CAAC;AACtC,OAAO,uCAAuC,CAAC;AAC/C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,6BAA6B,CAAC;AAErC,MAAM,IAAI,GAAG,sBAAsB,CAAC;AACpC,MAAM,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"geometry.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/geometry.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,kDAAkD,CAAC;AAC1D,OAAO,sDAAsD,CAAC;AAC9D,OAAO,gDAAgD,CAAC;AACxD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,4CAA4C,CAAC;AACpD,OAAO,yCAAyC,CAAC;AACjD,OAAO,6CAA6C,CAAC;AACrD,OAAO,2CAA2C,CAAC;AACnD,OAAO,qCAAqC,CAAC;AAC7C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,8BAA8B,CAAC;AACtC,OAAO,uCAAuC,CAAC;AAC/C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,6BAA6B,CAAC;AAErC,MAAM,IAAI,GAAG,sBAAsB,CAAC;AACpC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyKd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC5C,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/bonesDeclaration\";\nimport \"./ShadersInclude/bakedVertexAnimationDeclaration\";\nimport \"./ShadersInclude/morphTargetsVertexGlobalDeclaration\";\nimport \"./ShadersInclude/morphTargetsVertexDeclaration\";\nimport \"./ShadersInclude/instancesDeclaration\";\nimport \"./ShadersInclude/geometryVertexDeclaration\";\nimport \"./ShadersInclude/geometryUboDeclaration\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"./ShadersInclude/morphTargetsVertexGlobal\";\nimport \"./ShadersInclude/morphTargetsVertex\";\nimport \"./ShadersInclude/instancesVertex\";\nimport \"./ShadersInclude/bonesVertex\";\nimport \"./ShadersInclude/bakedVertexAnimation\";\nimport \"./ShadersInclude/clipPlaneVertex\";\nimport \"./ShadersInclude/bumpVertex\";\n\nconst name = \"geometryVertexShader\";\nconst shader = `precision highp float;\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#include<instancesDeclaration>\n#include<__decl__geometryVertex>\n#include<clipPlaneVertexDeclaration>\nattribute vec3 position;\n#ifdef HAS_NORMAL_ATTRIBUTE\nattribute vec3 normal;\n#endif\n#ifdef NEED_UV\nvarying vec2 vUV;\n#ifdef ALPHATEST\nuniform mat4 diffuseMatrix;\n#endif\n#ifdef BUMP\nuniform mat4 bumpMatrix;varying vec2 vBumpUV;\n#endif\n#ifdef REFLECTIVITY\nuniform mat4 reflectivityMatrix;uniform mat4 albedoMatrix;varying vec2 vReflectivityUV;varying vec2 vAlbedoUV;\n#endif\n#ifdef METALLIC_TEXTURE\nvarying vec2 vMetallicUV;uniform mat4 metallicMatrix;\n#endif\n#ifdef ROUGHNESS_TEXTURE\nvarying vec2 vRoughnessUV;uniform mat4 roughnessMatrix;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#ifdef BUMP\nvarying mat4 vWorldView;\n#endif\n#ifdef BUMP\nvarying vec3 vNormalW;\n#else\nvarying vec3 vNormalV;\n#endif\nvarying vec4 vViewPos;\n#if defined(POSITION) || defined(BUMP)\nvarying vec3 vPositionW;\n#endif\n#if defined(VELOCITY) || defined(VELOCITY_LINEAR)\nuniform mat4 previousViewProjection;varying vec4 vCurrentPosition;varying vec4 vPreviousPosition;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{vec3 positionUpdated=position;\n#ifdef HAS_NORMAL_ATTRIBUTE\nvec3 normalUpdated=normal;\n#else\nvec3 normalUpdated=vec3(0.0,0.0,0.0);\n#endif\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#ifdef UV2\nvec2 uv2Updated=uv2;\n#endif\n#include<morphTargetsVertexGlobal>\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#include<instancesVertex>\n#if (defined(VELOCITY) || defined(VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);vPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=vec4(finalWorld*vec4(positionUpdated,1.0));\n#ifdef BUMP\nvWorldView=view*finalWorld;mat3 normalWorld=mat3(finalWorld);vNormalW=normalize(normalWorld*normalUpdated);\n#else\n#ifdef NORMAL_WORLDSPACE\nvNormalV=normalize(vec3(finalWorld*vec4(normalUpdated,0.0)));\n#else\nvNormalV=normalize(vec3((view*finalWorld)*vec4(normalUpdated,0.0)));\n#endif\n#endif\nvViewPos=view*worldPos;\n#if (defined(VELOCITY) || defined(VELOCITY_LINEAR)) && defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#if NUM_BONE_INFLUENCERS>0\nmat4 previousInfluence;previousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\npreviousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\npreviousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\npreviousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\nvPreviousPosition=previousViewProjection*finalPreviousWorld*previousInfluence*vec4(positionUpdated,1.0);\n#else\nvPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#endif\n#if defined(POSITION) || defined(BUMP)\nvPositionW=worldPos.xyz/worldPos.w;\n#endif\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#include<clipPlaneVertex>\n#ifdef NEED_UV\n#ifdef UV1\n#if defined(ALPHATEST) && defined(ALPHATEST_UV1)\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#else\nvUV=uvUpdated;\n#endif\n#ifdef BUMP_UV1\nvBumpUV=vec2(bumpMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef REFLECTIVITY_UV1\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uvUpdated,1.0,0.0));\n#else\n#ifdef METALLIC_UV1\nvMetallicUV=vec2(metallicMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef ROUGHNESS_UV1\nvRoughnessUV=vec2(roughnessMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#endif\n#ifdef ALBEDO_UV1\nvAlbedoUV=vec2(albedoMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#endif\n#ifdef UV2\n#if defined(ALPHATEST) && defined(ALPHATEST_UV2)\nvUV=vec2(diffuseMatrix*vec4(uv2Updated,1.0,0.0));\n#else\nvUV=uv2Updated;\n#endif\n#ifdef BUMP_UV2\nvBumpUV=vec2(bumpMatrix*vec4(uv2Updated,1.0,0.0));\n#endif\n#ifdef REFLECTIVITY_UV2\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv2Updated,1.0,0.0));\n#else\n#ifdef METALLIC_UV2\nvMetallicUV=vec2(metallicMatrix*vec4(uv2Updated,1.0,0.0));\n#endif\n#ifdef ROUGHNESS_UV2\nvRoughnessUV=vec2(roughnessMatrix*vec4(uv2Updated,1.0,0.0));\n#endif\n#endif\n#ifdef ALBEDO_UV2\nvAlbedoUV=vec2(albedoMatrix*vec4(uv2Updated,1.0,0.0));\n#endif\n#endif\n#endif\n#include<bumpVertex>\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\n/** @internal */\nexport const geometryVertexShader = { name, shader };\n"]}
|
|
@@ -74,8 +74,10 @@ normalOutput=normalW;
|
|
|
74
74
|
#else
|
|
75
75
|
normalOutput=normalize( (mat4x4f(input.vWorldView0,input.vWorldView1,input.vWorldView2,input.vWorldView3)* vec4f(normalW,0.0)).xyz);
|
|
76
76
|
#endif
|
|
77
|
-
#
|
|
77
|
+
#elif defined(HAS_NORMAL_ATTRIBUTE)
|
|
78
78
|
normalOutput=normalize(input.vNormalV);
|
|
79
|
+
#elif defined(POSITION)
|
|
80
|
+
normalOutput=normalize(-cross(dpdx(input.vPositionW),dpdy(input.vPositionW)));
|
|
79
81
|
#endif
|
|
80
82
|
#ifdef ENCODE_NORMAL
|
|
81
83
|
normalOutput=normalOutput*0.5+0.5;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.fragment.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/geometry.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,+CAA+C,CAAC;AACvD,OAAO,4CAA4C,CAAC;AACpD,OAAO,wCAAwC,CAAC;AAChD,OAAO,kCAAkC,CAAC;AAC1C,OAAO,oCAAoC,CAAC;AAC5C,OAAO,+BAA+B,CAAC;AAEvC,MAAM,IAAI,GAAG,qBAAqB,CAAC;AACnC,MAAM,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"geometry.fragment.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/geometry.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,+CAA+C,CAAC;AACvD,OAAO,4CAA4C,CAAC;AACpD,OAAO,wCAAwC,CAAC;AAChD,OAAO,kCAAkC,CAAC;AAC1C,OAAO,oCAAoC,CAAC;AAC5C,OAAO,+BAA+B,CAAC;AAEvC,MAAM,IAAI,GAAG,qBAAqB,CAAC;AACnC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Kd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"./ShadersInclude/bumpFragmentMainFunctions\";\nimport \"./ShadersInclude/bumpFragmentFunctions\";\nimport \"./ShadersInclude/helperFunctions\";\nimport \"./ShadersInclude/clipPlaneFragment\";\nimport \"./ShadersInclude/bumpFragment\";\n\nconst name = \"geometryPixelShader\";\nconst shader = `#ifdef BUMP\nvarying vWorldView0: vec4f;varying vWorldView1: vec4f;varying vWorldView2: vec4f;varying vWorldView3: vec4f;varying vNormalW: vec3f;\n#else\nvarying vNormalV: vec3f;\n#endif\nvarying vViewPos: vec4f;\n#if defined(POSITION) || defined(BUMP)\nvarying vPositionW: vec3f;\n#endif\n#if defined(VELOCITY) || defined(VELOCITY_LINEAR)\nvarying vCurrentPosition: vec4f;varying vPreviousPosition: vec4f;\n#endif\n#ifdef NEED_UV\nvarying vUV: vec2f;\n#endif\n#ifdef BUMP\nuniform vBumpInfos: vec3f;uniform vTangentSpaceParams: vec2f;\n#endif\n#if defined(REFLECTIVITY)\n#if defined(ORMTEXTURE) || defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE)\nvar reflectivitySamplerSampler: sampler;var reflectivitySampler: texture_2d<f32>;varying vReflectivityUV: vec2f;\n#else\n#ifdef METALLIC_TEXTURE\nvar metallicSamplerSampler: sampler;var metallicSampler: texture_2d<f32>;varying vMetallicUV: vec2f;\n#endif\n#ifdef ROUGHNESS_TEXTURE\nvar roughnessSamplerSampler: sampler;var roughnessSampler: texture_2d<f32>;varying vRoughnessUV: vec2f;\n#endif\n#endif\n#ifdef ALBEDOTEXTURE\nvarying vAlbedoUV: vec2f;var albedoSamplerSampler: sampler;var albedoSampler: texture_2d<f32>;\n#endif\n#ifdef REFLECTIVITYCOLOR\nuniform reflectivityColor: vec3f;\n#endif\n#ifdef ALBEDOCOLOR\nuniform albedoColor: vec3f;\n#endif\n#ifdef METALLIC\nuniform metallic: f32;\n#endif\n#if defined(ROUGHNESS) || defined(GLOSSINESS)\nuniform glossiness: f32;\n#endif\n#endif\n#if defined(ALPHATEST) && defined(NEED_UV)\nvar diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<bumpFragmentMainFunctions>\n#include<bumpFragmentFunctions>\n#include<helperFunctions>\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#include<clipPlaneFragment>\n#ifdef ALPHATEST\nif (textureSample(diffuseSampler,diffuseSamplerSampler,input.vUV).a<0.4) {discard;}\n#endif\nvar normalOutput: vec3f;\n#ifdef BUMP\nvar normalW: vec3f=normalize(input.vNormalW);\n#include<bumpFragment>\n#ifdef NORMAL_WORLDSPACE\nnormalOutput=normalW;\n#else\nnormalOutput=normalize( (mat4x4f(input.vWorldView0,input.vWorldView1,input.vWorldView2,input.vWorldView3)* vec4f(normalW,0.0)).xyz);\n#endif\n#elif defined(HAS_NORMAL_ATTRIBUTE)\nnormalOutput=normalize(input.vNormalV);\n#elif defined(POSITION)\nnormalOutput=normalize(-cross(dpdx(input.vPositionW),dpdy(input.vPositionW)));\n#endif\n#ifdef ENCODE_NORMAL\nnormalOutput=normalOutput*0.5+0.5;\n#endif\nvar fragData: array<vec4<f32>,SCENE_MRT_COUNT>;\n#ifdef DEPTH\nfragData[DEPTH_INDEX]=vec4f(input.vViewPos.z/input.vViewPos.w,0.0,0.0,1.0);\n#endif\n#ifdef NORMAL\nfragData[NORMAL_INDEX]=vec4f(normalOutput,1.0);\n#endif\n#ifdef SCREENSPACE_DEPTH\nfragData[SCREENSPACE_DEPTH_INDEX]=vec4f(fragmentInputs.position.z,0.0,0.0,1.0);\n#endif\n#ifdef POSITION\nfragData[POSITION_INDEX]= vec4f(input.vPositionW,1.0);\n#endif\n#ifdef VELOCITY\nvar a: vec2f=(input.vCurrentPosition.xy/input.vCurrentPosition.w)*0.5+0.5;var b: vec2f=(input.vPreviousPosition.xy/input.vPreviousPosition.w)*0.5+0.5;var velocity: vec2f=abs(a-b);velocity= vec2f(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;fragData[VELOCITY_INDEX]= vec4f(velocity,0.0,1.0);\n#endif\n#ifdef VELOCITY_LINEAR\nvar velocity : vec2f=vec2f(0.5)*((input.vPreviousPosition.xy /\ninput.vPreviousPosition.w) -\n(input.vCurrentPosition.xy /\ninput.vCurrentPosition.w));fragData[VELOCITY_LINEAR_INDEX]=vec4f(velocity,0.0,1.0);\n#endif\n#ifdef REFLECTIVITY\nvar reflectivity: vec4f= vec4f(0.0,0.0,0.0,1.0);\n#ifdef METALLICWORKFLOW\nvar metal: f32=1.0;var roughness: f32=1.0;\n#ifdef ORMTEXTURE\nmetal*=textureSample(reflectivitySampler,reflectivitySamplerSampler,input.vReflectivityUV).b;roughness*=textureSample(reflectivitySampler,reflectivitySamplerSampler,input.vReflectivityUV).g;\n#else\n#ifdef METALLIC_TEXTURE\nmetal*=textureSample(metallicSampler,metallicSamplerSampler,input.vMetallicUV).r;\n#endif\n#ifdef ROUGHNESS_TEXTURE\nroughness*=textureSample(roughnessSampler,roughnessSamplerSampler,input.vRoughnessUV).r;\n#endif\n#endif\n#ifdef METALLIC\nmetal*=uniforms.metallic;\n#endif\n#ifdef ROUGHNESS\nroughness*=(1.0-uniforms.glossiness); \n#endif\nreflectivity=vec4f(reflectivity.rgb,reflectivity.a-roughness);var color: vec3f= vec3f(1.0);\n#ifdef ALBEDOTEXTURE\ncolor=textureSample(albedoSampler,albedoSamplerSampler,input.vAlbedoUV).rgb;\n#ifdef GAMMAALBEDO\ncolor=toLinearSpaceVec4(color);\n#endif\n#endif\n#ifdef ALBEDOCOLOR\ncolor*=uniforms.albedoColor.xyz;\n#endif\nreflectivity=vec4f(mix( vec3f(0.04),color,metal),reflectivity.a);\n#else\n#if defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE)\nreflectivity=textureSample(reflectivitySampler,reflectivitySamplerSampler,input.vReflectivityUV);\n#ifdef GAMMAREFLECTIVITYTEXTURE\nreflectivity=vec4f(toLinearSpaceVec3(reflectivity.rgb),reflectivity.a);\n#endif\n#else \n#ifdef REFLECTIVITYCOLOR\nreflectivity=vec4f(toLinearSpaceVec3(uniforms.reflectivityColor.xyz),1.0);\n#endif\n#endif\n#ifdef GLOSSINESSS\nreflectivity=vec4f(reflectivity.rgb,reflectivity.a*glossiness); \n#endif\n#endif\nfragData[REFLECTIVITY_INDEX]=reflectivity;\n#endif\n#if SCENE_MRT_COUNT>0\nfragmentOutputs.fragData0=fragData[0];\n#endif\n#if SCENE_MRT_COUNT>1\nfragmentOutputs.fragData1=fragData[1];\n#endif\n#if SCENE_MRT_COUNT>2\nfragmentOutputs.fragData2=fragData[2];\n#endif\n#if SCENE_MRT_COUNT>3\nfragmentOutputs.fragData3=fragData[3];\n#endif\n#if SCENE_MRT_COUNT>4\nfragmentOutputs.fragData4=fragData[4];\n#endif\n#if SCENE_MRT_COUNT>5\nfragmentOutputs.fragData5=fragData[5];\n#endif\n#if SCENE_MRT_COUNT>6\nfragmentOutputs.fragData6=fragData[6];\n#endif\n#if SCENE_MRT_COUNT>7\nfragmentOutputs.fragData7=fragData[7];\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const geometryPixelShaderWGSL = { name, shader };\n"]}
|
|
@@ -22,7 +22,10 @@ const shader = `#include<bonesDeclaration>
|
|
|
22
22
|
#include<instancesDeclaration>
|
|
23
23
|
#include<sceneUboDeclaration>
|
|
24
24
|
#include<clipPlaneVertexDeclaration>
|
|
25
|
-
attribute position: vec3f;
|
|
25
|
+
attribute position: vec3f;
|
|
26
|
+
#ifdef HAS_NORMAL_ATTRIBUTE
|
|
27
|
+
attribute normal: vec3f;
|
|
28
|
+
#endif
|
|
26
29
|
#ifdef NEED_UV
|
|
27
30
|
varying vUV: vec2f;
|
|
28
31
|
#ifdef ALPHATEST
|
|
@@ -64,7 +67,12 @@ uniform previousViewProjection: mat4x4f;varying vCurrentPosition: vec4f;varying
|
|
|
64
67
|
#endif
|
|
65
68
|
#define CUSTOM_VERTEX_DEFINITIONS
|
|
66
69
|
@vertex
|
|
67
|
-
fn main(input : VertexInputs)->FragmentInputs {var positionUpdated: vec3f=input.position;
|
|
70
|
+
fn main(input : VertexInputs)->FragmentInputs {var positionUpdated: vec3f=input.position;
|
|
71
|
+
#ifdef HAS_NORMAL_ATTRIBUTE
|
|
72
|
+
var normalUpdated: vec3f=input.normal;
|
|
73
|
+
#else
|
|
74
|
+
var normalUpdated: vec3f=vec3f(0.0,0.0,0.0);
|
|
75
|
+
#endif
|
|
68
76
|
#ifdef UV1
|
|
69
77
|
var uvUpdated: vec2f=input.uv;
|
|
70
78
|
#endif
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/geometry.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,kDAAkD,CAAC;AAC1D,OAAO,sDAAsD,CAAC;AAC9D,OAAO,gDAAgD,CAAC;AACxD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,6CAA6C,CAAC;AACrD,OAAO,2CAA2C,CAAC;AACnD,OAAO,qCAAqC,CAAC;AAC7C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,8BAA8B,CAAC;AACtC,OAAO,uCAAuC,CAAC;AAC/C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,6BAA6B,CAAC;AAErC,MAAM,IAAI,GAAG,sBAAsB,CAAC;AACpC,MAAM,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"geometry.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/geometry.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,kDAAkD,CAAC;AAC1D,OAAO,sDAAsD,CAAC;AAC9D,OAAO,gDAAgD,CAAC;AACxD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,6CAA6C,CAAC;AACrD,OAAO,2CAA2C,CAAC;AACnD,OAAO,qCAAqC,CAAC;AAC7C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,8BAA8B,CAAC;AACtC,OAAO,uCAAuC,CAAC;AAC/C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,6BAA6B,CAAC;AAErC,MAAM,IAAI,GAAG,sBAAsB,CAAC;AACpC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwKd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/bonesDeclaration\";\nimport \"./ShadersInclude/bakedVertexAnimationDeclaration\";\nimport \"./ShadersInclude/morphTargetsVertexGlobalDeclaration\";\nimport \"./ShadersInclude/morphTargetsVertexDeclaration\";\nimport \"./ShadersInclude/instancesDeclaration\";\nimport \"./ShadersInclude/sceneUboDeclaration\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"./ShadersInclude/morphTargetsVertexGlobal\";\nimport \"./ShadersInclude/morphTargetsVertex\";\nimport \"./ShadersInclude/instancesVertex\";\nimport \"./ShadersInclude/bonesVertex\";\nimport \"./ShadersInclude/bakedVertexAnimation\";\nimport \"./ShadersInclude/clipPlaneVertex\";\nimport \"./ShadersInclude/bumpVertex\";\n\nconst name = \"geometryVertexShader\";\nconst shader = `#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#include<instancesDeclaration>\n#include<sceneUboDeclaration>\n#include<clipPlaneVertexDeclaration>\nattribute position: vec3f;\n#ifdef HAS_NORMAL_ATTRIBUTE\nattribute normal: vec3f;\n#endif\n#ifdef NEED_UV\nvarying vUV: vec2f;\n#ifdef ALPHATEST\nuniform diffuseMatrix: mat4x4f;\n#endif\n#ifdef BUMP\nuniform bumpMatrix: mat4x4f;varying vBumpUV: vec2f;\n#endif\n#ifdef REFLECTIVITY\nuniform reflectivityMatrix: mat4x4f;uniform albedoMatrix: mat4x4f;varying vReflectivityUV: vec2f;varying vAlbedoUV: vec2f;\n#endif\n#ifdef METALLIC_TEXTURE\nvarying vMetallicUV: vec2f;uniform metallicMatrix: mat4x4f;\n#endif\n#ifdef ROUGHNESS_TEXTURE\nvarying vRoughnessUV: vec2f;uniform roughnessMatrix: mat4x4f;\n#endif\n#ifdef UV1\nattribute uv: vec2f;\n#endif\n#ifdef UV2\nattribute uv2: vec2f;\n#endif\n#endif\n#ifdef BUMP\nvarying vWorldView0: vec4f;varying vWorldView1: vec4f;varying vWorldView2: vec4f;varying vWorldView3: vec4f;\n#endif\n#ifdef BUMP\nvarying vNormalW: vec3f;\n#else\nvarying vNormalV: vec3f;\n#endif\nvarying vViewPos: vec4f;\n#if defined(POSITION) || defined(BUMP)\nvarying vPositionW: vec3f;\n#endif\n#if defined(VELOCITY) || defined(VELOCITY_LINEAR)\nuniform previousViewProjection: mat4x4f;varying vCurrentPosition: vec4f;varying vPreviousPosition: vec4f;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {var positionUpdated: vec3f=input.position;\n#ifdef HAS_NORMAL_ATTRIBUTE\nvar normalUpdated: vec3f=input.normal;\n#else\nvar normalUpdated: vec3f=vec3f(0.0,0.0,0.0);\n#endif\n#ifdef UV1\nvar uvUpdated: vec2f=input.uv;\n#endif\n#ifdef UV2\nvar uv2Updated: vec2f=input.uv2;\n#endif\n#include<morphTargetsVertexGlobal>\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#include<instancesVertex>\n#if (defined(VELOCITY) || defined(VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=scene.viewProjection*finalWorld*vec4f(positionUpdated,1.0);vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld* vec4f(positionUpdated,1.0);\n#endif\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvar worldPos: vec4f= vec4f(finalWorld* vec4f(positionUpdated,1.0));\n#ifdef BUMP\nlet vWorldView=scene.view*finalWorld;vertexOutputs.vWorldView0=vWorldView[0];vertexOutputs.vWorldView1=vWorldView[1];vertexOutputs.vWorldView2=vWorldView[2];vertexOutputs.vWorldView3=vWorldView[3];let normalWorld: mat3x3f= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz);vertexOutputs.vNormalW=normalize(normalWorld*normalUpdated);\n#else\n#ifdef NORMAL_WORLDSPACE\nvertexOutputs.vNormalV=normalize((finalWorld* vec4f(normalUpdated,0.0)).xyz);\n#else\nvertexOutputs.vNormalV=normalize(((scene.view*finalWorld)* vec4f(normalUpdated,0.0)).xyz);\n#endif\n#endif\nvertexOutputs.vViewPos=scene.view*worldPos;\n#if (defined(VELOCITY) || defined(VELOCITY_LINEAR)) && defined(BONES_VELOCITY_ENABLED)\nvertexOutputs.vCurrentPosition=scene.viewProjection*finalWorld* vec4f(positionUpdated,1.0);\n#if NUM_BONE_INFLUENCERS>0\nvar previousInfluence: mat4x4f;previousInfluence=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[0])]*vertexInputs.matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[1])]*vertexInputs.matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[2])]*vertexInputs.matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndices[3])]*vertexInputs.matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[0])]*vertexInputs.matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[1])]*vertexInputs.matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[2])]*vertexInputs.matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\npreviousInfluence+=uniforms.mPreviousBones[ i32(vertexInputs.matricesIndicesExtra[3])]*vertexInputs.matricesWeightsExtra[3];\n#endif\nvertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld*previousInfluence* vec4f(positionUpdated,1.0);\n#else\nvertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld* vec4f(positionUpdated,1.0);\n#endif\n#endif\n#if defined(POSITION) || defined(BUMP)\nvertexOutputs.vPositionW=worldPos.xyz/worldPos.w;\n#endif\nvertexOutputs.position=scene.viewProjection*finalWorld* vec4f(positionUpdated,1.0);\n#include<clipPlaneVertex>\n#ifdef NEED_UV\n#ifdef UV1\n#if defined(ALPHATEST) && defined(ALPHATEST_UV1)\nvertexOutputs.vUV=(uniforms.diffuseMatrix* vec4f(uvUpdated,1.0,0.0)).xy;\n#else\nvertexOutputs.vUV=uvUpdated;\n#endif\n#ifdef BUMP_UV1\nvertexOutputs.vBumpUV=(uniforms.bumpMatrix* vec4f(uvUpdated,1.0,0.0)).xy;\n#endif\n#ifdef REFLECTIVITY_UV1\nvertexOutputs.vReflectivityUV=(uniforms.reflectivityMatrix* vec4f(uvUpdated,1.0,0.0)).xy;\n#else\n#ifdef METALLIC_UV1\nvertexOutputs.vMetallicUV=(uniforms.metallicMatrix* vec4f(uvUpdated,1.0,0.0)).xy;\n#endif\n#ifdef ROUGHNESS_UV1\nvertexOutputs.vRoughnessUV=(uniforms.roughnessMatrix* vec4f(uvUpdated,1.0,0.0)).xy;\n#endif\n#endif\n#ifdef ALBEDO_UV1\nvertexOutputs.vAlbedoUV=(uniforms.albedoMatrix* vec4f(uvUpdated,1.0,0.0)).xy;\n#endif\n#endif\n#ifdef UV2\n#if defined(ALPHATEST) && defined(ALPHATEST_UV2)\nvertexOutputs.vUV=(uniforms.diffuseMatrix* vec4f(uv2Updated,1.0,0.0)).xy;\n#else\nvertexOutputs.vUV=uv2Updated;\n#endif\n#ifdef BUMP_UV2\nvertexOutputs.vBumpUV=(uniforms.bumpMatrix* vec4f(uv2Updated,1.0,0.0)).xy;\n#endif\n#ifdef REFLECTIVITY_UV2\nvertexOutputs.vReflectivityUV=(uniforms.reflectivityMatrix* vec4f(uv2Updated,1.0,0.0)).xy;\n#else\n#ifdef METALLIC_UV2\nvertexOutputs.vMetallicUV=(uniforms.metallicMatrix* vec4f(uv2Updated,1.0,0.0)).xy;\n#endif\n#ifdef ROUGHNESS_UV2\nvertexOutputs.vRoughnessUV=(uniforms.roughnessMatrix* vec4f(uv2Updated,1.0,0.0)).xy;\n#endif\n#endif\n#ifdef ALBEDO_UV2\nvertexOutputs.vAlbedoUV=(uniforms.albedoMatrix* vec4f(uv2Updated,1.0,0.0)).xy;\n#endif\n#endif\n#endif\n#include<bumpVertex>\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const geometryVertexShaderWGSL = { name, shader };\n"]}
|
|
@@ -64,7 +64,7 @@ export declare class WebXRAnchorSystem extends WebXRAbstractFeature {
|
|
|
64
64
|
/**
|
|
65
65
|
* The module's name
|
|
66
66
|
*/
|
|
67
|
-
static readonly Name
|
|
67
|
+
static readonly Name: "xr-anchor-system";
|
|
68
68
|
/**
|
|
69
69
|
* The (Babylon) version of this module.
|
|
70
70
|
* This is an integer representing the implementation version.
|
|
@@ -40,7 +40,7 @@ export declare class WebXRBackgroundRemover extends WebXRAbstractFeature {
|
|
|
40
40
|
/**
|
|
41
41
|
* The module's name
|
|
42
42
|
*/
|
|
43
|
-
static readonly Name
|
|
43
|
+
static readonly Name: "xr-background-remover";
|
|
44
44
|
/**
|
|
45
45
|
* The (Babylon) version of this module.
|
|
46
46
|
* This is an integer representing the implementation version.
|
|
@@ -132,7 +132,7 @@ export declare class WebXRControllerMovement extends WebXRAbstractFeature {
|
|
|
132
132
|
/**
|
|
133
133
|
* The module's name
|
|
134
134
|
*/
|
|
135
|
-
static readonly Name
|
|
135
|
+
static readonly Name: "xr-controller-movement";
|
|
136
136
|
/**
|
|
137
137
|
* Standard controller configurations.
|
|
138
138
|
*/
|
|
@@ -91,7 +91,7 @@ export declare class WebXRControllerPhysics extends WebXRAbstractFeature {
|
|
|
91
91
|
/**
|
|
92
92
|
* The module's name
|
|
93
93
|
*/
|
|
94
|
-
static readonly Name
|
|
94
|
+
static readonly Name: "xr-physics-controller";
|
|
95
95
|
/**
|
|
96
96
|
* The (Babylon) version of this module.
|
|
97
97
|
* This is an integer representing the implementation version.
|
|
@@ -121,7 +121,7 @@ export declare class WebXRControllerPointerSelection extends WebXRAbstractFeatur
|
|
|
121
121
|
/**
|
|
122
122
|
* The module's name
|
|
123
123
|
*/
|
|
124
|
-
static readonly Name
|
|
124
|
+
static readonly Name: "xr-controller-pointer-selection";
|
|
125
125
|
/**
|
|
126
126
|
* The (Babylon) version of this module.
|
|
127
127
|
* This is an integer representing the implementation version.
|
|
@@ -156,7 +156,7 @@ export declare class WebXRMotionControllerTeleportation extends WebXRAbstractFea
|
|
|
156
156
|
/**
|
|
157
157
|
* The module's name
|
|
158
158
|
*/
|
|
159
|
-
static readonly Name
|
|
159
|
+
static readonly Name: "xr-controller-teleportation";
|
|
160
160
|
/**
|
|
161
161
|
* The (Babylon) version of this module.
|
|
162
162
|
* This is an integer representing the implementation version.
|
|
@@ -57,7 +57,7 @@ export declare class WebXRDomOverlay extends WebXRAbstractFeature {
|
|
|
57
57
|
/**
|
|
58
58
|
* The module's name
|
|
59
59
|
*/
|
|
60
|
-
static readonly Name
|
|
60
|
+
static readonly Name: "xr-dom-overlay";
|
|
61
61
|
/**
|
|
62
62
|
* The (Babylon) version of this module.
|
|
63
63
|
* This is an integer representing the implementation version.
|
|
@@ -102,7 +102,7 @@ export declare class WebXRDepthSensing extends WebXRAbstractFeature {
|
|
|
102
102
|
/**
|
|
103
103
|
* The module's name
|
|
104
104
|
*/
|
|
105
|
-
static readonly Name
|
|
105
|
+
static readonly Name: "xr-depth-sensing";
|
|
106
106
|
/**
|
|
107
107
|
* The (Babylon) version of this module.
|
|
108
108
|
* This is an integer representing the implementation version.
|
|
@@ -13,7 +13,7 @@ export declare class WebXREyeTracking extends WebXRAbstractFeature {
|
|
|
13
13
|
/**
|
|
14
14
|
* The module's name
|
|
15
15
|
*/
|
|
16
|
-
static readonly Name
|
|
16
|
+
static readonly Name: "xr-eye-tracking";
|
|
17
17
|
/**
|
|
18
18
|
* The (Babylon) version of this module.
|
|
19
19
|
* This is an integer representing the implementation version.
|
|
@@ -27,7 +27,7 @@ export declare class WebXRFeaturePointSystem extends WebXRAbstractFeature {
|
|
|
27
27
|
/**
|
|
28
28
|
* The module's name
|
|
29
29
|
*/
|
|
30
|
-
static readonly Name
|
|
30
|
+
static readonly Name: "xr-feature-points";
|
|
31
31
|
/**
|
|
32
32
|
* The (Babylon) version of this module.
|
|
33
33
|
* This is an integer representing the implementation version.
|
|
@@ -298,7 +298,7 @@ export declare class WebXRHandTracking extends WebXRAbstractFeature {
|
|
|
298
298
|
/**
|
|
299
299
|
* The module's name
|
|
300
300
|
*/
|
|
301
|
-
static readonly Name
|
|
301
|
+
static readonly Name: "xr-hand-tracking";
|
|
302
302
|
/**
|
|
303
303
|
* The (Babylon) version of this module.
|
|
304
304
|
* This is an integer representing the implementation version.
|
|
@@ -83,7 +83,7 @@ export declare class WebXRHitTest extends WebXRAbstractFeature implements IWebXR
|
|
|
83
83
|
/**
|
|
84
84
|
* The module's name
|
|
85
85
|
*/
|
|
86
|
-
static readonly Name
|
|
86
|
+
static readonly Name: "xr-hit-test";
|
|
87
87
|
/**
|
|
88
88
|
* The (Babylon) version of this module.
|
|
89
89
|
* This is an integer representing the implementation version.
|
|
@@ -56,7 +56,7 @@ export declare class WebXRHitTestLegacy extends WebXRAbstractFeature implements
|
|
|
56
56
|
/**
|
|
57
57
|
* The module's name
|
|
58
58
|
*/
|
|
59
|
-
static readonly Name
|
|
59
|
+
static readonly Name: "xr-hit-test";
|
|
60
60
|
/**
|
|
61
61
|
* The (Babylon) version of this module.
|
|
62
62
|
* This is an integer representing the implementation version.
|
|
@@ -66,7 +66,7 @@ export declare class WebXRImageTracking extends WebXRAbstractFeature {
|
|
|
66
66
|
/**
|
|
67
67
|
* The module's name
|
|
68
68
|
*/
|
|
69
|
-
static readonly Name
|
|
69
|
+
static readonly Name: "xr-image-tracking";
|
|
70
70
|
/**
|
|
71
71
|
* The (Babylon) version of this module.
|
|
72
72
|
* This is an integer representing the implementation version.
|
|
@@ -28,7 +28,7 @@ export declare class WebXRLayers extends WebXRAbstractFeature {
|
|
|
28
28
|
/**
|
|
29
29
|
* The module's name
|
|
30
30
|
*/
|
|
31
|
-
static readonly Name
|
|
31
|
+
static readonly Name: "xr-layers";
|
|
32
32
|
/**
|
|
33
33
|
* The (Babylon) version of this module.
|
|
34
34
|
* This is an integer representing the implementation version.
|
|
@@ -98,7 +98,7 @@ export declare class WebXRLightEstimation extends WebXRAbstractFeature {
|
|
|
98
98
|
/**
|
|
99
99
|
* The module's name
|
|
100
100
|
*/
|
|
101
|
-
static readonly Name
|
|
101
|
+
static readonly Name: "xr-light-estimation";
|
|
102
102
|
/**
|
|
103
103
|
* The (Babylon) version of this module.
|
|
104
104
|
* This is an integer representing the implementation version.
|
|
@@ -90,7 +90,7 @@ export declare class WebXRMeshDetector extends WebXRAbstractFeature {
|
|
|
90
90
|
/**
|
|
91
91
|
* The module's name
|
|
92
92
|
*/
|
|
93
|
-
static readonly Name
|
|
93
|
+
static readonly Name: "xr-mesh-detection";
|
|
94
94
|
/**
|
|
95
95
|
* The (Babylon) version of this module.
|
|
96
96
|
* This is an integer representing the implementation version.
|
|
@@ -92,7 +92,7 @@ export declare class WebXRNearInteraction extends WebXRAbstractFeature {
|
|
|
92
92
|
/**
|
|
93
93
|
* The module's name
|
|
94
94
|
*/
|
|
95
|
-
static readonly Name
|
|
95
|
+
static readonly Name: "xr-near-interaction";
|
|
96
96
|
/**
|
|
97
97
|
* The (Babylon) version of this module.
|
|
98
98
|
* This is an integer representing the implementation version.
|
|
@@ -58,7 +58,7 @@ export declare class WebXRPlaneDetector extends WebXRAbstractFeature {
|
|
|
58
58
|
/**
|
|
59
59
|
* The module's name
|
|
60
60
|
*/
|
|
61
|
-
static readonly Name
|
|
61
|
+
static readonly Name: "xr-plane-detection";
|
|
62
62
|
/**
|
|
63
63
|
* The (Babylon) version of this module.
|
|
64
64
|
* This is an integer representing the implementation version.
|
|
@@ -53,7 +53,7 @@ export declare class WebXRRawCameraAccess extends WebXRAbstractFeature {
|
|
|
53
53
|
/**
|
|
54
54
|
* The module's name
|
|
55
55
|
*/
|
|
56
|
-
static readonly Name
|
|
56
|
+
static readonly Name: "xr-raw-camera-access";
|
|
57
57
|
/**
|
|
58
58
|
* The (Babylon) version of this module.
|
|
59
59
|
* This is an integer representing the implementation version.
|
|
@@ -77,7 +77,7 @@ export declare class WebXRSpaceWarp extends WebXRAbstractFeature {
|
|
|
77
77
|
/**
|
|
78
78
|
* The module's name
|
|
79
79
|
*/
|
|
80
|
-
static readonly Name
|
|
80
|
+
static readonly Name: "xr-space-warp";
|
|
81
81
|
/**
|
|
82
82
|
* The (Babylon) version of this module.
|
|
83
83
|
* This is an integer representing the implementation version.
|
|
@@ -67,7 +67,7 @@ export class WebXRDefaultExperience {
|
|
|
67
67
|
xrInput: result.input,
|
|
68
68
|
renderingGroupId: options.renderingGroupId,
|
|
69
69
|
};
|
|
70
|
-
result.pointerSelection =
|
|
70
|
+
result.pointerSelection = result.baseExperience.featuresManager.enableFeature(WebXRControllerPointerSelection.Name, options.useStablePlugins ? "stable" : "latest", pointerSelectionOptions);
|
|
71
71
|
if (!options.disableTeleportation) {
|
|
72
72
|
// Add default teleportation, including rotation
|
|
73
73
|
result.teleportation = result.baseExperience.featuresManager.enableFeature(WebXRMotionControllerTeleportation.Name, options.useStablePlugins ? "stable" : "latest", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webXRDefaultExperience.js","sourceRoot":"","sources":["../../../../dev/core/src/XR/webXRDefaultExperience.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,+BAA+B,EAAE,MAAM,4CAA4C,CAAC;AAE7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAGvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,EAAE,iBAAiB,EAAkC,MAAM,8BAA8B,CAAC;AACjG,OAAO,EAAE,kCAAkC,EAAE,MAAM,yCAAyC,CAAC;AAC7F,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,6BAA6B;CA8EzC;AAED;;GAEG;AACH,MAAM,OAAO,sBAAsB;IA+B/B,g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C,KAAK,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,MAAM,CAAC;QAClB,CAAC;IACL,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QAClC,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC;QACD,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QAC/B,CAAC;QACD,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAChC,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { WebXRExperienceHelper } from \"./webXRExperienceHelper\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { IWebXRInputOptions } from \"./webXRInput\";\r\nimport { WebXRInput } from \"./webXRInput\";\r\nimport type { IWebXRControllerPointerSelectionOptions } from \"./features/WebXRControllerPointerSelection\";\r\nimport { WebXRControllerPointerSelection } from \"./features/WebXRControllerPointerSelection\";\r\nimport type { IWebXRNearInteractionOptions } from \"./features/WebXRNearInteraction\";\r\nimport { WebXRNearInteraction } from \"./features/WebXRNearInteraction\";\r\nimport type { WebXRRenderTarget } from \"./webXRTypes\";\r\nimport type { WebXREnterExitUIOptions } from \"./webXREnterExitUI\";\r\nimport { WebXREnterExitUI } from \"./webXREnterExitUI\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { WebXRManagedOutputCanvasOptions } from \"./webXRManagedOutputCanvas\";\r\nimport type { IWebXRTeleportationOptions } from \"./features/WebXRControllerTeleportation\";\r\nimport { WebXRHandTracking, type IWebXRHandTrackingOptions } from \"./features/WebXRHandTracking\";\r\nimport { WebXRMotionControllerTeleportation } from \"./features/WebXRControllerTeleportation\";\r\nimport { Logger } from \"../Misc/logger\";\r\n\r\n/**\r\n * Options for the default xr helper\r\n */\r\nexport class WebXRDefaultExperienceOptions {\r\n /**\r\n * Enable or disable default UI to enter XR\r\n */\r\n public disableDefaultUI?: boolean;\r\n /**\r\n * Should pointer selection not initialize.\r\n * Note that disabling pointer selection also disables teleportation.\r\n * Defaults to false.\r\n */\r\n public disablePointerSelection?: boolean;\r\n /**\r\n * Should teleportation not initialize. Defaults to false.\r\n */\r\n public disableTeleportation?: boolean;\r\n /**\r\n * Should nearInteraction not initialize. Defaults to false.\r\n */\r\n public disableNearInteraction?: boolean;\r\n\r\n /**\r\n * Should hand tracking be disabled. Defaults to false.\r\n */\r\n public disableHandTracking?: boolean;\r\n /**\r\n * Floor meshes that will be used for teleport\r\n */\r\n public floorMeshes?: Array<AbstractMesh>;\r\n /**\r\n * If set to true, the first frame will not be used to reset position\r\n * The first frame is mainly used when copying transformation from the old camera\r\n * Mainly used in AR\r\n */\r\n public ignoreNativeCameraTransformation?: boolean;\r\n /**\r\n * Optional configuration for the XR input object\r\n */\r\n public inputOptions?: Partial<IWebXRInputOptions>;\r\n /**\r\n * optional configuration for pointer selection\r\n */\r\n public pointerSelectionOptions?: Partial<IWebXRControllerPointerSelectionOptions>;\r\n /**\r\n * optional configuration for near interaction\r\n */\r\n public nearInteractionOptions?: Partial<IWebXRNearInteractionOptions>;\r\n\r\n /**\r\n * optional configuration for hand tracking\r\n */\r\n public handSupportOptions?: Partial<IWebXRHandTrackingOptions>;\r\n /**\r\n * optional configuration for teleportation\r\n */\r\n public teleportationOptions?: Partial<IWebXRTeleportationOptions>;\r\n /**\r\n * optional configuration for the output canvas\r\n */\r\n public outputCanvasOptions?: WebXRManagedOutputCanvasOptions;\r\n /**\r\n * optional UI options. This can be used among other to change session mode and reference space type\r\n */\r\n public uiOptions?: Partial<WebXREnterExitUIOptions>;\r\n /**\r\n * When loading teleportation and pointer select, use stable versions instead of latest.\r\n */\r\n public useStablePlugins?: boolean;\r\n\r\n /**\r\n * An optional rendering group id that will be set globally for teleportation, pointer selection and default controller meshes\r\n */\r\n public renderingGroupId?: number;\r\n\r\n /**\r\n * A list of optional features to init the session with\r\n * If set to true, all features we support will be added\r\n */\r\n public optionalFeatures?: boolean | string[];\r\n}\r\n\r\n/**\r\n * Default experience for webxr\r\n */\r\nexport class WebXRDefaultExperience {\r\n /**\r\n * Base experience\r\n */\r\n public baseExperience: WebXRExperienceHelper;\r\n /**\r\n * Enables ui for entering/exiting xr\r\n */\r\n public enterExitUI: WebXREnterExitUI;\r\n /**\r\n * Input experience extension\r\n */\r\n public input: WebXRInput;\r\n /**\r\n * Enables laser pointer and selection\r\n */\r\n public pointerSelection: WebXRControllerPointerSelection;\r\n /**\r\n * Default target xr should render to\r\n */\r\n public renderTarget: WebXRRenderTarget;\r\n /**\r\n * Enables teleportation\r\n */\r\n public teleportation: WebXRMotionControllerTeleportation;\r\n\r\n /**\r\n * Enables near interaction for hands/controllers\r\n */\r\n public nearInteraction: WebXRNearInteraction;\r\n\r\n private constructor() {}\r\n\r\n /**\r\n * Creates the default xr experience\r\n * @param scene scene\r\n * @param options options for basic configuration\r\n * @returns resulting WebXRDefaultExperience\r\n */\r\n public static async CreateAsync(scene: Scene, options: WebXRDefaultExperienceOptions = {}) {\r\n const result = new WebXRDefaultExperience();\r\n scene.onDisposeObservable.addOnce(() => {\r\n result.dispose();\r\n });\r\n // init the UI right after construction\r\n if (!options.disableDefaultUI) {\r\n const uiOptions: WebXREnterExitUIOptions = {\r\n renderTarget: result.renderTarget,\r\n ...(options.uiOptions || {}),\r\n };\r\n if (options.optionalFeatures) {\r\n if (typeof options.optionalFeatures === \"boolean\") {\r\n uiOptions.optionalFeatures = [\"hit-test\", \"anchors\", \"plane-detection\", \"hand-tracking\"];\r\n } else {\r\n uiOptions.optionalFeatures = options.optionalFeatures;\r\n }\r\n }\r\n result.enterExitUI = new WebXREnterExitUI(scene, uiOptions);\r\n }\r\n\r\n try {\r\n // Create base experience\r\n const xrHelper = await WebXRExperienceHelper.CreateAsync(scene);\r\n // eslint-disable-next-line require-atomic-updates\r\n result.baseExperience = xrHelper;\r\n\r\n if (options.ignoreNativeCameraTransformation) {\r\n // eslint-disable-next-line require-atomic-updates\r\n result.baseExperience.camera.compensateOnFirstFrame = false;\r\n }\r\n\r\n // Add controller support\r\n // eslint-disable-next-line require-atomic-updates\r\n result.input = new WebXRInput(xrHelper.sessionManager, xrHelper.camera, {\r\n controllerOptions: {\r\n renderingGroupId: options.renderingGroupId,\r\n },\r\n ...(options.inputOptions || {}),\r\n });\r\n\r\n if (!options.disablePointerSelection) {\r\n // Add default pointer selection\r\n const pointerSelectionOptions = {\r\n ...options.pointerSelectionOptions,\r\n xrInput: result.input,\r\n renderingGroupId: options.renderingGroupId,\r\n };\r\n\r\n result.pointerSelection = <WebXRControllerPointerSelection>(\r\n result.baseExperience.featuresManager.enableFeature(\r\n WebXRControllerPointerSelection.Name,\r\n options.useStablePlugins ? \"stable\" : \"latest\",\r\n <IWebXRControllerPointerSelectionOptions>pointerSelectionOptions\r\n )\r\n );\r\n\r\n if (!options.disableTeleportation) {\r\n // Add default teleportation, including rotation\r\n result.teleportation = <WebXRMotionControllerTeleportation>result.baseExperience.featuresManager.enableFeature(\r\n WebXRMotionControllerTeleportation.Name,\r\n options.useStablePlugins ? \"stable\" : \"latest\",\r\n <IWebXRTeleportationOptions>{\r\n floorMeshes: options.floorMeshes,\r\n xrInput: result.input,\r\n renderingGroupId: options.renderingGroupId,\r\n ...options.teleportationOptions,\r\n }\r\n );\r\n result.teleportation.setSelectionFeature(result.pointerSelection);\r\n }\r\n }\r\n\r\n if (!options.disableNearInteraction) {\r\n // Add default pointer selection\r\n result.nearInteraction = <WebXRNearInteraction>result.baseExperience.featuresManager.enableFeature(\r\n WebXRNearInteraction.Name,\r\n options.useStablePlugins ? \"stable\" : \"latest\",\r\n <IWebXRNearInteractionOptions>{\r\n xrInput: result.input,\r\n farInteractionFeature: result.pointerSelection,\r\n renderingGroupId: options.renderingGroupId,\r\n useUtilityLayer: true,\r\n enableNearInteractionOnAllControllers: true,\r\n ...options.nearInteractionOptions,\r\n }\r\n );\r\n }\r\n\r\n if (!options.disableHandTracking) {\r\n // Add default hand tracking\r\n result.baseExperience.featuresManager.enableFeature(\r\n WebXRHandTracking.Name,\r\n options.useStablePlugins ? \"stable\" : \"latest\",\r\n <IWebXRHandTrackingOptions>{\r\n xrInput: result.input,\r\n ...options.handSupportOptions,\r\n },\r\n undefined,\r\n false\r\n );\r\n }\r\n\r\n // Create the WebXR output target\r\n result.renderTarget = result.baseExperience.sessionManager.getWebXRRenderTarget(options.outputCanvasOptions);\r\n\r\n if (!options.disableDefaultUI) {\r\n // Create ui for entering/exiting xr\r\n await result.enterExitUI.setHelperAsync(result.baseExperience, result.renderTarget);\r\n }\r\n return result;\r\n } catch (error) {\r\n Logger.Error(\"Error initializing XR\");\r\n Logger.Error(error);\r\n return result;\r\n }\r\n }\r\n\r\n /**\r\n * Disposes of the experience helper\r\n */\r\n public dispose() {\r\n if (this.baseExperience) {\r\n this.baseExperience.dispose();\r\n }\r\n if (this.input) {\r\n this.input.dispose();\r\n }\r\n if (this.enterExitUI) {\r\n this.enterExitUI.dispose();\r\n }\r\n if (this.renderTarget) {\r\n this.renderTarget.dispose();\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"webXRDefaultExperience.js","sourceRoot":"","sources":["../../../../dev/core/src/XR/webXRDefaultExperience.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,+BAA+B,EAAE,MAAM,4CAA4C,CAAC;AAE7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAGvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,EAAE,iBAAiB,EAAkC,MAAM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AM,CAAC,cAAc,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;YACxF,CAAC;YACD,OAAO,MAAM,CAAC;QAClB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;YACtC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,MAAM,CAAC;QAClB,CAAC;IACL,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QAClC,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC;QACD,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QAC/B,CAAC;QACD,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAChC,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { WebXRExperienceHelper } from \"./webXRExperienceHelper\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { IWebXRInputOptions } from \"./webXRInput\";\r\nimport { WebXRInput } from \"./webXRInput\";\r\nimport type { IWebXRControllerPointerSelectionOptions } from \"./features/WebXRControllerPointerSelection\";\r\nimport { WebXRControllerPointerSelection } from \"./features/WebXRControllerPointerSelection\";\r\nimport type { IWebXRNearInteractionOptions } from \"./features/WebXRNearInteraction\";\r\nimport { WebXRNearInteraction } from \"./features/WebXRNearInteraction\";\r\nimport type { WebXRRenderTarget } from \"./webXRTypes\";\r\nimport type { WebXREnterExitUIOptions } from \"./webXREnterExitUI\";\r\nimport { WebXREnterExitUI } from \"./webXREnterExitUI\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { WebXRManagedOutputCanvasOptions } from \"./webXRManagedOutputCanvas\";\r\nimport type { IWebXRTeleportationOptions } from \"./features/WebXRControllerTeleportation\";\r\nimport { WebXRHandTracking, type IWebXRHandTrackingOptions } from \"./features/WebXRHandTracking\";\r\nimport { WebXRMotionControllerTeleportation } from \"./features/WebXRControllerTeleportation\";\r\nimport { Logger } from \"../Misc/logger\";\r\n\r\n/**\r\n * Options for the default xr helper\r\n */\r\nexport class WebXRDefaultExperienceOptions {\r\n /**\r\n * Enable or disable default UI to enter XR\r\n */\r\n public disableDefaultUI?: boolean;\r\n /**\r\n * Should pointer selection not initialize.\r\n * Note that disabling pointer selection also disables teleportation.\r\n * Defaults to false.\r\n */\r\n public disablePointerSelection?: boolean;\r\n /**\r\n * Should teleportation not initialize. Defaults to false.\r\n */\r\n public disableTeleportation?: boolean;\r\n /**\r\n * Should nearInteraction not initialize. Defaults to false.\r\n */\r\n public disableNearInteraction?: boolean;\r\n\r\n /**\r\n * Should hand tracking be disabled. Defaults to false.\r\n */\r\n public disableHandTracking?: boolean;\r\n /**\r\n * Floor meshes that will be used for teleport\r\n */\r\n public floorMeshes?: Array<AbstractMesh>;\r\n /**\r\n * If set to true, the first frame will not be used to reset position\r\n * The first frame is mainly used when copying transformation from the old camera\r\n * Mainly used in AR\r\n */\r\n public ignoreNativeCameraTransformation?: boolean;\r\n /**\r\n * Optional configuration for the XR input object\r\n */\r\n public inputOptions?: Partial<IWebXRInputOptions>;\r\n /**\r\n * optional configuration for pointer selection\r\n */\r\n public pointerSelectionOptions?: Partial<IWebXRControllerPointerSelectionOptions>;\r\n /**\r\n * optional configuration for near interaction\r\n */\r\n public nearInteractionOptions?: Partial<IWebXRNearInteractionOptions>;\r\n\r\n /**\r\n * optional configuration for hand tracking\r\n */\r\n public handSupportOptions?: Partial<IWebXRHandTrackingOptions>;\r\n /**\r\n * optional configuration for teleportation\r\n */\r\n public teleportationOptions?: Partial<IWebXRTeleportationOptions>;\r\n /**\r\n * optional configuration for the output canvas\r\n */\r\n public outputCanvasOptions?: WebXRManagedOutputCanvasOptions;\r\n /**\r\n * optional UI options. This can be used among other to change session mode and reference space type\r\n */\r\n public uiOptions?: Partial<WebXREnterExitUIOptions>;\r\n /**\r\n * When loading teleportation and pointer select, use stable versions instead of latest.\r\n */\r\n public useStablePlugins?: boolean;\r\n\r\n /**\r\n * An optional rendering group id that will be set globally for teleportation, pointer selection and default controller meshes\r\n */\r\n public renderingGroupId?: number;\r\n\r\n /**\r\n * A list of optional features to init the session with\r\n * If set to true, all features we support will be added\r\n */\r\n public optionalFeatures?: boolean | string[];\r\n}\r\n\r\n/**\r\n * Default experience for webxr\r\n */\r\nexport class WebXRDefaultExperience {\r\n /**\r\n * Base experience\r\n */\r\n public baseExperience: WebXRExperienceHelper;\r\n /**\r\n * Enables ui for entering/exiting xr\r\n */\r\n public enterExitUI: WebXREnterExitUI;\r\n /**\r\n * Input experience extension\r\n */\r\n public input: WebXRInput;\r\n /**\r\n * Enables laser pointer and selection\r\n */\r\n public pointerSelection: WebXRControllerPointerSelection;\r\n /**\r\n * Default target xr should render to\r\n */\r\n public renderTarget: WebXRRenderTarget;\r\n /**\r\n * Enables teleportation\r\n */\r\n public teleportation: WebXRMotionControllerTeleportation;\r\n\r\n /**\r\n * Enables near interaction for hands/controllers\r\n */\r\n public nearInteraction: WebXRNearInteraction;\r\n\r\n private constructor() {}\r\n\r\n /**\r\n * Creates the default xr experience\r\n * @param scene scene\r\n * @param options options for basic configuration\r\n * @returns resulting WebXRDefaultExperience\r\n */\r\n public static async CreateAsync(scene: Scene, options: WebXRDefaultExperienceOptions = {}) {\r\n const result = new WebXRDefaultExperience();\r\n scene.onDisposeObservable.addOnce(() => {\r\n result.dispose();\r\n });\r\n // init the UI right after construction\r\n if (!options.disableDefaultUI) {\r\n const uiOptions: WebXREnterExitUIOptions = {\r\n renderTarget: result.renderTarget,\r\n ...(options.uiOptions || {}),\r\n };\r\n if (options.optionalFeatures) {\r\n if (typeof options.optionalFeatures === \"boolean\") {\r\n uiOptions.optionalFeatures = [\"hit-test\", \"anchors\", \"plane-detection\", \"hand-tracking\"];\r\n } else {\r\n uiOptions.optionalFeatures = options.optionalFeatures;\r\n }\r\n }\r\n result.enterExitUI = new WebXREnterExitUI(scene, uiOptions);\r\n }\r\n\r\n try {\r\n // Create base experience\r\n const xrHelper = await WebXRExperienceHelper.CreateAsync(scene);\r\n // eslint-disable-next-line require-atomic-updates\r\n result.baseExperience = xrHelper;\r\n\r\n if (options.ignoreNativeCameraTransformation) {\r\n // eslint-disable-next-line require-atomic-updates\r\n result.baseExperience.camera.compensateOnFirstFrame = false;\r\n }\r\n\r\n // Add controller support\r\n // eslint-disable-next-line require-atomic-updates\r\n result.input = new WebXRInput(xrHelper.sessionManager, xrHelper.camera, {\r\n controllerOptions: {\r\n renderingGroupId: options.renderingGroupId,\r\n },\r\n ...(options.inputOptions || {}),\r\n });\r\n\r\n if (!options.disablePointerSelection) {\r\n // Add default pointer selection\r\n const pointerSelectionOptions = {\r\n ...options.pointerSelectionOptions,\r\n xrInput: result.input,\r\n renderingGroupId: options.renderingGroupId,\r\n };\r\n\r\n result.pointerSelection = result.baseExperience.featuresManager.enableFeature(\r\n WebXRControllerPointerSelection.Name,\r\n options.useStablePlugins ? \"stable\" : \"latest\",\r\n <IWebXRControllerPointerSelectionOptions>pointerSelectionOptions\r\n );\r\n\r\n if (!options.disableTeleportation) {\r\n // Add default teleportation, including rotation\r\n result.teleportation = result.baseExperience.featuresManager.enableFeature(\r\n WebXRMotionControllerTeleportation.Name,\r\n options.useStablePlugins ? \"stable\" : \"latest\",\r\n <IWebXRTeleportationOptions>{\r\n floorMeshes: options.floorMeshes,\r\n xrInput: result.input,\r\n renderingGroupId: options.renderingGroupId,\r\n ...options.teleportationOptions,\r\n }\r\n );\r\n result.teleportation.setSelectionFeature(result.pointerSelection);\r\n }\r\n }\r\n\r\n if (!options.disableNearInteraction) {\r\n // Add default pointer selection\r\n result.nearInteraction = result.baseExperience.featuresManager.enableFeature(WebXRNearInteraction.Name, options.useStablePlugins ? \"stable\" : \"latest\", <\r\n IWebXRNearInteractionOptions\r\n >{\r\n xrInput: result.input,\r\n farInteractionFeature: result.pointerSelection,\r\n renderingGroupId: options.renderingGroupId,\r\n useUtilityLayer: true,\r\n enableNearInteractionOnAllControllers: true,\r\n ...options.nearInteractionOptions,\r\n });\r\n }\r\n\r\n if (!options.disableHandTracking) {\r\n // Add default hand tracking\r\n result.baseExperience.featuresManager.enableFeature(\r\n WebXRHandTracking.Name,\r\n options.useStablePlugins ? \"stable\" : \"latest\",\r\n <IWebXRHandTrackingOptions>{\r\n xrInput: result.input,\r\n ...options.handSupportOptions,\r\n },\r\n undefined,\r\n false\r\n );\r\n }\r\n\r\n // Create the WebXR output target\r\n result.renderTarget = result.baseExperience.sessionManager.getWebXRRenderTarget(options.outputCanvasOptions);\r\n\r\n if (!options.disableDefaultUI) {\r\n // Create ui for entering/exiting xr\r\n await result.enterExitUI.setHelperAsync(result.baseExperience, result.renderTarget);\r\n }\r\n return result;\r\n } catch (error) {\r\n Logger.Error(\"Error initializing XR\");\r\n Logger.Error(error);\r\n return result;\r\n }\r\n }\r\n\r\n /**\r\n * Disposes of the experience helper\r\n */\r\n public dispose() {\r\n if (this.baseExperience) {\r\n this.baseExperience.dispose();\r\n }\r\n if (this.input) {\r\n this.input.dispose();\r\n }\r\n if (this.enterExitUI) {\r\n this.enterExitUI.dispose();\r\n }\r\n if (this.renderTarget) {\r\n this.renderTarget.dispose();\r\n }\r\n }\r\n}\r\n"]}
|