@woosh/meep-engine 2.48.19 → 2.48.21

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 (117) hide show
  1. package/package.json +1 -1
  2. package/src/core/binary/type/BinaryDataType.d.ts +15 -0
  3. package/src/{engine/graphics/render/forward_plus/data/computeDataType.js → core/binary/type/computeBinaryDataTypeByPrecision.js} +3 -3
  4. package/src/core/geom/2d/quad-tree/qt_query_data_nearest_to_point.js +62 -0
  5. package/src/core/graph/layout/computeDisconnectedSubGraphs.js +1 -0
  6. package/src/core/process/task/TaskGroup.js +1 -1
  7. package/src/core/process/task/util/task_tree_compute_leaf_tasks.js +21 -0
  8. package/src/engine/graphics/geometry/AttributeSpec.d.ts +2 -2
  9. package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +1 -3
  10. package/src/engine/graphics/render/forward_plus/LightManager.js +9 -7
  11. package/src/engine/graphics/{micron/render/instanced → texture}/AttributeDataTexture.js +28 -19
  12. package/src/engine/graphics/{render/forward_plus/data → texture}/TextureBackedMemoryRegion.js +8 -8
  13. package/src/engine/graphics/{render/forward_plus/data → texture}/computeThreeTextureFormat.js +2 -2
  14. package/src/engine/graphics/{render/forward_plus/data → texture}/computeThreeTextureInternalFormatFromDataType.js +1 -1
  15. package/src/engine/graphics/{render/forward_plus/data → texture}/computeThreeTextureTypeFromDataType.js +1 -1
  16. package/src/engine/graphics/texture/sampler/Sampler2D2Canvas.js +1 -1
  17. package/src/engine/graphics/texture/sampler/sampler2DToFloat32Texture.js +1 -3
  18. package/src/generation/GridTaskGroup.js +4 -4
  19. package/src/generation/filtering/numeric/util/populateSampler2DFromCellFilter.js +10 -2
  20. package/src/generation/filtering/numeric/util/sampler_from_filter.js +26 -0
  21. package/src/generation/filtering/numeric/util/visualise_filters_as_grid.js +81 -0
  22. package/src/generation/grid/generation/GridTaskSequence.js +3 -1
  23. package/src/engine/graphics/micron/MICRON_GEOMETRY_FIELD.js +0 -1
  24. package/src/engine/graphics/micron/MICRON_URI_FIELD.js +0 -1
  25. package/src/engine/graphics/micron/build/MICRON_PATCH_SIZE_MAX.js +0 -5
  26. package/src/engine/graphics/micron/build/PatchRepresentation.js +0 -424
  27. package/src/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +0 -311
  28. package/src/engine/graphics/micron/build/build_geometry_info.js +0 -21
  29. package/src/engine/graphics/micron/build/clustering/assignInitialPatchNeighbours.js +0 -63
  30. package/src/engine/graphics/micron/build/clustering/assign_patch_neighbours_from_topology.js +0 -46
  31. package/src/engine/graphics/micron/build/clustering/build_clustering_2.js +0 -37
  32. package/src/engine/graphics/micron/build/clustering/build_leaf_patches.js +0 -326
  33. package/src/engine/graphics/micron/build/clustering/build_leaf_patches_metis.js +0 -76
  34. package/src/engine/graphics/micron/build/clustering/computeBorderLengthChange.js +0 -59
  35. package/src/engine/graphics/micron/build/clustering/computeFaceCurvatureScore.js +0 -57
  36. package/src/engine/graphics/micron/build/clustering/computeOpenFaceFreedom.js +0 -35
  37. package/src/engine/graphics/micron/build/clustering/compute_face_connection_weight.js +0 -35
  38. package/src/engine/graphics/micron/build/clustering/populateOpenFaceNeighboursForPatch.js +0 -56
  39. package/src/engine/graphics/micron/build/clustering/validate_leaf_patch_connectivity.js +0 -44
  40. package/src/engine/graphics/micron/build/compute_micron_buffer_array_constructor.js +0 -24
  41. package/src/engine/graphics/micron/build/compute_vertex_remap_cost.js +0 -29
  42. package/src/engine/graphics/micron/build/debug/build_clustering_info.js +0 -58
  43. package/src/engine/graphics/micron/build/debug/build_graph_info.js +0 -59
  44. package/src/engine/graphics/micron/build/fill_patch_geometry_data.js +0 -270
  45. package/src/engine/graphics/micron/build/hierarchy/buildAbstractPatchHierarchy.js +0 -196
  46. package/src/engine/graphics/micron/build/hierarchy/build_intermediate_patch_topology.js +0 -162
  47. package/src/engine/graphics/micron/build/hierarchy/build_merge_graph.js +0 -89
  48. package/src/engine/graphics/micron/build/hierarchy/computePatchMergeScore.js +0 -146
  49. package/src/engine/graphics/micron/build/hierarchy/compute_patches_shared_vertex_count.js +0 -32
  50. package/src/engine/graphics/micron/build/hierarchy/compute_patches_shared_vertices.js +0 -34
  51. package/src/engine/graphics/micron/build/hierarchy/merge_patches.js +0 -581
  52. package/src/engine/graphics/micron/build/hierarchy/metis_cluster_clusters.js +0 -53
  53. package/src/engine/graphics/micron/build/hierarchy/optimize_graph_partitioning_balance.js +0 -515
  54. package/src/engine/graphics/micron/build/hierarchy/patch_combine.js +0 -180
  55. package/src/engine/graphics/micron/build/hierarchy/patch_fill_holes_by_uncollapse.js +0 -60
  56. package/src/engine/graphics/micron/build/hierarchy/patch_stitch_parent_border.js +0 -320
  57. package/src/engine/graphics/micron/build/hierarchy/qvdr_build_simplified_clusters.js +0 -547
  58. package/src/engine/graphics/micron/build/hierarchy/qvdr_build_tree.js +0 -140
  59. package/src/engine/graphics/micron/buildPatchwork.js +0 -68
  60. package/src/engine/graphics/micron/convert_three_object_to_micron.js +0 -179
  61. package/src/engine/graphics/micron/debug/VirtualGeometryStats.js +0 -42
  62. package/src/engine/graphics/micron/format/MICRON_GEOMETRY_PROPERTY_NAME.js +0 -1
  63. package/src/engine/graphics/micron/format/MicronGeometry.d.ts +0 -21
  64. package/src/engine/graphics/micron/format/MicronGeometry.js +0 -334
  65. package/src/engine/graphics/micron/format/MicronGeometryPatch.d.ts +0 -3
  66. package/src/engine/graphics/micron/format/MicronGeometryPatch.js +0 -205
  67. package/src/engine/graphics/micron/format/MicronGeometryPatchOccurance.js +0 -50
  68. package/src/engine/graphics/micron/format/ThreeMicronMesh.d.ts +0 -10
  69. package/src/engine/graphics/micron/format/ThreeMicronMesh.js +0 -45
  70. package/src/engine/graphics/micron/format/VirtualGeometry.js +0 -158
  71. package/src/engine/graphics/micron/format/micron_build_proxy_geometry.js +0 -205
  72. package/src/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.js +0 -123
  73. package/src/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.spec.js +0 -63
  74. package/src/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.js +0 -83
  75. package/src/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.spec.js +0 -51
  76. package/src/engine/graphics/micron/format/serialization/deserialize_attribute_spec.js +0 -25
  77. package/src/engine/graphics/micron/format/serialization/deserialize_patch.js +0 -106
  78. package/src/engine/graphics/micron/format/serialization/serialize_attribute_spec.js +0 -18
  79. package/src/engine/graphics/micron/format/serialization/serialize_patch.js +0 -84
  80. package/src/engine/graphics/micron/format/validate_patch_bounds.js +0 -69
  81. package/src/engine/graphics/micron/plugin/GLTFAssetTransformer.js +0 -265
  82. package/src/engine/graphics/micron/plugin/GLTF_MICRON_ID_FIELD.js +0 -5
  83. package/src/engine/graphics/micron/plugin/MicronRenderPlugin.d.ts +0 -8
  84. package/src/engine/graphics/micron/plugin/MicronRenderPlugin.js +0 -150
  85. package/src/engine/graphics/micron/plugin/serialization/BufferGeometrySerializationAdapter.js +0 -176
  86. package/src/engine/graphics/micron/plugin/shaded_geometry/MicronShadedGeometryRenderAdapter.js +0 -216
  87. package/src/engine/graphics/micron/prototypeMicronProxyBuild.js +0 -227
  88. package/src/engine/graphics/micron/prototypeVirtualGeometry.js +0 -911
  89. package/src/engine/graphics/micron/render/PatchCacheKey.js +0 -79
  90. package/src/engine/graphics/micron/render/VIRTUAL_MESH_FLAG.d.ts +0 -1
  91. package/src/engine/graphics/micron/render/VIRTUAL_MESH_FLAG.js +0 -1
  92. package/src/engine/graphics/micron/render/VirtualGeometryBuilder.js +0 -207
  93. package/src/engine/graphics/micron/render/approximateTriangleArea.js +0 -25
  94. package/src/engine/graphics/micron/render/culling/PatchCullingSystem.js +0 -129
  95. package/src/engine/graphics/micron/render/instanced/PatchDataTextures.js +0 -325
  96. package/src/engine/graphics/micron/render/instanced/ThreeInstancedAdapter.js +0 -175
  97. package/src/engine/graphics/micron/render/instanced/shader/constants.js +0 -3
  98. package/src/engine/graphics/micron/render/instanced/shader/gen_micron_vertex_attribute_texture_name.js +0 -8
  99. package/src/engine/graphics/micron/render/instanced/shader/shader_rewrite_standard.js +0 -250
  100. package/src/engine/graphics/micron/render/makeThreeMeshFromVirtualGeometry.js +0 -37
  101. package/src/engine/graphics/micron/render/refinement/ActivePatchFlags.js +0 -8
  102. package/src/engine/graphics/micron/render/refinement/ActivePatchList.js +0 -241
  103. package/src/engine/graphics/micron/render/refinement/ActivePatchRecord.js +0 -154
  104. package/src/engine/graphics/micron/render/refinement/RefinementSpec.js +0 -84
  105. package/src/engine/graphics/micron/render/refinement/get_geometry_patch_cut.js +0 -133
  106. package/src/engine/graphics/micron/render/refinement/is_patch_facing_back.js +0 -43
  107. package/src/engine/graphics/micron/render/refinement/is_patch_visible.js +0 -37
  108. package/src/engine/graphics/micron/render/v1/MaterialContext.js +0 -150
  109. package/src/engine/graphics/micron/render/v1/MaterialVertexSpec.js +0 -115
  110. package/src/engine/graphics/micron/render/v1/MicronRenderContext.js +0 -145
  111. package/src/engine/graphics/micron/render/v1/ThreeVirtualGeometryAdapter.js +0 -255
  112. package/src/engine/graphics/micron/render/v1/VGThreeRenderer.js +0 -142
  113. package/src/engine/graphics/micron/render/v1/getTransformedPositionsCached.js +0 -54
  114. package/src/engine/graphics/micron/simplifyGeometry.js +0 -26
  115. package/src/engine/graphics/micron/util/patchToBufferGeometry.js +0 -19
  116. /package/src/{engine/graphics/render/forward_plus/data → core/math}/NumericType.js +0 -0
  117. /package/src/engine/graphics/{render/forward_plus/data → texture}/channelCountToThreIntegerTextureType.js +0 -0
