@onerjs/core 8.31.5 → 8.31.7

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.
Files changed (72) hide show
  1. package/Animations/animation.d.ts +3 -1
  2. package/Animations/animation.js +5 -4
  3. package/Animations/animation.js.map +1 -1
  4. package/Behaviors/Cameras/interpolatingBehavior.d.ts +2 -1
  5. package/Behaviors/Cameras/interpolatingBehavior.js +11 -4
  6. package/Behaviors/Cameras/interpolatingBehavior.js.map +1 -1
  7. package/Cameras/Inputs/geospatialCameraKeyboardInput.js +2 -0
  8. package/Cameras/Inputs/geospatialCameraKeyboardInput.js.map +1 -1
  9. package/Cameras/Inputs/geospatialCameraPointersInput.js +3 -5
  10. package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
  11. package/Cameras/geospatialCamera.d.ts +20 -1
  12. package/Cameras/geospatialCamera.js +105 -28
  13. package/Cameras/geospatialCamera.js.map +1 -1
  14. package/Cameras/geospatialCameraMovement.d.ts +7 -2
  15. package/Cameras/geospatialCameraMovement.js +46 -10
  16. package/Cameras/geospatialCameraMovement.js.map +1 -1
  17. package/Engines/abstractEngine.js +2 -2
  18. package/Engines/abstractEngine.js.map +1 -1
  19. package/Engines/thinEngine.js +1 -1
  20. package/Engines/thinEngine.js.map +1 -1
  21. package/FrameGraph/Node/nodeRenderGraph.d.ts +22 -5
  22. package/FrameGraph/Node/nodeRenderGraph.js +39 -18
  23. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  24. package/FrameGraph/Passes/pass.d.ts +2 -0
  25. package/FrameGraph/Passes/pass.js +2 -0
  26. package/FrameGraph/Passes/pass.js.map +1 -1
  27. package/FrameGraph/Passes/renderPass.d.ts +2 -0
  28. package/FrameGraph/Passes/renderPass.js +4 -0
  29. package/FrameGraph/Passes/renderPass.js.map +1 -1
  30. package/FrameGraph/frameGraph.d.ts +13 -4
  31. package/FrameGraph/frameGraph.js +45 -5
  32. package/FrameGraph/frameGraph.js.map +1 -1
  33. package/FrameGraph/frameGraphRenderTarget.d.ts +1 -0
  34. package/FrameGraph/frameGraphRenderTarget.js +3 -0
  35. package/FrameGraph/frameGraphRenderTarget.js.map +1 -1
  36. package/FrameGraph/frameGraphTask.d.ts +6 -0
  37. package/FrameGraph/frameGraphTask.js +15 -0
  38. package/FrameGraph/frameGraphTask.js.map +1 -1
  39. package/FrameGraph/frameGraphTypes.d.ts +2 -0
  40. package/FrameGraph/frameGraphTypes.js.map +1 -1
  41. package/Materials/Node/nodeMaterial.js +3 -0
  42. package/Materials/Node/nodeMaterial.js.map +1 -1
  43. package/Materials/materialHelper.functions.d.ts +29 -7
  44. package/Materials/materialHelper.functions.js +59 -24
  45. package/Materials/materialHelper.functions.js.map +1 -1
  46. package/Materials/shaderMaterial.d.ts +1 -0
  47. package/Materials/shaderMaterial.js +6 -17
  48. package/Materials/shaderMaterial.js.map +1 -1
  49. package/Meshes/mesh.js +1 -1
  50. package/Meshes/mesh.js.map +1 -1
  51. package/Misc/screenshotTools.js +2 -8
  52. package/Misc/screenshotTools.js.map +1 -1
  53. package/Particles/Node/Blocks/index.d.ts +1 -0
  54. package/Particles/Node/Blocks/index.js +1 -0
  55. package/Particles/Node/Blocks/index.js.map +1 -1
  56. package/Particles/Node/Blocks/particleFloatToIntBlock.d.ts +46 -0
  57. package/Particles/Node/Blocks/particleFloatToIntBlock.js +120 -0
  58. package/Particles/Node/Blocks/particleFloatToIntBlock.js.map +1 -0
  59. package/Particles/Node/Blocks/systemBlock.d.ts +4 -4
  60. package/Particles/Node/Blocks/systemBlock.js +22 -16
  61. package/Particles/Node/Blocks/systemBlock.js.map +1 -1
  62. package/Particles/Node/nodeParticleBuildState.js +1 -1
  63. package/Particles/Node/nodeParticleBuildState.js.map +1 -1
  64. package/Particles/Node/nodeParticleSystemSet.helper.js +61 -30
  65. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  66. package/Particles/thinParticleSystem.d.ts +6 -0
  67. package/Particles/thinParticleSystem.js +21 -12
  68. package/Particles/thinParticleSystem.js.map +1 -1
  69. package/ShadersWGSL/iblVoxelGrid.vertex.d.ts +1 -0
  70. package/ShadersWGSL/iblVoxelGrid.vertex.js +53 -64
  71. package/ShadersWGSL/iblVoxelGrid.vertex.js.map +1 -1
  72. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
