@zephyr3d/scene 0.4.0 → 0.6.0

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 (233) hide show
  1. package/dist/animation/animation.js +25 -117
  2. package/dist/animation/animation.js.map +1 -1
  3. package/dist/animation/animationset.js +191 -51
  4. package/dist/animation/animationset.js.map +1 -1
  5. package/dist/animation/animationtrack.js +6 -18
  6. package/dist/animation/animationtrack.js.map +1 -1
  7. package/dist/animation/eulerrotationtrack.js +16 -6
  8. package/dist/animation/eulerrotationtrack.js.map +1 -1
  9. package/dist/animation/morphtarget.js +104 -0
  10. package/dist/animation/morphtarget.js.map +1 -0
  11. package/dist/animation/morphtrack.js +70 -0
  12. package/dist/animation/morphtrack.js.map +1 -0
  13. package/dist/animation/rotationtrack.js +15 -7
  14. package/dist/animation/rotationtrack.js.map +1 -1
  15. package/dist/animation/scaletrack.js +15 -7
  16. package/dist/animation/scaletrack.js.map +1 -1
  17. package/dist/animation/skeleton.js +107 -5
  18. package/dist/animation/skeleton.js.map +1 -1
  19. package/dist/animation/translationtrack.js +15 -7
  20. package/dist/animation/translationtrack.js.map +1 -1
  21. package/dist/app.js +4 -26
  22. package/dist/app.js.map +1 -1
  23. package/dist/asset/assetmanager.js +60 -109
  24. package/dist/asset/assetmanager.js.map +1 -1
  25. package/dist/asset/loaders/dds/dds.js +77 -3
  26. package/dist/asset/loaders/dds/dds.js.map +1 -1
  27. package/dist/asset/loaders/dds/dds_loader.js +1 -1
  28. package/dist/asset/loaders/gltf/gltf_loader.js +287 -40
  29. package/dist/asset/loaders/gltf/gltf_loader.js.map +1 -1
  30. package/dist/asset/loaders/image/tga_Loader.js +1 -1
  31. package/dist/asset/loaders/image/webimage_loader.js +16 -0
  32. package/dist/asset/loaders/image/webimage_loader.js.map +1 -1
  33. package/dist/asset/model.js +16 -9
  34. package/dist/asset/model.js.map +1 -1
  35. package/dist/blitter/bilateralblur.js +222 -0
  36. package/dist/{render/temporalcache.js.map → blitter/bilateralblur.js.map} +1 -1
  37. package/dist/blitter/blitter.js +9 -3
  38. package/dist/blitter/blitter.js.map +1 -1
  39. package/dist/blitter/depthlimitedgaussion.js +96 -39
  40. package/dist/blitter/depthlimitedgaussion.js.map +1 -1
  41. package/dist/blitter/gaussianblur.js +21 -21
  42. package/dist/camera/camera.js +200 -4
  43. package/dist/camera/camera.js.map +1 -1
  44. package/dist/index.d.ts +6406 -5786
  45. package/dist/index.js +12 -10
  46. package/dist/index.js.map +1 -1
  47. package/dist/material/blinn.js +15 -4
  48. package/dist/material/blinn.js.map +1 -1
  49. package/dist/material/lambert.js +26 -17
  50. package/dist/material/lambert.js.map +1 -1
  51. package/dist/material/material.js +13 -2
  52. package/dist/material/material.js.map +1 -1
  53. package/dist/material/meshmaterial.js +103 -31
  54. package/dist/material/meshmaterial.js.map +1 -1
  55. package/dist/material/mixins/albedocolor.js +5 -4
  56. package/dist/material/mixins/albedocolor.js.map +1 -1
  57. package/dist/material/mixins/lightmodel/blinnphong.js +17 -7
  58. package/dist/material/mixins/lightmodel/blinnphong.js.map +1 -1
  59. package/dist/material/mixins/lightmodel/lambert.js +5 -5
  60. package/dist/material/mixins/lightmodel/pbrmetallicroughness.js +16 -7
  61. package/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -1
  62. package/dist/material/mixins/lightmodel/pbrspecularglossness.js +16 -7
  63. package/dist/material/mixins/lightmodel/pbrspecularglossness.js.map +1 -1
  64. package/dist/material/mixins/lit.js +2 -2
  65. package/dist/material/mixins/pbr/common.js +454 -19
  66. package/dist/material/mixins/pbr/common.js.map +1 -1
  67. package/dist/material/pbrmr.js +28 -6
  68. package/dist/material/pbrmr.js.map +1 -1
  69. package/dist/material/pbrsg.js +27 -9
  70. package/dist/material/pbrsg.js.map +1 -1
  71. package/dist/material/shader/helper.js +128 -23
  72. package/dist/material/shader/helper.js.map +1 -1
  73. package/dist/material/unlit.js +8 -4
  74. package/dist/material/unlit.js.map +1 -1
  75. package/dist/posteffect/bloom.js +34 -53
  76. package/dist/posteffect/bloom.js.map +1 -1
  77. package/dist/posteffect/compositor.js +48 -58
  78. package/dist/posteffect/compositor.js.map +1 -1
  79. package/dist/posteffect/fxaa.js +3 -11
  80. package/dist/posteffect/fxaa.js.map +1 -1
  81. package/dist/posteffect/grayscale.js +3 -11
  82. package/dist/posteffect/grayscale.js.map +1 -1
  83. package/dist/posteffect/posteffect.js +4 -0
  84. package/dist/posteffect/posteffect.js.map +1 -1
  85. package/dist/posteffect/sao.js +55 -48
  86. package/dist/posteffect/sao.js.map +1 -1
  87. package/dist/posteffect/ssr.js +536 -0
  88. package/dist/{material/lit.js.map → posteffect/ssr.js.map} +1 -1
  89. package/dist/posteffect/tonemap.js +3 -11
  90. package/dist/posteffect/tonemap.js.map +1 -1
  91. package/dist/posteffect/water.js +306 -340
  92. package/dist/posteffect/water.js.map +1 -1
  93. package/dist/render/abuffer_oit.js +2 -2
  94. package/dist/render/clipmap.js +16 -19
  95. package/dist/render/clipmap.js.map +1 -1
  96. package/dist/render/cull_visitor.js +8 -6
  97. package/dist/render/cull_visitor.js.map +1 -1
  98. package/dist/render/depthpass.js +30 -14
  99. package/dist/render/depthpass.js.map +1 -1
  100. package/dist/render/drawable_mixin.js +70 -22
  101. package/dist/render/drawable_mixin.js.map +1 -1
  102. package/dist/render/envlight.js +169 -33
  103. package/dist/render/envlight.js.map +1 -1
  104. package/dist/render/fft_wavegenerator.js +989 -0
  105. package/dist/{shaders/framework.js.map → render/fft_wavegenerator.js.map} +1 -1
  106. package/dist/render/gerstner_wavegenerator.js +265 -0
  107. package/dist/{material/standard.js.map → render/gerstner_wavegenerator.js.map} +1 -1
  108. package/dist/render/globalbindgroup_allocator.js +2 -1
  109. package/dist/render/globalbindgroup_allocator.js.map +1 -1
  110. package/dist/render/hzb.js +273 -0
  111. package/dist/{material/terrainlightmodel.js.map → render/hzb.js.map} +1 -1
  112. package/dist/render/lightpass.js +68 -28
  113. package/dist/render/lightpass.js.map +1 -1
  114. package/dist/render/objectcolorpass.js +51 -0
  115. package/dist/render/objectcolorpass.js.map +1 -0
  116. package/dist/render/render_queue.js +211 -158
  117. package/dist/render/render_queue.js.map +1 -1
  118. package/dist/render/renderbundle_wrapper.js +79 -0
  119. package/dist/render/renderbundle_wrapper.js.map +1 -1
  120. package/dist/render/renderer.js +151 -35
  121. package/dist/render/renderer.js.map +1 -1
  122. package/dist/render/renderpass.js +27 -20
  123. package/dist/render/renderpass.js.map +1 -1
  124. package/dist/render/shadowmap_pass.js +20 -14
  125. package/dist/render/shadowmap_pass.js.map +1 -1
  126. package/dist/render/sky.js +12 -13
  127. package/dist/render/sky.js.map +1 -1
  128. package/dist/render/watermesh.js +94 -828
  129. package/dist/render/watermesh.js.map +1 -1
  130. package/dist/render/wavegenerator.js +8 -0
  131. package/dist/render/wavegenerator.js.map +1 -0
  132. package/dist/render/weightedblended_oit.js +11 -28
  133. package/dist/render/weightedblended_oit.js.map +1 -1
  134. package/dist/scene/batchgroup.js +60 -14
  135. package/dist/scene/batchgroup.js.map +1 -1
  136. package/dist/scene/environment.js +24 -3
  137. package/dist/scene/environment.js.map +1 -1
  138. package/dist/scene/graph_node.js +0 -14
  139. package/dist/scene/graph_node.js.map +1 -1
  140. package/dist/scene/light.js +5 -5
  141. package/dist/scene/mesh.js +62 -15
  142. package/dist/scene/mesh.js.map +1 -1
  143. package/dist/scene/octree.js +5 -2
  144. package/dist/scene/octree.js.map +1 -1
  145. package/dist/scene/raycast_visitor.js +4 -2
  146. package/dist/scene/raycast_visitor.js.map +1 -1
  147. package/dist/scene/scene.js +6 -9
  148. package/dist/scene/scene.js.map +1 -1
  149. package/dist/scene/scene_node.js +11 -8
  150. package/dist/scene/scene_node.js.map +1 -1
  151. package/dist/scene/terrain/grass.js +10 -2
  152. package/dist/scene/terrain/grass.js.map +1 -1
  153. package/dist/scene/terrain/heightfield.js +135 -53
  154. package/dist/scene/terrain/heightfield.js.map +1 -1
  155. package/dist/scene/terrain/patch.js +10 -2
  156. package/dist/scene/terrain/patch.js.map +1 -1
  157. package/dist/scene/terrain/quadtree.js +2 -2
  158. package/dist/scene/terrain/terrain.js +1 -1
  159. package/dist/scene/xform.js +7 -9
  160. package/dist/scene/xform.js.map +1 -1
  161. package/dist/shaders/misc.js +10 -1
  162. package/dist/shaders/misc.js.map +1 -1
  163. package/dist/shaders/noise.js +81 -16
  164. package/dist/shaders/noise.js.map +1 -1
  165. package/dist/shaders/shadow.js +1 -9
  166. package/dist/shaders/shadow.js.map +1 -1
  167. package/dist/shaders/ssr.js +442 -0
  168. package/dist/{material/terrainmat.js.map → shaders/ssr.js.map} +1 -1
  169. package/dist/shaders/water.js +377 -250
  170. package/dist/shaders/water.js.map +1 -1
  171. package/dist/shadow/esm.js +4 -22
  172. package/dist/shadow/esm.js.map +1 -1
  173. package/dist/shadow/shadowmapper.js +56 -31
  174. package/dist/shadow/shadowmapper.js.map +1 -1
  175. package/dist/shadow/vsm.js +4 -24
  176. package/dist/shadow/vsm.js.map +1 -1
  177. package/dist/shapes/cylinder.js +6 -5
  178. package/dist/shapes/cylinder.js.map +1 -1
  179. package/dist/utility/bounding_volume.js +1 -53
  180. package/dist/utility/bounding_volume.js.map +1 -1
  181. package/dist/utility/draco/decoder.js +116 -0
  182. package/dist/utility/draco/decoder.js.map +1 -0
  183. package/dist/utility/misc.js +93 -0
  184. package/dist/utility/misc.js.map +1 -0
  185. package/dist/utility/shprojection.js +2 -7
  186. package/dist/utility/shprojection.js.map +1 -1
  187. package/dist/utility/textures/ggxlut.js +213 -0
  188. package/dist/utility/textures/ggxlut.js.map +1 -0
  189. package/dist/utility/textures/gradientnoise.js +61 -0
  190. package/dist/utility/textures/gradientnoise.js.map +1 -0
  191. package/dist/utility/textures/randomnoise.js +41 -0
  192. package/dist/utility/textures/randomnoise.js.map +1 -0
  193. package/dist/values.js +25 -1
  194. package/dist/values.js.map +1 -1
  195. package/package.json +5 -8
  196. package/dist/animation/usertrack.js +0 -47
  197. package/dist/animation/usertrack.js.map +0 -1
  198. package/dist/material/grassmat.js +0 -127
  199. package/dist/material/grassmat.js.map +0 -1
  200. package/dist/material/lightmodel.js +0 -2074
  201. package/dist/material/lightmodel.js.map +0 -1
  202. package/dist/material/lit.js +0 -578
  203. package/dist/material/mixins/pbr/metallicroughness.js +0 -126
  204. package/dist/material/mixins/pbr/metallicroughness.js.map +0 -1
  205. package/dist/material/mixins/pbr/specularglossness.js +0 -104
  206. package/dist/material/mixins/pbr/specularglossness.js.map +0 -1
  207. package/dist/material/pbr.js +0 -27
  208. package/dist/material/pbr.js.map +0 -1
  209. package/dist/material/standard.js +0 -282
  210. package/dist/material/terrainlightmodel.js +0 -259
  211. package/dist/material/terrainmat.js +0 -357
  212. package/dist/render/depth_pass.js +0 -47
  213. package/dist/render/depth_pass.js.map +0 -1
  214. package/dist/render/forward.js +0 -186
  215. package/dist/render/forward.js.map +0 -1
  216. package/dist/render/forward_pass.js +0 -137
  217. package/dist/render/forward_pass.js.map +0 -1
  218. package/dist/render/helper.js +0 -38
  219. package/dist/render/helper.js.map +0 -1
  220. package/dist/render/renderscheme.js +0 -61
  221. package/dist/render/renderscheme.js.map +0 -1
  222. package/dist/render/temporalcache.js +0 -222
  223. package/dist/scene/model.js +0 -111
  224. package/dist/scene/model.js.map +0 -1
  225. package/dist/scene/octree_update_visitor.js +0 -20
  226. package/dist/scene/octree_update_visitor.js.map +0 -1
  227. package/dist/shaders/builtins.js +0 -110
  228. package/dist/shaders/builtins.js.map +0 -1
  229. package/dist/shaders/framework.js +0 -723
  230. package/dist/shaders/lighting.js +0 -335
  231. package/dist/shaders/lighting.js.map +0 -1
  232. package/dist/utility/sheenlut.js +0 -196
  233. package/dist/utility/sheenlut.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"framework.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"fft_wavegenerator.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,265 @@