@@ -1,325 +0,0 @@
1
- import { assert } from "../../../../../core/assert.js";
2
- import { BitSet } from "../../../../../core/binary/BitSet.js";
3
- import { AttributeDataTexture } from "./AttributeDataTexture.js";
4
- import { max3 } from "../../../../../core/math/max3.js";
5
- import { gen_micron_vertex_attribute_texture_name } from "./shader/gen_micron_vertex_attribute_texture_name.js";
6
- import { min2 } from "../../../../../core/math/min2.js";
7
-
8
- /**
9
- *
10
- * @type {number}
11
- */
12
- const ALLOCATION_GROW_STEP = 16;
13
-
14
- /**
15
- *
16
- * @type {number}
17
- */
18
- const ALLOCATION_GROW_FACTOR = 1.2;
19
-
20
- /**
21
- *
22
- * @type {number}
23
- */
24
- const MAX_TEXTURE_SIZE = 16384;
25
-
26
- export class PatchDataTextures {
27
- /**
28
- *
29
- * @param {VertexDataSpec} spec
30
- * @param {number} [column_count]
31
- */
32
- constructor(spec, column_count = 2) {
33
- assert.defined(spec, 'spec');
34
- assert.isNonNegativeInteger(column_count, 'column_count');
35
-
36
- /**
37
- *
38
- * @type {VertexDataSpec}
39
- * @private
40
- */
41
- this.__spec = spec;
42
-
43
- /**
44
- *
45
- * @type {AttributeDataTexture[]}
46
- * @private
47
- */
48
- this.__attributes = [];
49
-
50
- /**
51
- *
52
- * @type {Map<MicronGeometryPatch, number>}
53
- * @private
54
- */
55
- this.__residence = new Map();
56
-
57
- this.__occupied_slots = new BitSet();
58
-
59
- this.__capacity = 0;
60
-
61
- /**
62
- *
63
- * @type {number}
64
- * @private
65
- */
66
- this.__column_count = column_count;
67
-
68
- // initialize attributes
69
- const attributes = this.__attributes;
70
- const attribute_count = spec.attributes.length;
71
-
72
- for (let i = 0; i < attribute_count; i++) {
73
- attributes[i] = new AttributeDataTexture(spec.attributes[i], this.__column_count);
74
- }
75
-
76
- }
77
-
78
- /**
79
- *
80
- * @returns {VertexDataSpec}
81
- */
82
- get spec() {
83
- return this.__spec;
84
- }
85
-
86
- /**
87
- *
88
- * @returns {number}
89
- */
90
- get column_count() {
91
- return this.__column_count;
92
- }
93
-
94
- /**
95
- * Clear all data
96
- */
97
- clear() {
98
- this.__residence.clear();
99
- this.__occupied_slots.reset();
100
-
101
- const attributes = this.__attributes;
102
- const attribute_count = attributes.length;
103
- for (let i = 0; i < attribute_count; i++) {
104
- const attribute = attributes[i];
105
-
106
- attribute.clear();
107
- }
108
- }
109
-
110
- estimateByteSize() {
111
- let result = 0;
112
-
113
- const attributes = this.__attributes;
114
- const attribute_count = attributes.length;
115
- for (let i = 0; i < attribute_count; i++) {
116
- const attribute = attributes[i];
117
-
118
- result += attribute.estimateByteSize();
119
- }
120
-
121
- return result;
122
- }
123
-
124
- /**
125
- *
126
- * @param {number} n
127
- */
128
- set capacity(n) {
129
- // console.log(`#PatchDataTextures.capacity = ${n}`); // DEBUG
130
-
131
- const attributes = this.__attributes;
132
- const attribute_count = attributes.length;
133
- for (let i = 0; i < attribute_count; i++) {
134
- const attribute = attributes[i];
135
-
136
- attribute.resize(n);
137
- }
138
-
139
- this.__capacity = n;
140
- }
141
-
142
- /**
143
- *
144
- * @param {number} index
145
- */
146
- zero_fill_slot(index) {
147
- const attributes = this.__attributes;
148
- const attribute_count = attributes.length;
149
- for (let i = 0; i < attribute_count; i++) {
150
- const attribute = attributes[i];
151
-
152
- attribute.zero_fill_slot(index);
153
- }
154
- }
155
-
156
- /**
157
- *
158
- * @param {MicronGeometryPatch} patch
159
- * @return {boolean}
160
- */
161
- release(patch) {
162
- const address = this.__residence.get(patch);
163
-
164
- if (address !== undefined) {
165
- this.__residence.delete(patch);
166
- this.__occupied_slots.clear(address);
167
-
168
- // zero-fill slot
169
- this.zero_fill_slot(address);
170
-
171
- return true;
172
- } else {
173
- return false;
174
- }
175
- }
176
-
177
- /**
178
- *
179
- * @param {number} address
180
- * @param {MicronGeometryPatch} patch
181
- */
182
- bind(address, patch) {
183
- // console.log(`#PatchDataTextures.bind(${address}, ${patch.id})`); // DEBUG
184
-
185
- this.__residence.set(patch, address);
186
- this.__occupied_slots.set(address, true);
187
- }
188
-
189
- /**
190
- *
191
- * @param {number} address
192
- * @param {MicronGeometryPatch} patch
193
- */
194
- write_data(address, patch) {
195
- // console.log(`#PatchDataTextures.write_data(${address}, ${patch.id})`); // DEBUG
196
-
197
- const indices = patch.face_indices;
198
-
199
- const attribute_arrays = patch.vertex_attribute_arrays;
200
-
201
- const attribute_textures = this.__attributes;
202
- const attribute_count = attribute_arrays.length;
203
-
204
- for (let i = 0; i < attribute_count; i++) {
205
- const attribute_source = attribute_arrays[i];
206
-
207
- const attribute_texture = attribute_textures[i];
208
-
209
- attribute_texture.write_slot_from_indexed(address, indices, attribute_source);
210
- }
211
- }
212
-
213
- /**
214
- *
215
- * @param {number} address
216
- * @param {MicronGeometryPatch} patch
217
- * @returns {boolean}
218
- */
219
- is_slot_data_equal(address, patch) {
220
- const indices = patch.face_indices;
221
-
222
- const attribute_arrays = patch.vertex_attribute_arrays;
223
-
224
- const attribute_textures = this.__attributes;
225
- const attribute_count = attribute_arrays.length;
226
-
227
- for (let i = 0; i < attribute_count; i++) {
228
- const attribute_source = attribute_arrays[i];
229
-
230
- const attribute_texture = attribute_textures[i];
231
-
232
- const equal = attribute_texture.is_slot_data_equal(address, indices, attribute_source);
233
-
234
- if (!equal) {
235
- return false;
236
- }
237
- }
238
-
239
- return true;
240
- }
241
-
242
- /**
243
- *
244
- * @param {number} capacity
245
- */
246
- ensureCapacity(capacity) {
247
- const existing_capacity = this.__capacity;
248
-
249
- if (capacity > existing_capacity) {
250
- let next_capacity = max3(
251
- existing_capacity + ALLOCATION_GROW_STEP,
252
- Math.ceil(existing_capacity * ALLOCATION_GROW_FACTOR),
253
- capacity + 1
254
- );
255
-
256
- // Clamp to maximum texture size
257
- next_capacity = min2(next_capacity, MAX_TEXTURE_SIZE * this.__column_count);
258
-
259
- if (next_capacity < capacity) {
260
- throw new Error(`Maximum texture size exceeded`);
261
- }
262
-
263
- this.capacity = next_capacity;
264
- }
265
- }
266
-
267
- validate_contents() {
268
- for (const [patch, address] of this.__residence) {
269
- if (!this.is_slot_data_equal(address, patch)) {
270
- return false;
271
- }
272
- }
273
-
274
- return true;
275
- }
276
-
277
-
278
- /**
279
- *
280
- * @param {MicronGeometryPatch} patch
281
- * @returns {number}
282
- */
283
- ensure(patch) {
284
-
285
- const existing_address = this.__residence.get(patch);
286
-
287
- if (existing_address !== undefined) {
288
- return existing_address;
289
- }
290
-
291
- // write
292
- const address = this.__occupied_slots.nextClearBit(0);
293
-
294
- this.ensureCapacity(address + 1);
295
-
296
- this.bind(address, patch);
297
- this.write_data(address, patch);
298
-
299
- return address;
300
- }
301
-
302
- genUniforms() {
303
- const result = {};
304
-
305
-
306
- const attributes = this.__attributes;
307
- const attribute_count = attributes.length;
308
-
309
- for (let i = 0; i < attribute_count; i++) {
310
- const attribute = attributes[i];
311
-
312
- const spec = attribute.spec;
313
-
314
- const uniform_name = gen_micron_vertex_attribute_texture_name(spec.name);
315
-
316
- result[uniform_name] = {
317
- type: 't',
318
- value: attribute.texture
319
- };
320
- }
321
-
322
- return result;
323
- }
324
-
325
- }
@@ -1,175 +0,0 @@
1
- import { PatchDataTextures } from "./PatchDataTextures.js";
2
- import {
3
- BufferAttribute,
4
- InstancedBufferAttribute,
5
- InstancedBufferGeometry,
6
- StaticReadUsage,
7
- StreamDrawUsage
8
- } from "three";
9
- import { MICRON_PATCH_SIZE_MAX } from "../../build/MICRON_PATCH_SIZE_MAX.js";
10
- import Signal from "../../../../../core/events/signal/Signal.js";
11
- import { ATTRIBUTE_NAME_ADDRESS, ATTRIBUTE_NAME_TRANSFORM } from "./shader/constants.js";
12
- import { shader_rewrite_standard } from "./shader/shader_rewrite_standard.js";
13
-
14
- export class ThreeInstancedAdapter {
15
- /**
16
- *
17
- * @param {VertexDataSpec} spec
18
- */
19
- constructor(spec) {
20
- /**
21
- *
22
- * @type {InstancedBufferGeometry|null}
23
- * @private
24
- */
25
- this.__buffer_geometry = null;
26
-
27
- // build non-indexed geometry for a patch
28
-
29
- this.__capacity = -1;
30
-
31
- this.__spec = spec;
32
-
33
-
34
- /**
35
- * 10 columns come from 4096 texture resolution, that seems to be maximum widely supported resolution.
36
- * Here's the math: 4096/ (3*128) = 10.6666
37
- * @type {PatchDataTextures}
38
- * @private
39
- */
40
- this.__patch_data = new PatchDataTextures(spec, 10);
41
-
42
-
43
- this.__uniforms = Object.assign({}, this.__patch_data.genUniforms());
44
-
45
- /**
46
- *
47
- * @type {Signal}
48
- */
49
- this.onRebuild = new Signal();
50
- }
51
-
52
- /**
53
- *
54
- * @param {{vertexShader,fragmentShader,uniforms:Object<IUniform>}} shader
55
- */
56
- rewriteMaterial(shader) {
57
- shader_rewrite_standard(shader, this.__uniforms, this.__spec, this.__patch_data.column_count);
58
- }
59
-
60
- __build_geometry() {
61
- if (this.__buffer_geometry !== null) {
62
- this.__buffer_geometry.dispose();
63
- }
64
-
65
- this.__buffer_geometry = new InstancedBufferGeometry();
66
-
67
-
68
- // build non-indexed geometry for a patch
69
- const geo = this.__buffer_geometry;
70
-
71
- const position_buffer = new BufferAttribute(new Uint8Array(MICRON_PATCH_SIZE_MAX * 3 * 3), 3, false);
72
-
73
-
74
- position_buffer.setUsage(StaticReadUsage);
75
-
76
- geo.setAttribute('position', position_buffer);
77
- // geo.setAttribute('normal', new BufferAttribute(new Uint8Array(MICRON_PATCH_SIZE_MAX * 3 * 3), 3, false));
78
-
79
- // instance attributes
80
- const capacity = this.__capacity;
81
-
82
- const transform_buffer = new InstancedBufferAttribute(new Float32Array(capacity * 16), 16, false);
83
- // const transform_buffer = new InstancedInterleavedBuffer(this.__attribute__transform, 16);
84
- transform_buffer.setUsage(StreamDrawUsage);
85
-
86
- geo.setAttribute(ATTRIBUTE_NAME_TRANSFORM, transform_buffer);
87
-
88
-
89
- const ia_patch_ref = new InstancedBufferAttribute(new Uint16Array(capacity), 1, false);
90
- ia_patch_ref.setUsage(StreamDrawUsage);
91
-
92
- geo.setAttribute(ATTRIBUTE_NAME_ADDRESS, ia_patch_ref);
93
-
94
- // signal
95
- this.onRebuild.send0();
96
- }
97
-
98
- /**
99
- *
100
- * @param {number} target
101
- * @private
102
- */
103
- __resize_capacity(target) {
104
- this.__capacity = target;
105
- this.__build_geometry();
106
- }
107
-
108
- /**
109
- *
110
- * @param {number} v
111
- * @private
112
- */
113
- __prepare_capacity(v) {
114
- if (this.__capacity < v) {
115
- this.__resize_capacity(v);
116
- }
117
-
118
- const geometry = this.__buffer_geometry;
119
-
120
- if (geometry.instanceCount !== v) {
121
- geometry.instanceCount = v;
122
- }
123
- }
124
-
125
-
126
- /**
127
- *
128
- * @param {Uint32Array} patches
129
- * @param {number} patch_count
130
- * @param {VirtualGeometry} virtual_geometry
131
- */
132
- build(patches, patch_count, virtual_geometry) {
133
- this.__prepare_capacity(patch_count);
134
-
135
- const geo = this.__buffer_geometry;
136
-
137
- const patch_transform_attribute = geo.attributes[ATTRIBUTE_NAME_TRANSFORM];
138
- /**
139
- *
140
- * @type {Float32Array}
141
- */
142
- const patch_transform_array = patch_transform_attribute.array;
143
-
144
- patch_transform_attribute.needsUpdate = true;
145
-
146
- const patch_address_attribute = geo.attributes[ATTRIBUTE_NAME_ADDRESS];
147
- const patch_address_array = patch_address_attribute.array;
148
-
149
- patch_address_attribute.needsUpdate = true;
150
-
151
- const patch_data = this.__patch_data;
152
- const transforms = virtual_geometry.lookup_instance_transforms;
153
- const geometries = virtual_geometry.loolup_geometries;
154
-
155
- for (let i = 0; i < patch_count; i++) {
156
- const i3 = i * 3;
157
-
158
- const instance_id = patches[i3];
159
- const geometry_id = patches[i3 + 1];
160
- const patch_id = patches[i3 + 2];
161
-
162
- const transform = transforms[instance_id];
163
- const micron_geometry = geometries[geometry_id];
164
- const patch = micron_geometry.patches[patch_id];
165
-
166
- const i16 = i * 16;
167
-
168
- patch_transform_array.set(transform, i16);
169
-
170
- const patch_slot_id = patch_data.ensure(patch);
171
-
172
- patch_address_array[i] = patch_slot_id;
173
- }
174
- }
175
- }
@@ -1,3 +0,0 @@
1
- export const ATTRIBUTE_NAME_TRANSFORM = 'micron_patch_transform';
2
- export const ATTRIBUTE_NAME_ADDRESS = 'micron_patch_address';
3
- export const ATTRIBUTE_INSTANCE_ID = 'micron_instance_id';
@@ -1,8 +0,0 @@
1
- /**
2
- *
3
- * @param {string} attribute_name
4
- * @return {string}
5
- */
6
- export function gen_micron_vertex_attribute_texture_name(attribute_name) {
7
- return `micron_patch_data_vertex_attribute_${attribute_name}`;
8
- }