1
  import "./ShadersInclude/morphTargetsVertexGlobalDeclaration.js";
2
2
  import "./ShadersInclude/morphTargetsVertexDeclaration.js";
3
+ import "./ShadersInclude/bonesVertex.js";
3
4
  /** @internal */
4
5
  export declare const iblVoxelGridVertexShaderWGSL: {
5
6
  name: string;
@@ -2,6 +2,7 @@
2
2
  import { ShaderStore } from "../Engines/shaderStore.js";
3
3
  import "./ShadersInclude/morphTargetsVertexGlobalDeclaration.js";
4
4
  import "./ShadersInclude/morphTargetsVertexDeclaration.js";
5
+ import "./ShadersInclude/bonesVertex.js";
5
6
  const name = "iblVoxelGridVertexShader";
6
7
  const shader = `#include <bakedVertexAnimationDeclaration>
7
8
  #include <bonesDeclaration>(attribute matricesIndices : vec4f;,,attribute matricesWeights : vec4f;,,attribute matricesIndicesExtra : vec4f;,,attribute matricesWeightsExtra : vec4f;,)
@@ -14,70 +15,58 @@ var<storage,read> indices : array<u32>;
14
15
  #endif
15
16
  var<storage,read> position : array<f32>;
16
17
  #if NUM_BONE_INFLUENCERS>0
17
- var<storage,read> matricesIndices : array<u32>;var<storage,read> matricesWeights : array<f32>;
18
+ var<storage,read> matricesIndices : array<u32>;var<storage,read> matricesWeights : array<f32>;uniform vp_matricesIndices_info: vec3f;uniform vp_matricesWeights_info: vec3f;
18
19
  #if NUM_BONE_INFLUENCERS>4
19
- var<storage,read> matricesIndicesExtra : array<u32>;var<storage,read> matricesWeightsExtra : array<f32>;
20
- #endif
21
- #endif
22
- uniform world : mat4x4f;uniform invWorldScale: mat4x4f;varying vNormalizedPosition : vec3f;flat varying f_swizzle: i32;
23
- #ifndef POSITION_STRIDE
24
- #define POSITION_STRIDE 3
25
- #endif
26
- #ifndef POSITION_OFFSET
27
- #define POSITION_OFFSET 0
28
- #endif
29
- #ifndef POSITION_COMPONENT_COUNT
30
- #define POSITION_COMPONENT_COUNT 3
31
- #endif
32
- fn readVertexPosition(index : u32)->vec3f {var pos : vec3f;let baseOffset=POSITION_OFFSET+index*POSITION_STRIDE;pos.x=position[baseOffset];pos.y=position[baseOffset+1u];pos.z=position[baseOffset+2u];return pos;}
20
+ var<storage,read> matricesIndicesExtra : array<u32>;var<storage,read> matricesWeightsExtra : array<f32>;uniform vp_matricesIndicesExtra_info: vec3f;uniform vp_matricesWeightsExtra_info: vec3f;
21
+ #endif
22
+ #endif
23
+ uniform world : mat4x4f;uniform invWorldScale: mat4x4f;varying vNormalizedPosition : vec3f;flat varying f_swizzle: i32;uniform vp_position_info: vec3f;
24
+ fn convertToFloat(word: u32,byteInWord: u32,dataType: u32)->f32 {switch (dataType) {case 5120u: {
25
+ let shift=byteInWord*8u;let value=(word>>shift) & 0xFFu;return f32(i32(value<<24u)>>24u)/127.0; }
26
+ case 5121u: {
27
+ let shift=byteInWord*8u;let value=(word>>shift) & 0xFFu;return f32(value)/255.0;}
28
+ case 5122u: {
29
+ let shift=(byteInWord/2u)*16u;let value=(word>>shift) & 0xFFFFu;return f32(i32(value<<16u)>>16u)/32767.0;}
30
+ case 5123u: {
31
+ let shift=(byteInWord/2u)*16u;let value=(word>>shift) & 0xFFFFu;return f32(value)/65535.0;}
32
+ case 5126u: {
33
+ return bitcast<f32>(word);}
34
+ default: {return 0.0;}}}
35
+ fn 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);}
36
+ fn 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(
37
+ readPositionValue(offset,dataType),
38
+ readPositionValue(offset+componentSize,dataType),
39
+ readPositionValue(offset+componentSize*2u,dataType)
40
+ );}
33
41
  #if NUM_BONE_INFLUENCERS>0
34
- #ifndef MATRICESINDICES_STRIDE
35
- #define MATRICESINDICES_STRIDE 1
36
- #endif
37
- #ifndef MATRICESINDICES_OFFSET
38
- #define MATRICESINDICES_OFFSET 0
39
- #endif
40
- fn readMatrixIndices(index : u32)->vec4f {let baseOffset=MATRICESINDICES_OFFSET+index*MATRICESINDICES_STRIDE;
41
- #if MATRICESINDICES_COMPONENT_BYTES==1
42
- let packed=matricesIndices[baseOffset];return vec4f(
43
- f32(packed & 0xFFu),
44
- f32((packed>>8u) & 0xFFu),
45
- f32((packed>>16u) & 0xFFu),
46
- f32((packed>>24u) & 0xFFu)
47
- );
48
- #elif MATRICESINDICES_COMPONENT_BYTES==2
49
- let packed1=matricesIndices[baseOffset];let packed2=matricesIndices[baseOffset+1u];return vec4f(
50
- f32(packed1 & 0xFFFFu),
51
- f32((packed1>>16u) & 0xFFFFu),
52
- f32(packed2 & 0xFFFFu),
53
- f32((packed2>>16u) & 0xFFFFu)
54
- );
55
- #endif
56
- }
57
- #ifndef MATRICESWEIGHTS_STRIDE
58
- #define MATRICESWEIGHTS_STRIDE 4
59
- #endif
60
- #ifndef MATRICESWEIGHTS_OFFSET
61
- #define MATRICESWEIGHTS_OFFSET 0
62
- #endif
63
- fn readMatrixWeights(index : u32)->vec4f {let baseOffset=MATRICESWEIGHTS_OFFSET+index*MATRICESWEIGHTS_STRIDE;return vec4f(
64
- matricesWeights[baseOffset],
65
- matricesWeights[baseOffset+1u],
66
- matricesWeights[baseOffset+2u],
67
- matricesWeights[baseOffset+3u]
42
+ fn readMatrixIndexValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=bitcast<u32>(matricesIndices[wordOffset]);return convertToFloat(word,byteInWord,dataType);}
43
+ fn 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(
44
+ readMatrixIndexValue(offset,dataType),
45
+ readMatrixIndexValue(offset+componentSize,dataType),
46
+ readMatrixIndexValue(offset+componentSize*2u,dataType),
47
+ readMatrixIndexValue(offset+componentSize*3u,dataType)
48
+ );}
49
+ fn 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);}
50
+ fn 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(
51
+ readMatrixWeightValue(offset,dataType),
52
+ readMatrixWeightValue(offset+componentSize,dataType),
53
+ readMatrixWeightValue(offset+componentSize*2u,dataType),
54
+ readMatrixWeightValue(offset+componentSize*3u,dataType)
68
55
  );}
69
56
  #if NUM_BONE_INFLUENCERS>4
70
- fn readMatrixIndicesExtra(index : u32)->vec4f {let baseOffset=MATRICESINDICESEXTRA_OFFSET+index*MATRICESINDICESEXTRA_STRIDE;let packed=matricesIndicesExtra[baseOffset];return vec4f(
71
- f32(packed & 0xFFu),
72
- f32((packed>>8u) & 0xFFu),
73
- f32((packed>>16u) & 0xFFu),
74
- f32((packed>>24u) & 0xFFu)
57
+ fn readMatrixIndexExtraValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=bitcast<u32>(matricesIndicesExtra[wordOffset]);return convertToFloat(word,byteInWord,dataType);}
58
+ fn 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(
59
+ readMatrixIndexExtraValue(offset,dataType),
60
+ readMatrixIndexExtraValue(offset+componentSize,dataType),
61
+ readMatrixIndexExtraValue(offset+componentSize*2u,dataType),
62
+ readMatrixIndexExtraValue(offset+componentSize*3u,dataType)
75
63
  );}
76
- fn readMatrixWeightsExtra(index : u32)->vec4f {let baseOffset=MATRICESWEIGHTSEXTRA_OFFSET+index*MATRICESWEIGHTSEXTRA_STRIDE;return vec4f(
77
- matricesWeightsExtra[baseOffset],
78
- matricesWeightsExtra[baseOffset+1u],
79
- matricesWeightsExtra[baseOffset+2u],
80
- matricesWeightsExtra[baseOffset+3u]
64
+ fn 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);}
65
+ fn 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(
66
+ readMatrixWeightExtraValue(offset,dataType),
67
+ readMatrixWeightExtraValue(offset+componentSize,dataType),
68
+ readMatrixWeightExtraValue(offset+componentSize*2u,dataType),
69
+ readMatrixWeightExtraValue(offset+componentSize*3u,dataType)
81
70
  );}
82
71
  #endif
83
72
  #endif
@@ -98,20 +87,20 @@ fn calculateTriangleNormal(v0
98
87
  : vec3<f32>)
99
88
  ->vec3<f32> {let edge1=v1-v0;let edge2=v2-v0;let triangleNormal=cross(edge1,edge2);let normalizedTriangleNormal=normalize(triangleNormal);return normalizedTriangleNormal;}
100
89
  @vertex
101
- fn main(input : VertexInputs)->FragmentInputs {var vertIdx=readVertexIndex(input.vertexIndex);var positionUpdated=readVertexPosition(vertIdx);
90
+ fn main(input : VertexInputs)->FragmentInputs {var vertIdx=readVertexIndex(input.vertexIndex);var positionUpdated=readVertexPosition(uniforms.vp_position_info,vertIdx);
102
91
  #include <morphTargetsVertexGlobal>
103
92
  let inputPosition: vec3f=positionUpdated;
104
93
  #include <morphTargetsVertex>(vertexInputs.position\\),inputPosition),vertexInputs.vertexIndex,vertIdx)[0..maxSimultaneousMorphTargets]
105
94
  #include <instancesVertex>
106
95
  #include <bakedVertexAnimation>
107
96
  #if NUM_BONE_INFLUENCERS>0
108
- let matrixIndex=readMatrixIndices(vertIdx);let matrixWeight=readMatrixWeights(vertIdx);
97
+ let matrixIndex=readMatrixIndices(uniforms.vp_matricesIndices_info,vertIdx);let matrixWeight=readMatrixWeights(uniforms.vp_matricesWeights_info,vertIdx);
109
98
  #if NUM_BONE_INFLUENCERS>4
110
- let matrixIndexExtra=readMatrixIndicesExtra(vertIdx);let matrixWeightExtra=readMatrixWeightsExtra(vertIdx);
99
+ let matrixIndexExtra=readMatrixIndicesExtra(uniforms.vp_matricesIndicesExtra_info,vertIdx);let matrixWeightExtra=readMatrixWeightsExtra(uniforms.vp_matricesWeightsExtra_info,vertIdx);
111
100
  #endif
112
101
  #endif
113
- #include <bonesVertex>(vertexInputs.matricesIndices,matrixIndex,vertexInputs.matricesWeights,matrixWeight)
114
- let worldPos=finalWorld*vec4f(positionUpdated,1.0);vertexOutputs.position=uniforms.invWorldScale*worldPos;var provokingVertNum : u32=input.vertexIndex/3*3;var pos0=readVertexPosition(readVertexIndex(provokingVertNum));var pos1=readVertexPosition(readVertexIndex(provokingVertNum+1));var pos2=readVertexPosition(readVertexIndex(provokingVertNum+2));var N : vec3<f32>=calculateTriangleNormal(pos0,pos1,pos2);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);}
102
+ #include<bonesVertex>(vertexInputs.matricesIndices,matrixIndex,vertexInputs.matricesWeights,matrixWeight)
103
+ let worldPos=finalWorld*vec4f(positionUpdated,1.0);vertexOutputs.position=uniforms.invWorldScale*worldPos;var provokingVertNum : u32=input.vertexIndex/3*3;var pos0=readVertexPosition(uniforms.vp_position_info,readVertexIndex(provokingVertNum));var pos1=readVertexPosition(uniforms.vp_position_info,readVertexIndex(provokingVertNum+1));var pos2=readVertexPosition(uniforms.vp_position_info,readVertexIndex(provokingVertNum+2));var N : vec3<f32>=calculateTriangleNormal(pos0,pos1,pos2);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);}
115
104
  vertexOutputs.vNormalizedPosition=vertexOutputs.position.xyz*0.5+0.5;vertexOutputs.position.z =
116
105
  vertexOutputs.vNormalizedPosition.z; }
117
106
  `;
@@ -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;AAExD,MAAM,IAAI,GAAG,0BAA0B,CAAC;AACxC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Gd,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\";\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>;\n#if NUM_BONE_INFLUENCERS>4\nvar<storage,read> matricesIndicesExtra : array<u32>;var<storage,read> matricesWeightsExtra : array<f32>;\n#endif\n#endif\nuniform world : mat4x4f;uniform invWorldScale: mat4x4f;varying vNormalizedPosition : vec3f;flat varying f_swizzle: i32;\n#ifndef POSITION_STRIDE\n#define POSITION_STRIDE 3\n#endif\n#ifndef POSITION_OFFSET\n#define POSITION_OFFSET 0\n#endif\n#ifndef POSITION_COMPONENT_COUNT\n#define POSITION_COMPONENT_COUNT 3\n#endif\nfn readVertexPosition(index : u32)->vec3f {var pos : vec3f;let baseOffset=POSITION_OFFSET+index*POSITION_STRIDE;pos.x=position[baseOffset];pos.y=position[baseOffset+1u];pos.z=position[baseOffset+2u];return pos;}\n#if NUM_BONE_INFLUENCERS>0\n#ifndef MATRICESINDICES_STRIDE\n#define MATRICESINDICES_STRIDE 1\n#endif\n#ifndef MATRICESINDICES_OFFSET\n#define MATRICESINDICES_OFFSET 0\n#endif\nfn readMatrixIndices(index : u32)->vec4f {let baseOffset=MATRICESINDICES_OFFSET+index*MATRICESINDICES_STRIDE;\n#if MATRICESINDICES_COMPONENT_BYTES==1\nlet packed=matricesIndices[baseOffset];return vec4f(\nf32(packed & 0xFFu),\nf32((packed>>8u) & 0xFFu),\nf32((packed>>16u) & 0xFFu),\nf32((packed>>24u) & 0xFFu)\n);\n#elif MATRICESINDICES_COMPONENT_BYTES==2\nlet packed1=matricesIndices[baseOffset];let packed2=matricesIndices[baseOffset+1u];return vec4f(\nf32(packed1 & 0xFFFFu),\nf32((packed1>>16u) & 0xFFFFu),\nf32(packed2 & 0xFFFFu),\nf32((packed2>>16u) & 0xFFFFu)\n);\n#endif\n}\n#ifndef MATRICESWEIGHTS_STRIDE\n#define MATRICESWEIGHTS_STRIDE 4\n#endif\n#ifndef MATRICESWEIGHTS_OFFSET\n#define MATRICESWEIGHTS_OFFSET 0\n#endif\nfn readMatrixWeights(index : u32)->vec4f {let baseOffset=MATRICESWEIGHTS_OFFSET+index*MATRICESWEIGHTS_STRIDE;return vec4f(\nmatricesWeights[baseOffset],\nmatricesWeights[baseOffset+1u],\nmatricesWeights[baseOffset+2u],\nmatricesWeights[baseOffset+3u]\n);}\n#if NUM_BONE_INFLUENCERS>4\nfn readMatrixIndicesExtra(index : u32)->vec4f {let baseOffset=MATRICESINDICESEXTRA_OFFSET+index*MATRICESINDICESEXTRA_STRIDE;let packed=matricesIndicesExtra[baseOffset];return vec4f(\nf32(packed & 0xFFu),\nf32((packed>>8u) & 0xFFu),\nf32((packed>>16u) & 0xFFu),\nf32((packed>>24u) & 0xFFu)\n);}\nfn readMatrixWeightsExtra(index : u32)->vec4f {let baseOffset=MATRICESWEIGHTSEXTRA_OFFSET+index*MATRICESWEIGHTSEXTRA_STRIDE;return vec4f(\nmatricesWeightsExtra[baseOffset],\nmatricesWeightsExtra[baseOffset+1u],\nmatricesWeightsExtra[baseOffset+2u],\nmatricesWeightsExtra[baseOffset+3u]\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 {var vertIdx=readVertexIndex(input.vertexIndex);var positionUpdated=readVertexPosition(vertIdx);\n#include <morphTargetsVertexGlobal>\nlet inputPosition: vec3f=positionUpdated;\n#include <morphTargetsVertex>(vertexInputs.position\\\\),inputPosition),vertexInputs.vertexIndex,vertIdx)[0..maxSimultaneousMorphTargets]\n#include <instancesVertex>\n#include <bakedVertexAnimation>\n#if NUM_BONE_INFLUENCERS>0\nlet matrixIndex=readMatrixIndices(vertIdx);let matrixWeight=readMatrixWeights(vertIdx);\n#if NUM_BONE_INFLUENCERS>4\nlet matrixIndexExtra=readMatrixIndicesExtra(vertIdx);let matrixWeightExtra=readMatrixWeightsExtra(vertIdx);\n#endif\n#endif\n#include <bonesVertex>(vertexInputs.matricesIndices,matrixIndex,vertexInputs.matricesWeights,matrixWeight)\nlet worldPos=finalWorld*vec4f(positionUpdated,1.0);vertexOutputs.position=uniforms.invWorldScale*worldPos;var provokingVertNum : u32=input.vertexIndex/3*3;var pos0=readVertexPosition(readVertexIndex(provokingVertNum));var pos1=readVertexPosition(readVertexIndex(provokingVertNum+1));var pos2=readVertexPosition(readVertexIndex(provokingVertNum+2));var N : vec3<f32>=calculateTriangleNormal(pos0,pos1,pos2);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;AAEtC,MAAM,IAAI,GAAG,0BAA0B,CAAC;AACxC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmGd,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\";\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/2u)*16u;let value=(word>>shift) & 0xFFFFu;return f32(i32(value<<16u)>>16u)/32767.0;}\ncase 5123u: { \nlet shift=(byteInWord/2u)*16u;let value=(word>>shift) & 0xFFFFu;return f32(value)/65535.0;}\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=bitcast<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=bitcast<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 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(\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 {var vertIdx=readVertexIndex(input.vertexIndex);var positionUpdated=readVertexPosition(uniforms.vp_position_info,vertIdx);\n#include <morphTargetsVertexGlobal>\nlet inputPosition: vec3f=positionUpdated;\n#include <morphTargetsVertex>(vertexInputs.position\\\\),inputPosition),vertexInputs.vertexIndex,vertIdx)[0..maxSimultaneousMorphTargets]\n#include <instancesVertex>\n#include <bakedVertexAnimation>\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)\nlet worldPos=finalWorld*vec4f(positionUpdated,1.0);vertexOutputs.position=uniforms.invWorldScale*worldPos;var provokingVertNum : u32=input.vertexIndex/3*3;var pos0=readVertexPosition(uniforms.vp_position_info,readVertexIndex(provokingVertNum));var pos1=readVertexPosition(uniforms.vp_position_info,readVertexIndex(provokingVertNum+1));var pos2=readVertexPosition(uniforms.vp_position_info,readVertexIndex(provokingVertNum+2));var N : vec3<f32>=calculateTriangleNormal(pos0,pos1,pos2);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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onerjs/core",
3
- "version": "8.31.5",
3
+ "version": "8.31.7",
4
4
  "main": "index.js",
5
5
  "module": "index.js",
6
6
  "types": "index.d.ts",