1
+ import { WaveGenerator } from './wavegenerator.js';
2
+
3
+ const MAX_NUM_WAVES = 64;
4
+ /**
5
+ * Gerstner wave generator.
6
+ * @public
7
+ */ class GerstnerWaveGenerator extends WaveGenerator {
8
+ _currentTime;
9
+ _waveParams;
10
+ _numWaves;
11
+ /**
12
+ * Creates a new Gerstner wave generator.
13
+ */ constructor(){
14
+ super();
15
+ this._currentTime = 0;
16
+ this._waveParams = new Float32Array(8 * MAX_NUM_WAVES);
17
+ this.randomWave(0);
18
+ this.randomWave(1);
19
+ this.randomWave(2);
20
+ this.randomWave(3);
21
+ this._numWaves = 4;
22
+ }
23
+ /** Gets the number of waves. */ get numWaves() {
24
+ return this._numWaves;
25
+ }
26
+ set numWaves(val) {
27
+ if (!Number.isInteger(val) || val <= 0 || val > MAX_NUM_WAVES) {
28
+ console.error(`Invalid wave number: ${val}`);
29
+ return;
30
+ }
31
+ for(let i = this._numWaves; i < val; i++){
32
+ this.randomWave(i);
33
+ }
34
+ this._numWaves = val;
35
+ }
36
+ /**
37
+ * Sets the angle of the wave direction in radians.
38
+ * @param waveIndex - index of the wave to set.
39
+ * @param angle - angle of the wave direction in radians.
40
+ */ setWaveDirection(waveIndex, angle) {
41
+ if (waveIndex < MAX_NUM_WAVES) {
42
+ this._waveParams[waveIndex * 8 + 0] = angle;
43
+ }
44
+ }
45
+ /**
46
+ * Gets the angle of the wave direction in radians.
47
+ * @param waveIndex - index of the wave to get.
48
+ * @returns Angle of the wave direction in radians.
49
+ */ getWaveDirection(waveIndex) {
50
+ return waveIndex < MAX_NUM_WAVES ? this._waveParams[waveIndex * 8 + 0] : 0;
51
+ }
52
+ /**
53
+ * Sets the steepness of the wave.
54
+ * @param waveIndex - index of the wave to set.
55
+ * @param steepness - Steepness of the wave.
56
+ */ setWaveSteepness(waveIndex, steepness) {
57
+ if (waveIndex < MAX_NUM_WAVES) {
58
+ this._waveParams[waveIndex * 8 + 1] = steepness;
59
+ }
60
+ }
61
+ /**
62
+ * Gets the steepness of the wave.
63
+ * @param waveIndex - index of the wave to set.
64
+ * @returns Steepness of the wave.
65
+ */ getWaveSteepness(waveIndex) {
66
+ return waveIndex < MAX_NUM_WAVES ? this._waveParams[waveIndex * 8 + 1] : 0;
67
+ }
68
+ /**
69
+ * Sets the amplitude of the wave.
70
+ * @param waveIndex - index of the wave to set.
71
+ * @param val - Amplitude of the wave.
72
+ */ setWaveAmplitude(waveIndex, val) {
73
+ if (waveIndex < MAX_NUM_WAVES) {
74
+ this._waveParams[waveIndex * 8 + 2] = val;
75
+ }
76
+ }
77
+ /**
78
+ * Gets the amplitude of the wave.
79
+ * @param waveIndex - index of the wave to set.
80
+ * @returns Amplitude of the wave.
81
+ */ getWaveAmplitude(waveIndex) {
82
+ return waveIndex < MAX_NUM_WAVES ? this._waveParams[waveIndex * 8 + 2] : 0;
83
+ }
84
+ /**
85
+ * Sets the length of the wave.
86
+ * @param waveIndex - index of the wave to set.
87
+ * @param val - Length of the wave.
88
+ */ setWaveLength(waveIndex, val) {
89
+ if (waveIndex < MAX_NUM_WAVES) {
90
+ this._waveParams[waveIndex * 8 + 3] = val;
91
+ }
92
+ }
93
+ /**
94
+ * Gets the length of the wave.
95
+ * @param waveIndex - index of the wave to set.
96
+ * @returns Length of the wave.
97
+ */ getWaveLength(waveIndex) {
98
+ return waveIndex < MAX_NUM_WAVES ? this._waveParams[waveIndex * 8 + 3] : 0;
99
+ }
100
+ /**
101
+ * Query if the wave is an omni-directional wave.
102
+ * @param waveIndex - index of the wave to set.
103
+ * @returns true if the wave is an omni-directional wave, false otherwise.
104
+ */ isOmniWave(waveIndex) {
105
+ return waveIndex < MAX_NUM_WAVES ? this._waveParams[waveIndex * 8 + 7] !== 0 : false;
106
+ }
107
+ /**
108
+ * Sets whether the wave is an omni-directional wave.
109
+ * @param waveIndex - index of the wave to set.
110
+ * @param isOmni - true if the wave is an omni-directional wave, false otherwise.
111
+ */ setOmniWave(waveIndex, isOmni) {
112
+ if (waveIndex < MAX_NUM_WAVES) {
113
+ this._waveParams[waveIndex * 8 + 7] = isOmni ? 1 : 0;
114
+ }
115
+ }
116
+ /**
117
+ * Gets the X coordinate of the wave origin if it is an omni-directional wave.
118
+ * @param waveIndex - index of the wave to set.
119
+ * @returns X coordinate of the wave origin if it is an omni-directional wave, 0 otherwise.
120
+ */ getOriginX(waveIndex) {
121
+ return waveIndex < MAX_NUM_WAVES ? this._waveParams[waveIndex * 8 + 4] : 0;
122
+ }
123
+ /**
124
+ * Gets the Z coordinate of the wave origin if it is an omni-directional wave.
125
+ * @param waveIndex - index of the wave to set.
126
+ * @returns Z coordinate of the wave origin if it is an omni-directional wave, 0 otherwise.
127
+ */ getOriginZ(waveIndex) {
128
+ return waveIndex < MAX_NUM_WAVES ? this._waveParams[waveIndex * 8 + 6] : 0;
129
+ }
130
+ /**
131
+ * Sets the X and Z coordinates of the wave origin if it is an omni-directional wave.
132
+ * @param waveIndex - index of the wave to set.
133
+ * @param x - X coordinate of the wave origin
134
+ * @param z - Z coordinate of the wave origin
135
+ */ setOrigin(waveIndex, x, z) {
136
+ if (waveIndex < MAX_NUM_WAVES) {
137
+ this._waveParams[waveIndex * 8 + 4] = x;
138
+ this._waveParams[waveIndex * 8 + 6] = z;
139
+ }
140
+ }
141
+ /** @internal */ randomWave(i) {
142
+ this._waveParams[i * 8 + 0] = Math.random() * Math.PI * 2;
143
+ this._waveParams[i * 8 + 1] = Math.random() * 0.5 + 0.5;
144
+ this._waveParams[i * 8 + 2] = Math.random() * 0.1;
145
+ this._waveParams[i * 8 + 3] = Math.random() * 10;
146
+ this._waveParams[i * 8 + 4] = Math.random() * 100 - 50;
147
+ this._waveParams[i * 8 + 5] = 0;
148
+ this._waveParams[i * 8 + 6] = Math.random() * 100 - 50;
149
+ this._waveParams[i * 8 + 7] = 0;
150
+ }
151
+ /** {@inheritDoc WaveGenerator.update} */ update(timeInSeconds) {
152
+ this._currentTime = timeInSeconds;
153
+ }
154
+ /** {@inheritDoc WaveGenerator.calcClipmapTileAABB} */ calcClipmapTileAABB(minX, maxX, minZ, maxZ, y, outAABB) {
155
+ let maxHeight = 0;
156
+ for(let i = 0; i < this._numWaves; i++){
157
+ const h = this._waveParams[i * 8 + 2];
158
+ if (h > maxHeight) {
159
+ maxHeight = h;
160
+ }
161
+ }
162
+ outAABB.minPoint.setXYZ(minX, y, minZ);
163
+ outAABB.maxPoint.setXYZ(maxX, y + maxHeight, maxZ);
164
+ }
165
+ /** {@inheritDoc WaveGenerator.calcFragmentNormal} */ calcFragmentNormal(scope, xz) {
166
+ const pb = scope.$builder;
167
+ const that = this;
168
+ pb.func('calcFragmentNormal', [
169
+ pb.vec2('xz')
170
+ ], function() {
171
+ this.$l.inPos = pb.vec3(this.xz.x, 0, this.xz.y);
172
+ this.$l.outPos = pb.vec3();
173
+ this.$l.outNormal = pb.vec3();
174
+ that.calcNormalAndPos(this, this.inPos, this.outPos, this.outNormal);
175
+ this.$return(this.outNormal);
176
+ });
177
+ return scope.calcFragmentNormal(xz);
178
+ }
179
+ /** {@inheritDoc WaveGenerator.calcFragmentNormalAndFoam} */ calcFragmentNormalAndFoam(scope, xz) {
180
+ return scope.$builder.vec4(this.calcFragmentNormal(scope, xz), 0);
181
+ }
182
+ /** {@inheritDoc WaveGenerator.setupUniforms} */ setupUniforms(scope) {
183
+ const pb = scope.$builder;
184
+ scope.time = pb.float().uniform(0);
185
+ scope.numWaves = pb.float().uniform(0);
186
+ scope.waveParams = pb.vec4[MAX_NUM_WAVES * 2]().uniform(0);
187
+ }
188
+ /** @internal */ gerstnerWave(scope, waveParam, omniParam, time, inPos, outNormal) {
189
+ const pb = scope.$builder;
190
+ pb.func('gerstnerWave', [
191
+ pb.vec4('waveParam'),
192
+ pb.vec4('omniParam'),
193
+ pb.float('time'),
194
+ pb.vec3('inPos'),
195
+ pb.vec3('outNormal').out()
196
+ ], function() {
197
+ this.$l.amplitude = pb.max(this.waveParam.z, 0.01);
198
+ this.$l.wavelength = this.waveParam.w;
199
+ this.$l.omniPos = this.omniParam.xz;
200
+ this.$l.omni = this.omniParam.w;
201
+ this.$l.direction = pb.vec2(pb.sin(this.waveParam.x), pb.cos(this.waveParam.x));
202
+ this.$l.w = pb.max(0.001, pb.div(Math.PI * 2, this.wavelength));
203
+ this.$l.wSpeed = pb.sqrt(pb.mul(9.8, this.w));
204
+ this.$l.peak = this.waveParam.y;
205
+ this.$l.qi = pb.div(this.peak, pb.mul(this.amplitude, this.w, this.numWaves));
206
+ this.$l.dirWaveInput = pb.mul(this.direction, pb.sub(1, this.omni));
207
+ this.$l.omniWaveInput = pb.mul(pb.sub(this.inPos.xz, this.omniPos), this.omni);
208
+ this.$l.windDir = pb.normalize(pb.add(this.dirWaveInput, this.omniWaveInput));
209
+ this.$l.dir = pb.dot(this.windDir, pb.sub(this.inPos.xz, pb.mul(this.omniPos, this.omni)));
210
+ this.$l.calc = pb.sub(pb.mul(this.dir, this.w), pb.mul(this.wSpeed, this.time));
211
+ this.$l.cosCalc = pb.cos(this.calc);
212
+ this.$l.sinCalc = pb.sin(this.calc);
213
+ this.$l.waveXZ = pb.mul(this.windDir.xy, this.qi, this.amplitude, this.cosCalc);
214
+ this.$l.waveY = pb.div(pb.mul(this.sinCalc, this.amplitude), this.numWaves);
215
+ this.$l.wave = pb.vec3(this.waveXZ.x, this.waveY, this.waveXZ.y);
216
+ this.$l.wa = pb.mul(this.w, this.amplitude);
217
+ this.$l.n = pb.vec3(pb.neg(pb.mul(this.windDir.xy, this.wa, this.cosCalc)), pb.sub(1, pb.mul(this.qi, this.wa, this.sinCalc)));
218
+ this.outNormal = pb.div(this.n.xzy, this.numWaves);
219
+ this.$return(pb.mul(this.wave, pb.clamp(pb.mul(this.amplitude, 10000), 0, 1)));
220
+ });
221
+ return scope.gerstnerWave(waveParam, omniParam, time, inPos, outNormal);
222
+ }
223
+ /** @internal */ calcNormalAndPos(scope, inPos, outPos, outNormal) {
224
+ const pb = scope.$builder;
225
+ const that = this;
226
+ pb.func('calcPositionAndNormal', [
227
+ pb.vec3('inPos'),
228
+ pb.vec3('outPos').out(),
229
+ pb.vec3('outNormal').out()
230
+ ], function() {
231
+ this.outPos = this.inPos;
232
+ this.outNormal = pb.vec3(0);
233
+ this.$for(pb.float('i'), 0, pb.getDevice().type === 'webgl' ? MAX_NUM_WAVES : this.numWaves, function() {
234
+ if (pb.getDevice().type === 'webgl') {
235
+ this.$if(pb.greaterThanEqual(this.i, this.numWaves), function() {
236
+ this.$break();
237
+ });
238
+ }
239
+ this.$l.waveNormal = pb.vec3();
240
+ this.$l.wavePos = that.gerstnerWave(this, this.waveParams.at(pb.mul(this.i, 2)), this.waveParams.at(pb.add(pb.mul(this.i, 2), 1)), this.time, this.inPos, this.waveNormal);
241
+ this.outPos = pb.add(this.outPos, this.wavePos);
242
+ this.outNormal = pb.add(this.outNormal, this.waveNormal);
243
+ });
244
+ });
245
+ scope.calcPositionAndNormal(inPos, outPos, outNormal);
246
+ }
247
+ /** {@inheritDoc WaveGenerator.calcVertexPositionAndNormal} */ calcVertexPositionAndNormal(scope, inPos, outPos, outNormal) {
248
+ this.calcNormalAndPos(scope, inPos, outPos, outNormal);
249
+ }
250
+ /** {@inheritDoc WaveGenerator.applyWaterBindGroup} */ applyWaterBindGroup(bindGroup) {
251
+ bindGroup.setValue('time', this._currentTime);
252
+ bindGroup.setValue('numWaves', this._numWaves);
253
+ bindGroup.setValue('waveParams', this._waveParams);
254
+ }
255
+ /** {@inheritDoc WaveGenerator.isOk} */ isOk() {
256
+ return true;
257
+ }
258
+ /** {@inheritDoc WaveGenerator.getHash} */ getHash(device) {
259
+ return '';
260
+ }
261
+ /** {@inheritDoc WaveGenerator.dispose} */ dispose() {}
262
+ }
263
+
264
+ export { GerstnerWaveGenerator };
265
+ //# sourceMappingURL=gerstner_wavegenerator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"standard.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"gerstner_wavegenerator.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -3,13 +3,14 @@ import '../material/lambert.js';
3
3
  import '../material/blinn.js';
