@onerjs/core 8.42.5 → 8.42.6
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/Cameras/arcRotateCamera.js +9 -9
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Materials/vertexPullingHelper.functions.d.ts +4 -0
- package/Materials/vertexPullingHelper.functions.js +4 -2
- package/Materials/vertexPullingHelper.functions.js.map +1 -1
- package/ShadersWGSL/iblVoxelGrid.vertex.js +51 -42
- package/ShadersWGSL/iblVoxelGrid.vertex.js.map +1 -1
- package/XR/features/WebXRControllerTeleportation.js +1 -2
- package/XR/features/WebXRControllerTeleportation.js.map +1 -1
- package/XR/features/WebXRDepthSensing.js +1 -0
- package/XR/features/WebXRDepthSensing.js.map +1 -1
- package/XR/features/WebXRHandTracking.js +2 -2
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/features/WebXRWalkingLocomotion.js +1 -1
- package/XR/features/WebXRWalkingLocomotion.js.map +1 -1
- package/XR/motionController/webXRMicrosoftMixedRealityController.js +1 -1
- package/XR/motionController/webXRMicrosoftMixedRealityController.js.map +1 -1
- package/XR/motionController/webXRMotionControllerManager.js +2 -2
- package/XR/motionController/webXRMotionControllerManager.js.map +1 -1
- package/XR/webXRCamera.d.ts +1 -0
- package/XR/webXRCamera.js +9 -7
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXRExperienceHelper.d.ts +4 -0
- package/XR/webXRExperienceHelper.js +25 -5
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/XR/webXRInput.d.ts +1 -0
- package/XR/webXRInput.js +6 -0
- package/XR/webXRInput.js.map +1 -1
- package/XR/webXRSessionManager.js +5 -4
- package/XR/webXRSessionManager.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertexPullingHelper.functions.js","sourceRoot":"","sources":["../../../../dev/core/src/Materials/vertexPullingHelper.functions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vertexPullingHelper.functions.js","sourceRoot":"","sources":["../../../../dev/core/src/Materials/vertexPullingHelper.functions.ts"],"names":[],"mappings":"AA6BA,6CAA6C;AAC7C,MAAM,2BAA2B,GAAG,IAAI,OAAO,EAAiD,CAAC;AAEjG;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAAC,QAAkB;IAC3D,MAAM,aAAa,GAAG,QAAQ,CAAC,gBAAgB,EAAE,CAAC;IAClD,IAAI,CAAC,aAAa,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,oBAAoB;IACpB,IAAI,QAAQ,GAAG,2BAA2B,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACzD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,QAAQ,GAAG,IAAI,GAAG,EAAkC,CAAC;QACrD,2BAA2B,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACxD,CAAC;SAAM,CAAC;QACJ,yDAAyD;QACzD,IAAI,WAAW,GAAG,KAAK,CAAC;QACxB,KAAK,MAAM,EAAE,IAAI,aAAa,EAAE,CAAC;YAC7B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;gBACpB,WAAW,GAAG,IAAI,CAAC;gBACnB,MAAM;YACV,CAAC;QACL,CAAC;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,OAAO,QAAQ,CAAC;QACpB,CAAC;IACL,CAAC;IAED,2BAA2B;IAC3B,KAAK,MAAM,EAAE,IAAI,aAAa,EAAE,CAAC;QAC7B,MAAM,YAAY,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC;QACvC,IAAI,YAAY,EAAE,CAAC;YACf,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC;YACvC,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC;YACvC,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;YAC/B,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;YAE3C,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE;gBACb,MAAM,EAAE,MAAM;gBACd,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,IAAI;gBACV,UAAU,EAAE,UAAU;aACzB,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAc,EAAE,QAA6C;IACnG,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE;QACjC,MAAM,WAAW,GAAG,MAAM,SAAS,OAAO,CAAC;QAC3C,qDAAqD;QACrD,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChG,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import type { Effect } from \"./effect\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Geometry } from \"../Meshes/geometry\";\r\n\r\n/**\r\n * Interface representing metadata for vertex pulling\r\n */\r\nexport interface IVertexPullingMetadata {\r\n /**\r\n * Offset in vertex buffer where data starts\r\n */\r\n offset: number;\r\n\r\n /**\r\n * Stride between elements in the vertex buffer\r\n */\r\n stride: number;\r\n\r\n /**\r\n * Type of the vertex buffer (e.g., float, int)\r\n */\r\n type: number; // VertexBuffer type constant\r\n\r\n /**\r\n * Whether integer data should be normalized when read\r\n */\r\n normalized: boolean;\r\n}\r\n\r\n// Store vertex pulling metadata per geometry\r\nconst _VertexPullingMetadataCache = new WeakMap<Geometry, Map<string, IVertexPullingMetadata>>();\r\n\r\n/**\r\n * Prepares vertex pulling uniforms for the given attributes and mesh\r\n * @param geometry The geometry containing the vertex buffers\r\n * @returns A map of attribute names to their metadata, or null if unavailable\r\n */\r\nexport function PrepareVertexPullingUniforms(geometry: Geometry): Nullable<Map<string, IVertexPullingMetadata>> {\r\n const vertexBuffers = geometry.getVertexBuffers();\r\n if (!vertexBuffers) {\r\n return null;\r\n }\r\n\r\n // Check cache first\r\n let metadata = _VertexPullingMetadataCache.get(geometry);\r\n if (!metadata) {\r\n metadata = new Map<string, IVertexPullingMetadata>();\r\n _VertexPullingMetadataCache.set(geometry, metadata);\r\n } else {\r\n // Return cached metadata if it exists and hasn't changed\r\n let needsUpdate = false;\r\n for (const vb in vertexBuffers) {\r\n if (!metadata.has(vb)) {\r\n needsUpdate = true;\r\n break;\r\n }\r\n }\r\n if (!needsUpdate) {\r\n return metadata;\r\n }\r\n }\r\n\r\n // Build or update metadata\r\n for (const vb in vertexBuffers) {\r\n const vertexBuffer = vertexBuffers[vb];\r\n if (vertexBuffer) {\r\n const offset = vertexBuffer.byteOffset;\r\n const stride = vertexBuffer.byteStride;\r\n const type = vertexBuffer.type;\r\n const normalized = vertexBuffer.normalized;\r\n\r\n metadata.set(vb, {\r\n offset: offset,\r\n stride: stride,\r\n type: type,\r\n normalized: normalized,\r\n });\r\n }\r\n }\r\n\r\n return metadata;\r\n}\r\n\r\n/**\r\n * Bind vertex pulling uniforms to the effect\r\n * @param effect The effect to bind the uniforms to\r\n * @param metadata The vertex pulling metadata\r\n */\r\nexport function BindVertexPullingUniforms(effect: Effect, metadata: Map<string, IVertexPullingMetadata>): void {\r\n metadata.forEach((data, attribute) => {\r\n const uniformName = `vp_${attribute}_info`;\r\n // Pack into vec4: (offset, stride, type, normalized)\r\n effect.setFloat4(uniformName, data.offset, data.stride, data.type, data.normalized ? 1 : 0);\r\n });\r\n}\r\n"]}
|
|
@@ -16,61 +16,70 @@ var<storage,read> indices : array<u32>;
|
|
|
16
16
|
#endif
|
|
17
17
|
var<storage,read> position : array<f32>;
|
|
18
18
|
#if NUM_BONE_INFLUENCERS>0
|
|
19
|
-
var<storage,read> matricesIndices : array<u32>;var<storage,read> matricesWeights : array<f32>;uniform vp_matricesIndices_info:
|
|
19
|
+
var<storage,read> matricesIndices : array<u32>;var<storage,read> matricesWeights : array<f32>;uniform vp_matricesIndices_info : vec4f;uniform vp_matricesWeights_info : vec4f;
|
|
20
20
|
#if NUM_BONE_INFLUENCERS>4
|
|
21
|
-
var<storage,read> matricesIndicesExtra : array<u32>;var<storage,read> matricesWeightsExtra : array<f32>;uniform vp_matricesIndicesExtra_info:
|
|
21
|
+
var<storage,read> matricesIndicesExtra : array<u32>;var<storage,read> matricesWeightsExtra : array<f32>;uniform vp_matricesIndicesExtra_info : vec4f;uniform vp_matricesWeightsExtra_info : vec4f;
|
|
22
22
|
#endif
|
|
23
23
|
#endif
|
|
24
|
-
uniform
|
|
25
|
-
fn convertToFloat(word: u32,byteInWord: u32,dataType: u32
|
|
26
|
-
|
|
24
|
+
uniform invWorldScale : mat4x4f;varying vNormalizedPosition : vec3f;flat varying f_swizzle : i32;uniform vp_position_info : vec4f;
|
|
25
|
+
fn convertToFloat(word : u32,byteInWord : u32,dataType : u32,
|
|
26
|
+
normalized : bool)->f32 {switch (dataType) {case 5120u: {
|
|
27
|
+
let shift=byteInWord*8u;let value=(word>>shift) & 0xFFu;let signedValue=f32(i32(value<<24u)>>24u);if (normalized) {return signedValue/127.0;}
|
|
28
|
+
return signedValue;}
|
|
27
29
|
case 5121u: {
|
|
28
|
-
let shift=byteInWord*8u;let value=(word>>shift) & 0xFFu;return f32(value)/255.0;}
|
|
30
|
+
let shift=byteInWord*8u;let value=(word>>shift) & 0xFFu;if (normalized) {return f32(value)/255.0;}
|
|
31
|
+
return f32(value);}
|
|
29
32
|
case 5122u: {
|
|
30
33
|
let shift=(byteInWord & 0xFFFFFFFEu)*8u;
|
|
31
|
-
let value=(word>>shift) & 0xFFFFu;
|
|
34
|
+
let value=(word>>shift) & 0xFFFFu;let signedValue=f32(i32(value<<16u)>>16u);if (normalized) {return signedValue/32767.0;}
|
|
35
|
+
return signedValue;}
|
|
32
36
|
case 5123u: {
|
|
33
37
|
let shift=(byteInWord & 0xFFFFFFFEu)*8u;
|
|
34
|
-
let value=(word>>shift) & 0xFFFFu;return f32(value);}
|
|
38
|
+
let value=(word>>shift) & 0xFFFFu;if (normalized) {return f32(value)/65535.0;}
|
|
39
|
+
return f32(value);}
|
|
35
40
|
case 5126u: {
|
|
36
41
|
return bitcast<f32>(word);}
|
|
37
42
|
default: {return 0.0;}}}
|
|
38
|
-
fn readPositionValue(byteOffset: u32,dataType: u32
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
readPositionValue(offset
|
|
42
|
-
readPositionValue(offset+componentSize
|
|
43
|
-
);}
|
|
43
|
+
fn readPositionValue(byteOffset : u32,dataType : u32,normalized : bool)
|
|
44
|
+
-> f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word : u32=bitcast<u32>(position[wordOffset]);return convertToFloat(word,byteInWord,dataType,normalized);}
|
|
45
|
+
fn readVertexPosition(info : vec4f,vertexIndex : u32)->vec3f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec3f(
|
|
46
|
+
readPositionValue(offset,dataType,normalized),
|
|
47
|
+
readPositionValue(offset+componentSize,dataType,normalized),
|
|
48
|
+
readPositionValue(offset+componentSize*2u,dataType,normalized));}
|
|
44
49
|
#if NUM_BONE_INFLUENCERS>0
|
|
45
|
-
fn readMatrixIndexValue(byteOffset: u32,dataType: u32
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
readMatrixIndexValue(offset
|
|
49
|
-
readMatrixIndexValue(offset+componentSize
|
|
50
|
-
readMatrixIndexValue(offset+componentSize*
|
|
51
|
-
);}
|
|
52
|
-
fn readMatrixWeightValue(byteOffset: u32,dataType: u32
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
readMatrixWeightValue(offset
|
|
56
|
-
readMatrixWeightValue(offset+componentSize
|
|
57
|
-
readMatrixWeightValue(offset+componentSize*
|
|
58
|
-
);}
|
|
50
|
+
fn readMatrixIndexValue(byteOffset : u32,dataType : u32,normalized : bool)
|
|
51
|
+
-> f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word : u32=matricesIndices[wordOffset];return convertToFloat(word,byteInWord,dataType,normalized);}
|
|
52
|
+
fn readMatrixIndices(info : vec4f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(
|
|
53
|
+
readMatrixIndexValue(offset,dataType,normalized),
|
|
54
|
+
readMatrixIndexValue(offset+componentSize,dataType,normalized),
|
|
55
|
+
readMatrixIndexValue(offset+componentSize*2u,dataType,normalized),
|
|
56
|
+
readMatrixIndexValue(offset+componentSize*3u,dataType,normalized));}
|
|
57
|
+
fn readMatrixWeightValue(byteOffset : u32,dataType : u32,normalized : bool)
|
|
58
|
+
-> f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word : u32=bitcast<u32>(matricesWeights[wordOffset]);return convertToFloat(word,byteInWord,dataType,normalized);}
|
|
59
|
+
fn readMatrixWeights(info : vec4f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(
|
|
60
|
+
readMatrixWeightValue(offset,dataType,normalized),
|
|
61
|
+
readMatrixWeightValue(offset+componentSize,dataType,normalized),
|
|
62
|
+
readMatrixWeightValue(offset+componentSize*2u,dataType,normalized),
|
|
63
|
+
readMatrixWeightValue(offset+componentSize*3u,dataType,normalized));}
|
|
59
64
|
#if NUM_BONE_INFLUENCERS>4
|
|
60
|
-
fn readMatrixIndexExtraValue(byteOffset: u32,dataType
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
readMatrixIndexExtraValue(offset
|
|
64
|
-
readMatrixIndexExtraValue(offset+componentSize
|
|
65
|
-
readMatrixIndexExtraValue(offset+componentSize*
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
readMatrixWeightExtraValue(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
readMatrixWeightExtraValue(offset
|
|
73
|
-
)
|
|
65
|
+
fn readMatrixIndexExtraValue(byteOffset : u32,dataType : u32,
|
|
66
|
+
normalized : bool)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word : u32=matricesIndicesExtra[wordOffset];return convertToFloat(word,byteInWord,dataType,normalized);}
|
|
67
|
+
fn readMatrixIndicesExtra(info : vec4f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(
|
|
68
|
+
readMatrixIndexExtraValue(offset,dataType,normalized),
|
|
69
|
+
readMatrixIndexExtraValue(offset+componentSize,dataType,normalized),
|
|
70
|
+
readMatrixIndexExtraValue(offset+componentSize*2u,dataType,
|
|
71
|
+
normalized),
|
|
72
|
+
readMatrixIndexExtraValue(offset+componentSize*3u,dataType,
|
|
73
|
+
normalized));}
|
|
74
|
+
fn readMatrixWeightExtraValue(byteOffset : u32,dataType : u32,
|
|
75
|
+
normalized : bool)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word : u32=bitcast<u32>(matricesWeightsExtra[wordOffset]);return convertToFloat(word,byteInWord,dataType,normalized);}
|
|
76
|
+
fn readMatrixWeightsExtra(info : vec4f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(
|
|
77
|
+
readMatrixWeightExtraValue(offset,dataType,normalized),
|
|
78
|
+
readMatrixWeightExtraValue(offset+componentSize,dataType,normalized),
|
|
79
|
+
readMatrixWeightExtraValue(offset+componentSize*2u,dataType,
|
|
80
|
+
normalized),
|
|
81
|
+
readMatrixWeightExtraValue(offset+componentSize*3u,dataType,
|
|
82
|
+
normalized));}
|
|
74
83
|
#endif
|
|
75
84
|
#endif
|
|
76
85
|
fn readVertexIndex(index : u32)->u32 {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iblVoxelGrid.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/iblVoxelGrid.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,sDAAsD,CAAC;AAC9D,OAAO,gDAAgD,CAAC;AACxD,OAAO,8BAA8B,CAAC;AACtC,OAAO,uCAAuC,CAAC;AAE/C,MAAM,IAAI,GAAG,0BAA0B,CAAC;AACxC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyGd,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,4BAA4B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/morphTargetsVertexGlobalDeclaration\";\nimport \"./ShadersInclude/morphTargetsVertexDeclaration\";\nimport \"./ShadersInclude/bonesVertex\";\nimport \"./ShadersInclude/bakedVertexAnimation\";\n\nconst name = \"iblVoxelGridVertexShader\";\nconst shader = `#include <bakedVertexAnimationDeclaration>\n#include <bonesDeclaration>(attribute matricesIndices : vec4f;,,attribute matricesWeights : vec4f;,,attribute matricesIndicesExtra : vec4f;,,attribute matricesWeightsExtra : vec4f;,)\n#include <helperFunctions>\n#include <instancesDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#ifdef VERTEX_PULLING_USE_INDEX_BUFFER\nvar<storage,read> indices : array<u32>;\n#endif\nvar<storage,read> position : array<f32>;\n#if NUM_BONE_INFLUENCERS>0\nvar<storage,read> matricesIndices : array<u32>;var<storage,read> matricesWeights : array<f32>;uniform vp_matricesIndices_info: vec3f;uniform vp_matricesWeights_info: vec3f;\n#if NUM_BONE_INFLUENCERS>4\nvar<storage,read> matricesIndicesExtra : array<u32>;var<storage,read> matricesWeightsExtra : array<f32>;uniform vp_matricesIndicesExtra_info: vec3f;uniform vp_matricesWeightsExtra_info: vec3f;\n#endif\n#endif\nuniform world : mat4x4f;uniform invWorldScale: mat4x4f;varying vNormalizedPosition : vec3f;flat varying f_swizzle: i32;uniform vp_position_info: vec3f; \nfn convertToFloat(word: u32,byteInWord: u32,dataType: u32)->f32 {switch (dataType) {case 5120u: { \nlet shift=byteInWord*8u;let value=(word>>shift) & 0xFFu;return f32(i32(value<<24u)>>24u)/127.0; }\ncase 5121u: { \nlet shift=byteInWord*8u;let value=(word>>shift) & 0xFFu;return f32(value)/255.0;}\ncase 5122u: { \nlet shift=(byteInWord & 0xFFFFFFFEu)*8u; \nlet value=(word>>shift) & 0xFFFFu;return f32(i32(value<<16u)>>16u);}\ncase 5123u: { \nlet shift=(byteInWord & 0xFFFFFFFEu)*8u; \nlet value=(word>>shift) & 0xFFFFu;return f32(value);}\ncase 5126u: { \nreturn bitcast<f32>(word);}\ndefault: {return 0.0;}}}\nfn readPositionValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=bitcast<u32>(position[wordOffset]);return convertToFloat(word,byteInWord,dataType);}\nfn readVertexPosition(info: vec3f,vertexIndex: u32)->vec3f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec3f(\nreadPositionValue(offset,dataType),\nreadPositionValue(offset+componentSize,dataType),\nreadPositionValue(offset+componentSize*2u,dataType)\n);}\n#if NUM_BONE_INFLUENCERS>0\nfn readMatrixIndexValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=matricesIndices[wordOffset];return convertToFloat(word,byteInWord,dataType);}\nfn readMatrixIndices(info: vec3f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(\nreadMatrixIndexValue(offset,dataType),\nreadMatrixIndexValue(offset+componentSize,dataType),\nreadMatrixIndexValue(offset+componentSize*2u,dataType),\nreadMatrixIndexValue(offset+componentSize*3u,dataType)\n);}\nfn readMatrixWeightValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=bitcast<u32>(matricesWeights[wordOffset]);return convertToFloat(word,byteInWord,dataType);}\nfn readMatrixWeights(info: vec3f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(\nreadMatrixWeightValue(offset,dataType),\nreadMatrixWeightValue(offset+componentSize,dataType),\nreadMatrixWeightValue(offset+componentSize*2u,dataType),\nreadMatrixWeightValue(offset+componentSize*3u,dataType)\n);}\n#if NUM_BONE_INFLUENCERS>4\nfn readMatrixIndexExtraValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word : u32=matricesIndicesExtra[wordOffset];return convertToFloat(word,byteInWord,dataType);}\nfn readMatrixIndicesExtra(info: vec3f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(\nreadMatrixIndexExtraValue(offset,dataType),\nreadMatrixIndexExtraValue(offset+componentSize,dataType),\nreadMatrixIndexExtraValue(offset+componentSize*2u,dataType),\nreadMatrixIndexExtraValue(offset+componentSize*3u,dataType)\n);}\nfn readMatrixWeightExtraValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=bitcast<u32>(matricesWeightsExtra[wordOffset]);return convertToFloat(word,byteInWord,dataType);}\nfn readMatrixWeightsExtra(info : vec3f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(\nreadMatrixWeightExtraValue(offset,dataType),\nreadMatrixWeightExtraValue(offset+componentSize,dataType),\nreadMatrixWeightExtraValue(offset+componentSize*2u,dataType),\nreadMatrixWeightExtraValue(offset+componentSize*3u,dataType)\n);}\n#endif\n#endif\nfn readVertexIndex(index : u32)->u32 {\n#ifndef VERTEX_PULLING_USE_INDEX_BUFFER\nreturn index;\n#else\n#ifdef VERTEX_PULLING_INDEX_BUFFER_32BITS\nreturn indices[index];\n#else\nlet u32_index=index/2u;let bit_offset=(index & 1u)*16u;return (indices[u32_index]>>bit_offset) & 0xFFFFu;\n#endif\n#endif\n}\nfn calculateTriangleNormal(v0\n: vec3<f32>,v1\n: vec3<f32>,v2\n: vec3<f32>)\n->vec3<f32> {let edge1=v1-v0;let edge2=v2-v0;let triangleNormal=cross(edge1,edge2);let normalizedTriangleNormal=normalize(triangleNormal);return normalizedTriangleNormal;}\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#include <morphTargetsVertexGlobal>\nvar triPositions: array<vec3f,3>;var thisTriIndex : u32=input.vertexIndex; \nfor (var i: u32=0u; i<3u; i=i+1u) {var provokingVertNum : u32=input.vertexIndex/3*3;let vertIdx=readVertexIndex(provokingVertNum+i);if (provokingVertNum+i==input.vertexIndex) {thisTriIndex=i;}\nvar positionUpdated=readVertexPosition(uniforms.vp_position_info,vertIdx);\n#include <instancesVertex>\nlet inputPosition: vec3f=positionUpdated;\n#include <morphTargetsVertex>(vertexInputs.position\\\\),inputPosition),vertexInputs.vertexIndex,vertIdx)[0..maxSimultaneousMorphTargets]\n#if NUM_BONE_INFLUENCERS>0\nlet matrixIndex=readMatrixIndices(uniforms.vp_matricesIndices_info,vertIdx);let matrixWeight=readMatrixWeights(uniforms.vp_matricesWeights_info,vertIdx);\n#if NUM_BONE_INFLUENCERS>4\nlet matrixIndexExtra=readMatrixIndicesExtra(uniforms.vp_matricesIndicesExtra_info,vertIdx);let matrixWeightExtra=readMatrixWeightsExtra(uniforms.vp_matricesWeightsExtra_info,vertIdx);\n#endif\n#endif\n#include<bonesVertex>(vertexInputs.matricesIndices,matrixIndex,vertexInputs.matricesWeights,matrixWeight,vertexInputs.matricesIndicesExtra,matrixIndexExtra,vertexInputs.matricesWeightsExtra,matrixWeightExtra)\n#include<bakedVertexAnimation>(vertexInputs.matricesIndices,matrixIndex,vertexInputs.matricesWeights,matrixWeight,vertexInputs.matricesIndicesExtra,matrixIndexExtra,vertexInputs.matricesWeightsExtra,matrixWeightExtra)\ntriPositions[i]=(finalWorld*vec4(positionUpdated,1.0)).xyz;}\nvar N : vec3<f32>=calculateTriangleNormal(triPositions[0],triPositions[1],triPositions[2]);let worldPos=triPositions[thisTriIndex];vertexOutputs.position=uniforms.invWorldScale*vec4(worldPos,1.0);N=abs(N);if (N.x>N.y && N.x>N.z) {vertexOutputs.f_swizzle=0;vertexOutputs.position=vec4f(vertexOutputs.position.yzx,1.0);} else if (N.y>N.z) {vertexOutputs.f_swizzle=1;vertexOutputs.position=vec4f(vertexOutputs.position.zxy,1.0);} else {vertexOutputs.f_swizzle=2;vertexOutputs.position=vec4f(vertexOutputs.position.xyz,1.0);}\nvertexOutputs.vNormalizedPosition=vertexOutputs.position.xyz*0.5+0.5;vertexOutputs.position.z =\nvertexOutputs.vNormalizedPosition.z; }\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const iblVoxelGridVertexShaderWGSL = { name, shader };\n"]}
|
|
1
|
+
{"version":3,"file":"iblVoxelGrid.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/iblVoxelGrid.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,sDAAsD,CAAC;AAC9D,OAAO,gDAAgD,CAAC;AACxD,OAAO,8BAA8B,CAAC;AACtC,OAAO,uCAAuC,CAAC;AAE/C,MAAM,IAAI,GAAG,0BAA0B,CAAC;AACxC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkHd,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,4BAA4B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/morphTargetsVertexGlobalDeclaration\";\nimport \"./ShadersInclude/morphTargetsVertexDeclaration\";\nimport \"./ShadersInclude/bonesVertex\";\nimport \"./ShadersInclude/bakedVertexAnimation\";\n\nconst name = \"iblVoxelGridVertexShader\";\nconst shader = `#include <bakedVertexAnimationDeclaration>\n#include <bonesDeclaration>(attribute matricesIndices : vec4f;,,attribute matricesWeights : vec4f;,,attribute matricesIndicesExtra : vec4f;,,attribute matricesWeightsExtra : vec4f;,)\n#include <helperFunctions>\n#include <instancesDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#ifdef VERTEX_PULLING_USE_INDEX_BUFFER\nvar<storage,read> indices : array<u32>;\n#endif\nvar<storage,read> position : array<f32>;\n#if NUM_BONE_INFLUENCERS>0\nvar<storage,read> matricesIndices : array<u32>;var<storage,read> matricesWeights : array<f32>;uniform vp_matricesIndices_info : vec4f;uniform vp_matricesWeights_info : vec4f;\n#if NUM_BONE_INFLUENCERS>4\nvar<storage,read> matricesIndicesExtra : array<u32>;var<storage,read> matricesWeightsExtra : array<f32>;uniform vp_matricesIndicesExtra_info : vec4f;uniform vp_matricesWeightsExtra_info : vec4f;\n#endif\n#endif\nuniform invWorldScale : mat4x4f;varying vNormalizedPosition : vec3f;flat varying f_swizzle : i32;uniform vp_position_info : vec4f; \nfn convertToFloat(word : u32,byteInWord : u32,dataType : u32,\nnormalized : bool)->f32 {switch (dataType) {case 5120u: { \nlet shift=byteInWord*8u;let value=(word>>shift) & 0xFFu;let signedValue=f32(i32(value<<24u)>>24u);if (normalized) {return signedValue/127.0;}\nreturn signedValue;}\ncase 5121u: { \nlet shift=byteInWord*8u;let value=(word>>shift) & 0xFFu;if (normalized) {return f32(value)/255.0;}\nreturn f32(value);}\ncase 5122u: { \nlet shift=(byteInWord & 0xFFFFFFFEu)*8u; \nlet value=(word>>shift) & 0xFFFFu;let signedValue=f32(i32(value<<16u)>>16u);if (normalized) {return signedValue/32767.0;}\nreturn signedValue;}\ncase 5123u: { \nlet shift=(byteInWord & 0xFFFFFFFEu)*8u; \nlet value=(word>>shift) & 0xFFFFu;if (normalized) {return f32(value)/65535.0;}\nreturn f32(value);}\ncase 5126u: { \nreturn bitcast<f32>(word);}\ndefault: {return 0.0;}}}\nfn readPositionValue(byteOffset : u32,dataType : u32,normalized : bool)\n-> f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word : u32=bitcast<u32>(position[wordOffset]);return convertToFloat(word,byteInWord,dataType,normalized);}\nfn readVertexPosition(info : vec4f,vertexIndex : u32)->vec3f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec3f(\nreadPositionValue(offset,dataType,normalized),\nreadPositionValue(offset+componentSize,dataType,normalized),\nreadPositionValue(offset+componentSize*2u,dataType,normalized));}\n#if NUM_BONE_INFLUENCERS>0\nfn readMatrixIndexValue(byteOffset : u32,dataType : u32,normalized : bool)\n-> f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word : u32=matricesIndices[wordOffset];return convertToFloat(word,byteInWord,dataType,normalized);}\nfn readMatrixIndices(info : vec4f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(\nreadMatrixIndexValue(offset,dataType,normalized),\nreadMatrixIndexValue(offset+componentSize,dataType,normalized),\nreadMatrixIndexValue(offset+componentSize*2u,dataType,normalized),\nreadMatrixIndexValue(offset+componentSize*3u,dataType,normalized));}\nfn readMatrixWeightValue(byteOffset : u32,dataType : u32,normalized : bool)\n-> f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word : u32=bitcast<u32>(matricesWeights[wordOffset]);return convertToFloat(word,byteInWord,dataType,normalized);}\nfn readMatrixWeights(info : vec4f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(\nreadMatrixWeightValue(offset,dataType,normalized),\nreadMatrixWeightValue(offset+componentSize,dataType,normalized),\nreadMatrixWeightValue(offset+componentSize*2u,dataType,normalized),\nreadMatrixWeightValue(offset+componentSize*3u,dataType,normalized));}\n#if NUM_BONE_INFLUENCERS>4\nfn readMatrixIndexExtraValue(byteOffset : u32,dataType : u32,\nnormalized : bool)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word : u32=matricesIndicesExtra[wordOffset];return convertToFloat(word,byteInWord,dataType,normalized);}\nfn readMatrixIndicesExtra(info : vec4f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(\nreadMatrixIndexExtraValue(offset,dataType,normalized),\nreadMatrixIndexExtraValue(offset+componentSize,dataType,normalized),\nreadMatrixIndexExtraValue(offset+componentSize*2u,dataType,\nnormalized),\nreadMatrixIndexExtraValue(offset+componentSize*3u,dataType,\nnormalized));}\nfn readMatrixWeightExtraValue(byteOffset : u32,dataType : u32,\nnormalized : bool)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word : u32=bitcast<u32>(matricesWeightsExtra[wordOffset]);return convertToFloat(word,byteInWord,dataType,normalized);}\nfn readMatrixWeightsExtra(info : vec4f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let normalized=info.w != 0.0;let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(\nreadMatrixWeightExtraValue(offset,dataType,normalized),\nreadMatrixWeightExtraValue(offset+componentSize,dataType,normalized),\nreadMatrixWeightExtraValue(offset+componentSize*2u,dataType,\nnormalized),\nreadMatrixWeightExtraValue(offset+componentSize*3u,dataType,\nnormalized));}\n#endif\n#endif\nfn readVertexIndex(index : u32)->u32 {\n#ifndef VERTEX_PULLING_USE_INDEX_BUFFER\nreturn index;\n#else\n#ifdef VERTEX_PULLING_INDEX_BUFFER_32BITS\nreturn indices[index];\n#else\nlet u32_index=index/2u;let bit_offset=(index & 1u)*16u;return (indices[u32_index]>>bit_offset) & 0xFFFFu;\n#endif\n#endif\n}\nfn calculateTriangleNormal(v0\n: vec3<f32>,v1\n: vec3<f32>,v2\n: vec3<f32>)\n->vec3<f32> {let edge1=v1-v0;let edge2=v2-v0;let triangleNormal=cross(edge1,edge2);let normalizedTriangleNormal=normalize(triangleNormal);return normalizedTriangleNormal;}\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#include <morphTargetsVertexGlobal>\nvar triPositions: array<vec3f,3>;var thisTriIndex : u32=input.vertexIndex; \nfor (var i: u32=0u; i<3u; i=i+1u) {var provokingVertNum : u32=input.vertexIndex/3*3;let vertIdx=readVertexIndex(provokingVertNum+i);if (provokingVertNum+i==input.vertexIndex) {thisTriIndex=i;}\nvar positionUpdated=readVertexPosition(uniforms.vp_position_info,vertIdx);\n#include <instancesVertex>\nlet inputPosition: vec3f=positionUpdated;\n#include <morphTargetsVertex>(vertexInputs.position\\\\),inputPosition),vertexInputs.vertexIndex,vertIdx)[0..maxSimultaneousMorphTargets]\n#if NUM_BONE_INFLUENCERS>0\nlet matrixIndex=readMatrixIndices(uniforms.vp_matricesIndices_info,vertIdx);let matrixWeight=readMatrixWeights(uniforms.vp_matricesWeights_info,vertIdx);\n#if NUM_BONE_INFLUENCERS>4\nlet matrixIndexExtra=readMatrixIndicesExtra(uniforms.vp_matricesIndicesExtra_info,vertIdx);let matrixWeightExtra=readMatrixWeightsExtra(uniforms.vp_matricesWeightsExtra_info,vertIdx);\n#endif\n#endif\n#include<bonesVertex>(vertexInputs.matricesIndices,matrixIndex,vertexInputs.matricesWeights,matrixWeight,vertexInputs.matricesIndicesExtra,matrixIndexExtra,vertexInputs.matricesWeightsExtra,matrixWeightExtra)\n#include<bakedVertexAnimation>(vertexInputs.matricesIndices,matrixIndex,vertexInputs.matricesWeights,matrixWeight,vertexInputs.matricesIndicesExtra,matrixIndexExtra,vertexInputs.matricesWeightsExtra,matrixWeightExtra)\ntriPositions[i]=(finalWorld*vec4(positionUpdated,1.0)).xyz;}\nvar N : vec3<f32>=calculateTriangleNormal(triPositions[0],triPositions[1],triPositions[2]);let worldPos=triPositions[thisTriIndex];vertexOutputs.position=uniforms.invWorldScale*vec4(worldPos,1.0);N=abs(N);if (N.x>N.y && N.x>N.z) {vertexOutputs.f_swizzle=0;vertexOutputs.position=vec4f(vertexOutputs.position.yzx,1.0);} else if (N.y>N.z) {vertexOutputs.f_swizzle=1;vertexOutputs.position=vec4f(vertexOutputs.position.zxy,1.0);} else {vertexOutputs.f_swizzle=2;vertexOutputs.position=vec4f(vertexOutputs.position.xyz,1.0);}\nvertexOutputs.vNormalizedPosition=vertexOutputs.position.xyz*0.5+0.5;vertexOutputs.position.z =\nvertexOutputs.vNormalizedPosition.z; }\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const iblVoxelGridVertexShaderWGSL = { name, shader };\n"]}
|
|
@@ -441,7 +441,6 @@ export class WebXRMotionControllerTeleportation extends WebXRAbstractFeature {
|
|
|
441
441
|
this._xrSessionManager.onWorldScaleFactorChangedObservable.remove(this._worldScaleObserver);
|
|
442
442
|
}
|
|
443
443
|
this.onTargetMeshPositionUpdatedObservable.clear();
|
|
444
|
-
this.onTargetMeshPositionUpdatedObservable.clear();
|
|
445
444
|
this.onBeforeCameraTeleportRotation.clear();
|
|
446
445
|
this.onAfterCameraTeleportRotation.clear();
|
|
447
446
|
this.onBeforeCameraTeleport.clear();
|
|
@@ -515,7 +514,7 @@ export class WebXRMotionControllerTeleportation extends WebXRAbstractFeature {
|
|
|
515
514
|
_onXRFrame(_xrFrame) {
|
|
516
515
|
const frame = this._xrSessionManager.currentFrame;
|
|
517
516
|
const scene = this._xrSessionManager.scene;
|
|
518
|
-
if (!this.
|
|
517
|
+
if (!this.attached || !frame) {
|
|
519
518
|
return;
|
|
520
519
|
}
|
|
521
520
|
// render target if needed
|