4
4
  import '../material/unlit.js';
5
5
  import '@zephyr3d/device';
6
+ import '../values.js';
7
+ import '../app.js';
6
8
  import '../material/meshmaterial.js';
7
9
  import '../material/grassmaterial.js';
8
10
  import '../material/terrainmaterial.js';
9
11
  import '../material/pbrmr.js';
10
12
  import '../material/pbrsg.js';
11
13
  import '@zephyr3d/base';
12
- import '../app.js';
13
14
 
14
15
  class GlobalBindGroupAllocator {
15
16
  static _layouts = {};
@@ -1 +1 @@
1
- {"version":3,"file":"globalbindgroup_allocator.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"globalbindgroup_allocator.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,273 @@
1
+ import { drawFullscreenQuad } from './fullscreenquad.js';
2
+ import { Application } from '../app.js';
3
+ import '@zephyr3d/base';
4
+ import '@zephyr3d/device';
5
+ import { CopyBlitter } from '../blitter/copy.js';
6
+ import { fetchSampler } from '../utility/misc.js';
7
+
8
+ let hzbProgram = null;
9
+ let hzbBindGroup = null;
10
+ let blitter = null;
11
+ let srcSize = null;
12
+ /*
13
+ vec3 trace_ray(vec3 ray_start, vec3 ray_dir)
14
+ {
15
+
16
+ if (ray_dir.z < 0.0) {
17
+ return vec3(0);
18
+ }
19
+
20
+ ray_dir = normalize(ray_dir);
21
+ ivec2 work_size = SCREEN_SIZE_INT;
22
+
23
+ const int loop_max = 150;
24
+ int mipmap = 0;
25
+ int max_iter = loop_max;
26
+
27
+ vec3 pos = ray_start;
28
+
29
+ // Move pos by a small bias
30
+ pos += ray_dir * 0.008;
31
+
32
+ float hit_bias = 0.0017;
33
+
34
+ while (mipmap > -1 && max_iter --> 0)
35
+ {
36
+
37
+ // Check if we are out of screen bounds, if so, return
38
+ if (pos.x < 0.0 || pos.y < 0.0 || pos.x > 1.0 || pos.y > 1.0 || pos.z < 0.0 || pos.z > 1.0)
39
+ {
40
+ return vec3(0,0,0);
41
+ }
42
+
43
+ // Fetch the current minimum cell plane height
44
+ float cell_z = textureLod(DownscaledDepth, pos.xy, mipmap).x;
45
+
46
+ // Compute the fractional part of the coordinate (scaled by the working size)
47
+ // so the values will be between 0.0 and 1.0
48
+ vec2 fract_coord = mod(pos.xy * work_size, 1.0);
49
+
50
+ // Modify fract coord based on which direction we are stepping in.
51
+ // Fract coord now contains the percentage how far we moved already in
52
+ // the current cell in each direction.
53
+ fract_coord.x = ray_dir.x > 0.0 ? fract_coord.x : 1.0 - fract_coord.x;
54
+ fract_coord.y = ray_dir.y > 0.0 ? fract_coord.y : 1.0 - fract_coord.y;
55
+
56
+ // Compute maximum k and minimum k for which the ray would still be
57
+ // inside of the cell.
58
+ vec2 max_k_v = (1.0 / abs(ray_dir.xy)) / work_size.xy;
59
+ vec2 min_k_v = -max_k_v * fract_coord.xy;
60
+
61
+ // Scale the maximum k by the percentage we already processed in the current cell,
62
+ // since e.g. if we already moved 50%, we can only move another 50%.
63
+ max_k_v *= 1.0 - fract_coord.xy;
64
+
65
+ // The maximum k is the minimum of the both sub-k's since if one component-maximum
66
+ // is reached, the ray is out of the cell
67
+ float max_k = min(max_k_v.x, max_k_v.y);
68
+
69
+ // Same applies to the min_k, but because min_k is negative we have to use max()
70
+ float min_k = max(min_k_v.x, min_k_v.y);
71
+
72
+ // Check if the ray intersects with the cell plane. We have the following
73
+ // equation:
74
+ // pos.z + k * ray_dir.z = cell.z
75
+ // So k is:
76
+ float k = (cell_z - pos.z) / ray_dir.z;
77
+
78
+ // Optional: Abort when ray didn't exactly intersect:
79
+ // if (k < min_k && mipmap <= 0) {
80
+ // return vec3(0);
81
+ // }
82
+
83
+ // Check if we intersected the cell
84
+ if (k < max_k + hit_bias)
85
+ {
86
+ // Clamp k
87
+ k = max(min_k, k);
88
+
89
+ if (mipmap < 1) {
90
+ pos += k * ray_dir;
91
+ return pos;
92
+ }
93
+
94
+ // If we hit anything at a higher mipmap, step up to a higher detailed
95
+ // mipmap:
96
+ mipmap -= 2;
97
+ work_size *= 4;
98
+ } else {
99
+
100
+ // If we hit nothing, move to the next cell, with a small bias
101
+ pos += max_k * ray_dir * 1.04;
102
+ }
103
+
104
+ mipmap += 1;
105
+ work_size /= 2;
106
+ }
107
+
108
+ return vec3(0);
109
+ }
110
+ */ /*
111
+ float2 cell(float2 ray, float2 cell_count, uint camera) {
112
+ return floor(ray.xy * cell_count);
113
+ }
114
+
115
+ float2 cell_count(float level) {
116
+ return input_texture2_size / (level == 0.0 ? 1.0 : exp2(level));
117
+ }
118
+
119
+ float3 intersect_cell_boundary(float3 pos, float3 dir, float2 cell_id, float2 cell_count, float2 cross_step, float2 cross_offset, uint camera) {
120
+ float2 cell_size = 1.0 / cell_count;
121
+ float2 planes = cell_id/cell_count + cell_size * cross_step;
122
+
123
+ float2 solutions = (planes - pos)/dir.xy;
124
+ float3 intersection_pos = pos + dir * min(solutions.x, solutions.y);
125
+
126
+ intersection_pos.xy += (solutions.x < solutions.y) ? float2(cross_offset.x, 0.0) : float2(0.0, cross_offset.y);
127
+
128
+ return intersection_pos;
129
+ }
130
+
131
+ bool crossed_cell_boundary(float2 cell_id_one, float2 cell_id_two) {
132
+ return (int)cell_id_one.x != (int)cell_id_two.x || (int)cell_id_one.y != (int)cell_id_two.y;
133
+ }
134
+
135
+ float minimum_depth_plane(float2 ray, float level, float2 cell_count, uint camera) {
136
+ return input_texture2.Load(int3(vr_stereo_to_mono(ray.xy, camera) * cell_count, level)).r;
137
+ }
138
+
139
+ float3 hi_z_trace(float3 p, float3 v, in uint camera, out uint iterations) {
140
+ float level = HIZ_START_LEVEL;
141
+ float3 v_z = v/v.z;
142
+ float2 hi_z_size = cell_count(level);
143
+ float3 ray = p;
144
+
145
+ float2 cross_step = float2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);
146
+ float2 cross_offset = cross_step * 0.00001;
147
+ cross_step = saturate(cross_step);
148
+
149
+ float2 ray_cell = cell(ray.xy, hi_z_size.xy, camera);
150
+ ray = intersect_cell_boundary(ray, v, ray_cell, hi_z_size, cross_step, cross_offset, camera);
151
+
152
+ iterations = 0;
153
+ while(level >= HIZ_STOP_LEVEL && iterations < MAX_ITERATIONS) {
154
+ // get the cell number of the current ray
155
+ float2 current_cell_count = cell_count(level);
156
+ float2 old_cell_id = cell(ray.xy, current_cell_count, camera);
157
+
158
+ // get the minimum depth plane in which the current ray resides
159
+ float min_z = minimum_depth_plane(ray.xy, level, current_cell_count, camera);
160
+
161
+ // intersect only if ray depth is below the minimum depth plane
162
+ float3 tmp_ray = ray;
163
+ if(v.z > 0) {
164
+ float min_minus_ray = min_z - ray.z;
165
+ tmp_ray = min_minus_ray > 0 ? ray + v_z*min_minus_ray : tmp_ray;
166
+ float2 new_cell_id = cell(tmp_ray.xy, current_cell_count, camera);
167
+ if(crossed_cell_boundary(old_cell_id, new_cell_id)) {
168
+ tmp_ray = intersect_cell_boundary(ray, v, old_cell_id, current_cell_count, cross_step, cross_offset, camera);
169
+ level = min(HIZ_MAX_LEVEL, level + 2.0f);
170
+ }else{
171
+ if(level == 1 && abs(min_minus_ray) > 0.0001) {
172
+ tmp_ray = intersect_cell_boundary(ray, v, old_cell_id, current_cell_count, cross_step, cross_offset, camera);
173
+ level = 2;
174
+ }
175
+ }
176
+ } else if(ray.z < min_z) {
177
+ tmp_ray = intersect_cell_boundary(ray, v, old_cell_id, current_cell_count, cross_step, cross_offset, camera);
178
+ level = min(HIZ_MAX_LEVEL, level + 2.0f);
179
+ }
180
+
181
+ ray.xyz = tmp_ray.xyz;
182
+ --level;
183
+
184
+ ++iterations;
185
+ }
186
+ return ray;
187
+ }
188
+ */ function buildHZBProgram(device) {
189
+ return device.buildRenderProgram({
190
+ label: 'HZBBuilder',
191
+ vertex (pb) {
192
+ this.$inputs.pos = pb.vec2().attrib('position');
193
+ this.$outputs.uv = pb.vec2();
194
+ pb.main(function() {
195
+ this.$builtins.position = pb.vec4(this.$inputs.pos, 1, 1);
196
+ this.$outputs.uv = pb.add(pb.mul(this.$inputs.pos.xy, 0.5), pb.vec2(0.5));
197
+ if (device.type === 'webgpu') {
198
+ this.$builtins.position.y = pb.neg(this.$builtins.position.y);
199
+ }
200
+ });
201
+ },
202
+ fragment (pb) {
203
+ this.$outputs.color = pb.vec4();
204
+ this.srcTex = pb.tex2D().sampleType('unfilterable-float').uniform(0);
205
+ this.srcSize = pb.ivec2().uniform(0);
206
+ if (device.type !== 'webgpu') {
207
+ this.srcMipLevel = pb.int().uniform(0);
208
+ }
209
+ pb.main(function() {
210
+ this.$l.coord = pb.mul(pb.ivec2(this.$builtins.fragCoord.xy), 2);
211
+ this.$l.minCoord = pb.ivec2(0, 0);
212
+ this.$l.maxCoord = pb.sub(this.srcSize, pb.ivec2(1, 1));
213
+ for(let i = 0; i < 4; i++){
214
+ this.$l[`d${i}`] = pb.textureLoad(this.srcTex, pb.clamp(pb.add(this.coord, pb.ivec2(i >> 1, i & 1)), this.minCoord, this.maxCoord), device.type === 'webgpu' ? 0 : this.srcMipLevel).r;
215
+ }
216
+ this.$l.d = pb.min(pb.min(this.d0, this.d1), pb.min(this.d2, this.d3));
217
+ this.$outputs.color = pb.vec4(this.d, 0, 0, 1);
218
+ });
219
+ }
220
+ });
221
+ }
222
+ function buildHiZLevel(device, miplevel, srcTexture, dstTexture) {
223
+ const sampler = fetchSampler('clamp_nearest');
224
+ const framebuffer = device.pool.fetchTemporalFramebuffer(false, 0, 0, [
225
+ dstTexture
226
+ ], null, false, 1, true, miplevel + 1);
227
+ framebuffer.setColorAttachmentGenerateMipmaps(0, false);
228
+ srcSize[0] = Math.max(srcTexture.width >> miplevel, 1);
229
+ srcSize[1] = Math.max(srcTexture.height >> miplevel, 1);
230
+ hzbBindGroup.setValue('srcSize', srcSize);
231
+ if (device.type === 'webgpu') {
232
+ hzbBindGroup.setTextureView('srcTex', srcTexture, miplevel, 0, 1, sampler);
233
+ } else {
234
+ hzbBindGroup.setTexture('srcTex', srcTexture, sampler);
235
+ hzbBindGroup.setValue('srcMipLevel', miplevel);
236
+ }
237
+ device.setProgram(hzbProgram);
238
+ device.setBindGroup(0, hzbBindGroup);
239
+ device.setFramebuffer(framebuffer);
240
+ drawFullscreenQuad();
241
+ if (srcTexture !== dstTexture) {
242
+ device.copyFramebufferToTexture2D(framebuffer, 0, srcTexture, miplevel + 1);
243
+ }
244
+ device.pool.releaseFrameBuffer(framebuffer);
245
+ }
246
+ function buildHiZ(sourceTex, HiZFrameBuffer) {
247
+ const device = Application.instance.device;
248
+ if (!hzbProgram) {
249
+ hzbProgram = buildHZBProgram(device);
250
+ hzbBindGroup = device.createBindGroup(hzbProgram.bindGroupLayouts[0]);
251
+ blitter = new CopyBlitter();
252
+ srcSize = new Int32Array(2);
253
+ }
254
+ blitter.blit(sourceTex, HiZFrameBuffer, fetchSampler('clamp_nearest'));
255
+ device.pushDeviceStates();
256
+ const srcTex = HiZFrameBuffer.getColorAttachments()[0];
257
+ if (device.type === 'webgpu') {
258
+ for(let i = 0; i < srcTex.mipLevelCount - 1; i++){
259
+ buildHiZLevel(device, i, srcTex, srcTex);
260
+ }
261
+ } else {
262
+ const tmpFramebuffer = device.pool.fetchTemporalFramebuffer(false, HiZFrameBuffer.getWidth(), HiZFrameBuffer.getHeight(), HiZFrameBuffer.getColorAttachments()[0].format, null, true);
263
+ const dstTex = tmpFramebuffer.getColorAttachments()[0];
264
+ for(let i = 0; i < srcTex.mipLevelCount - 1; i++){
265
+ buildHiZLevel(device, i, srcTex, dstTex);
266
+ }
267
+ device.pool.releaseFrameBuffer(tmpFramebuffer);
268
+ }
269
+ device.popDeviceStates();
270
+ }
271
+
272
+ export { buildHiZ };
273
+ //# sourceMappingURL=hzb.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"terrainlightmodel.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"hzb.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}