@woosh/meep-engine 2.33.23 → 2.33.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/bvh2/BinaryNode.js +1 -1
- package/core/bvh2/aabb3/AABB3.js +18 -0
- package/core/bvh2/aabb3/AABB3Math.js +1 -1
- package/core/bvh2/binary/2/BinaryUint32BVH.js +498 -0
- package/core/bvh2/binary/2/BinaryUint32BVH.spec.js +54 -0
- package/core/bvh2/binary/IndexedBinaryBVH.js +22 -26
- package/core/collection/ArrayUtils.js +1 -1
- package/core/collection/array/arrayQuickSort.js +9 -6
- package/core/collection/array/array_swap.js +22 -0
- package/core/collection/array/computeHashArray.js +22 -0
- package/core/collection/array/computeHashIntegerArray.js +15 -0
- package/core/collection/table/DataType2TypedArrayConstructorMapping.js +15 -0
- package/core/color/Color.js +2 -1
- package/core/function/FunctionCompiler.js +2 -1
- package/core/geom/3d/aabb/aabb3_computeDistanceAbovePlane.js +9 -33
- package/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +1 -1
- package/core/geom/3d/line/line3_computeSegmentPointDistance_sqr.js +41 -0
- package/core/geom/3d/morton/mortonEncode_magicbits.js +2 -1
- package/core/geom/3d/morton/reinterpret_float32_as_int32.js +13 -0
- package/core/geom/3d/morton/v3_morton_encode_transformed.js +33 -0
- package/core/geom/3d/ray/ray_computeNearestPointToPoint.js +37 -0
- package/core/geom/3d/shape/AbstractShape3D.js +29 -0
- package/core/geom/3d/shape/CompositeShape.js +60 -0
- package/core/geom/3d/shape/TransformedShape3D.js +70 -0
- package/core/geom/3d/shape/UnitCubeShape3D.js +13 -0
- package/core/geom/3d/shape/UnitSphereShape3D.js +16 -0
- package/core/geom/AABB2.js +1 -1
- package/core/geom/ConicRay.js +3 -1
- package/core/geom/LineSegment.js +0 -78
- package/core/geom/Matrix4.js +7 -8
- package/core/geom/Rectangle.js +2 -1
- package/core/geom/Vector1.js +1 -1
- package/core/geom/Vector3.js +2 -1
- package/core/geom/Vector4.js +2 -1
- package/core/geom/random/randomPointInBox.js +7 -3
- package/core/geom/random/randomPointInPoint.js +6 -3
- package/core/geom/random/randomPointInSphere.js +6 -3
- package/core/geom/random/randomPointOnBox.js +7 -3
- package/core/geom/random/randomPointOnSphere.js +6 -3
- package/core/geom/v3_length.js +8 -3
- package/core/graph/graph_k_means_cluster.js +1 -1
- package/core/math/MathUtils.js +0 -354
- package/core/math/MathUtils.spec.js +7 -1
- package/core/math/gaussian.js +9 -0
- package/core/math/hash/computeHashFloat.js +17 -0
- package/core/math/hash/computeHashFloatArray.js +34 -0
- package/core/math/hash/computeObjectHash.js +54 -0
- package/core/math/intersects1D.js +19 -0
- package/core/math/interval/NumericInterval.js +2 -2
- package/core/math/isValueBetween.js +10 -0
- package/core/math/isValueBetweenInclusive.js +10 -0
- package/core/math/noise/curl_noise_3dt.js +1 -1
- package/core/math/noise/sdnoise.js +10 -10
- package/core/math/overlap1D.js +19 -0
- package/core/math/pingpong.js +17 -0
- package/core/math/random/makeRangedRandom.js +19 -0
- package/core/math/random/randomFloatBetween.js +14 -0
- package/core/math/random/randomFromArray.js +19 -0
- package/core/math/random/randomGaussian.js +15 -0
- package/core/math/random/randomIntegerBetween.js +14 -0
- package/core/math/random/roundFair.js +15 -0
- package/core/math/separation1D.js +21 -0
- package/core/math/solveQuadratic.js +25 -0
- package/core/model/BoundedValue.js +1 -1
- package/core/model/node-graph/node/NodeInstancePortReference.js +1 -1
- package/core/model/node-graph/node/Port.js +1 -1
- package/core/model/reactive/evaluation/MultiPredicateEvaluator.spec.js +3 -1
- package/core/model/reactive/model/ReactiveBinaryExpression.js +1 -1
- package/core/model/reactive/model/terminal/ReactiveLiteralNumber.js +1 -1
- package/core/model/reactive/model/terminal/ReactiveReference.js +1 -1
- package/core/model/reactive/model/util/createRandomReactiveExpression.js +1 -1
- package/core/model/stat/LinearModifier.js +1 -1
- package/engine/animation/curve/AnimationCurve.js +72 -0
- package/engine/animation/curve/Keyframe.js +27 -0
- package/engine/animation/keyed2/AnimationTrack.js +27 -3
- package/engine/asset/Asset.js +1 -1
- package/engine/asset/loaders/GLTFAssetLoader.d.ts +1 -1
- package/engine/asset/loaders/GLTFAssetLoader.js +10 -0
- package/engine/asset/loaders/image/ImageRGBADataAsset.js +8 -1
- package/engine/asset/loaders/material/computeMaterialHash.js +3 -1
- package/engine/asset/loaders/material/computeTextureHash.js +2 -1
- package/engine/ecs/animation/Animation.js +2 -1
- package/engine/ecs/animation/InverseKinematics.js +2 -1
- package/engine/ecs/dynamic_actions/DynamicActorSystem.js +2 -1
- package/engine/ecs/dynamic_actions/DynamicRuleDescriptionTable.spec.js +3 -5
- package/engine/ecs/dynamic_actions/actions/definition/WeightedRandomActionDescription.js +1 -1
- package/engine/ecs/evaluation/complex/PointFitnessGaussianBlur.js +1 -1
- package/engine/ecs/foliage/ecs/Foliage2.js +1 -1
- package/engine/ecs/fow/shader/FogOfWarRenderer.js +1 -1
- package/engine/ecs/gui/GUIElement.js +1 -1
- package/engine/ecs/gui/hud/HeadsUpDisplay.js +1 -1
- package/engine/ecs/gui/position/ViewportPosition.js +2 -1
- package/engine/ecs/systems/RangedAttackSystem.js +1 -1
- package/engine/ecs/systems/SteeringSystem.js +1 -1
- package/engine/ecs/terrain/tiles/TerrainTileManager.js +1 -1
- package/engine/ecs/tooltip/TooltipComponent.js +15 -0
- package/engine/graphics/ecs/animation/animator/AnimationClip.js +2 -1
- package/engine/graphics/ecs/animation/animator/AnimationClipDefinition.js +2 -1
- package/engine/graphics/ecs/animation/animator/AnimationNotification.js +2 -1
- package/engine/graphics/ecs/animation/animator/AnimationNotificationDefinition.js +2 -1
- package/engine/graphics/ecs/animation/animator/graph/AnimationGraph.js +2 -1
- package/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.js +2 -1
- package/engine/graphics/ecs/animation/animator/graph/definition/AnimationStateDefinition.js +1 -1
- package/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.js +2 -1
- package/engine/graphics/ecs/camera/CameraClippingPlaneComputer.js +1 -1
- package/engine/graphics/ecs/highlight/HighlightDefinition.js +2 -1
- package/engine/graphics/ecs/light/Light.d.ts +1 -1
- package/engine/graphics/ecs/light/Light.js +3 -0
- package/engine/graphics/ecs/mesh/Mesh.js +2 -1
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts +13 -0
- package/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts +6 -0
- package/engine/graphics/geometry/AttributeSpec.js +105 -0
- package/engine/graphics/{micron/format/MicronVertexDataSpec.js → geometry/VertexDataSpec.js} +56 -25
- package/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +7 -7
- package/engine/graphics/micron/build/fill_patch_geometry_data.js +1 -1
- package/engine/graphics/micron/buildPatchwork.js +1 -1
- package/engine/graphics/micron/format/MicronGeometry.js +3 -3
- package/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.js +2 -2
- package/engine/graphics/micron/format/serialization/deserialize_attribute_spec.js +1 -1
- package/engine/graphics/micron/format/serialization/serialize_attribute_spec.js +1 -1
- package/engine/graphics/micron/render/PatchCacheKey.js +1 -1
- package/engine/graphics/micron/render/instanced/AttributeDataTexture.js +5 -5
- package/engine/graphics/micron/render/v1/ThreeVirtualGeometryAdapter.js +1 -1
- package/engine/graphics/particles/particular/engine/emitter/PARTICULAR_PARTICLE_SPECIFICATION.js +80 -16
- package/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +57 -52
- package/engine/graphics/particles/particular/engine/emitter/ParticleLayer.js +2 -1
- package/engine/graphics/particles/particular/engine/emitter/ParticlePool.js +51 -12
- package/engine/graphics/particles/particular/engine/emitter/ParticlePool.spec.js +3 -2
- package/engine/graphics/particles/particular/engine/emitter/computeEmissionFunction.js +1 -1
- package/engine/graphics/particles/particular/engine/emitter/serde/ParameterLookupTableSerializationAdapter.js +8 -2
- package/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.js +2 -1
- package/engine/graphics/particles/particular/engine/parameter/ParameterTrack.js +1 -1
- package/engine/graphics/particles/particular/engine/parameter/ParticleParameter.js +1 -1
- package/engine/graphics/particles/particular/engine/renderers/billboard/BILLBOARD_PARTICLE_SPECIFICATION.js +21 -0
- package/engine/graphics/particles/particular/engine/renderers/billboard/ParticleBillboardMaterial.js +0 -20
- package/engine/graphics/particles/particular/engine/renderers/billboard/prototypeBillboardRenderer.js +9 -9
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepApplyForce.js +2 -5
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseAcceleration.js +2 -6
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseVelocity.js +2 -7
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepFixedPhysics.js +2 -5
- package/engine/graphics/particles/particular/engine/simulator/update_parameters.js +1 -1
- package/engine/graphics/particles/particular/engine/utils/distributeParticlesOnObject3D.js +1 -1
- package/engine/graphics/particles/particular/engine/utils/distrubuteParticlesOnMesh.js +1 -1
- package/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.js +384 -0
- package/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +558 -0
- package/engine/graphics/particles/particular/group/Operation.js +18 -0
- package/engine/graphics/particles/particular/group/OperationType.js +9 -0
- package/engine/graphics/particles/particular/group/ParticleAttribute.js +2 -1
- package/engine/graphics/particles/particular/group/ParticleAttributeType.js +11 -0
- package/engine/graphics/particles/particular/group/ParticleDataType.js +10 -0
- package/engine/graphics/particles/particular/group/ParticleGroup.js +7 -245
- package/engine/graphics/particles/particular/group/ParticleGroup.spec.js +3 -1
- package/engine/graphics/particles/particular/group/ParticleSpecification.js +21 -14
- package/engine/graphics/particles/particular/group/itemSizeFromAttributeType.js +20 -0
- package/engine/graphics/particles/particular/group/optimizeCommandQueue.js +162 -0
- package/engine/graphics/particles/particular/group/typedArrayConstructorFromDataType.js +19 -0
- package/engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js +1 -1
- package/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameter.js +2 -1
- package/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameterSet.js +1 -1
- package/engine/graphics/render/forward_plus/LightManager.js +117 -94
- package/engine/graphics/render/forward_plus/PointLight.js +9 -0
- package/engine/graphics/render/forward_plus/PointLightData.js +1 -1
- package/engine/graphics/render/forward_plus/SpotLight.js +9 -0
- package/engine/graphics/render/forward_plus/cluster/compute_light_data_hash_0.js +2 -2
- package/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.js +1 -1
- package/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +5 -5
- package/engine/graphics/render/forward_plus/prototypeLightManager.js +180 -86
- package/engine/graphics/render/forward_plus/query/analytical_triplanar_corner_mapping.js +8 -0
- package/engine/graphics/render/forward_plus/query/cube_mapping.js +38 -0
- package/engine/graphics/render/forward_plus/query/detailed_sphere_frustum_intersection_test.js +86 -0
- package/engine/graphics/render/forward_plus/query/point_light_inside_volume.js +73 -0
- package/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_objects.js +131 -0
- package/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_texture.js +129 -0
- package/engine/graphics/render/forward_plus/query/spot_light_inside_volume.js +33 -0
- package/engine/graphics/render/forward_plus/read_frustum_corner.js +14 -0
- package/engine/graphics/render/forward_plus/testClusterEquality.js +22 -0
- package/engine/graphics/render/visibility/IncrementalDeltaSet.js +11 -0
- package/engine/graphics/render/visibility/hiz/prototypeHiZ.js +1 -1
- package/engine/graphics/texture/sampler/HarmonicDiffusionGrid.spec.js +1 -1
- package/engine/graphics/texture/sampler/SampleTraverser.js +1 -1
- package/engine/graphics/texture/sampler/distanceField.spec.js +1 -1
- package/engine/grid/components/GridObstacle.js +1 -1
- package/engine/intelligence/behavior/selector/WeightedElement.js +2 -1
- package/engine/intelligence/optimization/RandomOptimizer.js +1 -1
- package/engine/navigation/ecs/components/Path.js +1 -1
- package/engine/navigation/grid/FastBinaryHeap.spec.js +1 -1
- package/engine/sound/ecs/emitter/SoundEmitter.js +2 -1
- package/engine/sound/ecs/emitter/SoundTrack.js +2 -1
- package/engine/sound/material/concrete/RandomSoundMaterial.js +1 -1
- package/engine/ui/notification/notificationGenerator.js +1 -1
- package/generation/filtering/numeric/complex/CellFilterGaussianBlur.js +1 -1
- package/generation/grid/generation/GridTaskExecuteRuleTimes.js +2 -1
- package/generation/markers/actions/MarkerNodeActionSelectRandom.js +1 -1
- package/generation/markers/transform/MarkerNodeTransformerRecordUniqueRandomEnum.js +1 -1
- package/generation/placement/action/random/CellActionSelectRandom.js +1 -1
- package/generation/theme/ThemeEngine.js +1 -1
- package/misc/makeMaterialIconCached.js +2 -2
- package/package.json +1 -1
- package/view/elements/image/HTMLElementCacheKey.js +2 -1
- package/view/elements/radial/RadialText.js +2 -1
- package/view/minimap/gl/MinimapMarkersGL.js +6 -100
- package/view/minimap/gl/buildMaterial.js +94 -0
- package/engine/graphics/micron/format/MicronGeometryBufferAttributeSpec.js +0 -71
- package/engine/graphics/render/forward_plus/queryBVH_Frustum.js +0 -357
|
@@ -6,8 +6,13 @@ import { min2 } from "../../math/min2.js";
|
|
|
6
6
|
import { IndexedBinaryBVHVisitor } from "./IndexedBinaryBVHVisitor.js";
|
|
7
7
|
import { NodeType } from "./NodeType.js";
|
|
8
8
|
import { RayLeafIntersectionVisitor } from "./RayLeafIntersectionVisitor.js";
|
|
9
|
+
import { array_copy } from "../../collection/array/copyArray.js";
|
|
9
10
|
|
|
10
11
|
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @type {Float32Array|number[]}
|
|
15
|
+
*/
|
|
11
16
|
const scratch_aabb_0 = new Float32Array(6);
|
|
12
17
|
|
|
13
18
|
|
|
@@ -30,16 +35,16 @@ export default class IndexedBinaryBVH {
|
|
|
30
35
|
this.binaryNodeCount = 0;
|
|
31
36
|
|
|
32
37
|
/**
|
|
33
|
-
*
|
|
38
|
+
* Total number of boxes contained in the tree, some might be unused
|
|
34
39
|
* @type {number}
|
|
35
40
|
*/
|
|
36
41
|
this.boxCount = 0;
|
|
37
42
|
|
|
38
43
|
/**
|
|
39
44
|
*
|
|
40
|
-
* @type {
|
|
45
|
+
* @type {Float32Array|number[]}
|
|
41
46
|
*/
|
|
42
|
-
this.data =
|
|
47
|
+
this.data = new Float32Array(16);
|
|
43
48
|
}
|
|
44
49
|
|
|
45
50
|
/**
|
|
@@ -59,7 +64,14 @@ export default class IndexedBinaryBVH {
|
|
|
59
64
|
|
|
60
65
|
this.boxCount = this.leafNodeCount + this.binaryNodeCount;
|
|
61
66
|
|
|
62
|
-
|
|
67
|
+
// possibly resize the storage
|
|
68
|
+
const storage_size = this.boxCount * 6;
|
|
69
|
+
|
|
70
|
+
if (this.data.length < storage_size) {
|
|
71
|
+
this.data = new Float32Array(storage_size);
|
|
72
|
+
} else {
|
|
73
|
+
this.data.fill(0);
|
|
74
|
+
}
|
|
63
75
|
}
|
|
64
76
|
|
|
65
77
|
unsortedBuiltIntermediate() {
|
|
@@ -117,7 +129,7 @@ export default class IndexedBinaryBVH {
|
|
|
117
129
|
}
|
|
118
130
|
|
|
119
131
|
//set bounds of the bvh
|
|
120
|
-
|
|
132
|
+
array_copy(data, 0, scratch_aabb_0, 0, 6);
|
|
121
133
|
|
|
122
134
|
this.x0 = scratch_aabb_0[0];
|
|
123
135
|
this.y0 = scratch_aabb_0[1];
|
|
@@ -238,7 +250,7 @@ export default class IndexedBinaryBVH {
|
|
|
238
250
|
}
|
|
239
251
|
|
|
240
252
|
/**
|
|
241
|
-
*
|
|
253
|
+
* @deprecated use a visitor object instead
|
|
242
254
|
* @param {number} startX
|
|
243
255
|
* @param {number} startY
|
|
244
256
|
* @param {number} startZ
|
|
@@ -265,22 +277,6 @@ export default class IndexedBinaryBVH {
|
|
|
265
277
|
}
|
|
266
278
|
}
|
|
267
279
|
|
|
268
|
-
/**
|
|
269
|
-
*
|
|
270
|
-
* @param {number} source_offset
|
|
271
|
-
* @param {number[]|Float32Array} source
|
|
272
|
-
* @param {number[]|Float32Array} destination
|
|
273
|
-
* @param {number} destination_offset
|
|
274
|
-
*/
|
|
275
|
-
function copy_box_array(source_offset, source, destination, destination_offset) {
|
|
276
|
-
destination[destination_offset] = source[source_offset];
|
|
277
|
-
destination[destination_offset + 1] = source[source_offset + 1];
|
|
278
|
-
destination[destination_offset + 2] = source[source_offset + 2];
|
|
279
|
-
destination[destination_offset + 3] = source[source_offset + 3];
|
|
280
|
-
destination[destination_offset + 4] = source[source_offset + 4];
|
|
281
|
-
destination[destination_offset + 5] = source[source_offset + 5];
|
|
282
|
-
}
|
|
283
|
-
|
|
284
280
|
/**
|
|
285
281
|
*
|
|
286
282
|
* @param {number[]|Float32Array} source
|
|
@@ -348,23 +344,23 @@ function writeBox(array, address, x0, y0, z0, x1, y1, z1) {
|
|
|
348
344
|
* @param {Float32Array} array
|
|
349
345
|
*/
|
|
350
346
|
function copyBox(from, to, array) {
|
|
351
|
-
|
|
347
|
+
array_copy(data, from, scratch_aabb_0, to, 6);
|
|
352
348
|
}
|
|
353
349
|
|
|
354
350
|
/**
|
|
355
351
|
*
|
|
356
352
|
* @param {number} from
|
|
357
353
|
* @param {number} to
|
|
358
|
-
* @param {Float32Array} array
|
|
354
|
+
* @param {Float32Array|number[]} array
|
|
359
355
|
*/
|
|
360
356
|
function copyBoxZeroSize(from, to, array) {
|
|
361
|
-
|
|
357
|
+
array_copy(array, from, scratch_aabb_0, 0, 3);
|
|
362
358
|
|
|
363
359
|
scratch_aabb_0[3] = scratch_aabb_0[0];
|
|
364
360
|
scratch_aabb_0[4] = scratch_aabb_0[1];
|
|
365
361
|
scratch_aabb_0[5] = scratch_aabb_0[2];
|
|
366
362
|
|
|
367
|
-
|
|
363
|
+
array_copy(scratch_aabb_0, 0, array, to, 6);
|
|
368
364
|
}
|
|
369
365
|
|
|
370
366
|
/**
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { assert } from "../assert.js";
|
|
8
8
|
import { returnZero } from "../function/Functions.js";
|
|
9
|
-
import { randomIntegerBetween } from "../math/MathUtils.js";
|
|
10
9
|
import { min2 } from "../math/min2.js";
|
|
11
10
|
import { HashMap } from "./HashMap.js";
|
|
11
|
+
import { randomIntegerBetween } from "../math/random/randomIntegerBetween.js";
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -5,11 +5,14 @@ const stack = [];
|
|
|
5
5
|
/**
|
|
6
6
|
* @template T
|
|
7
7
|
* @param {T[]} data
|
|
8
|
-
* @param {function(T):number}
|
|
8
|
+
* @param {function(T):number} score_function
|
|
9
|
+
* @param {*} score_function_context
|
|
9
10
|
* @param {number} start
|
|
10
11
|
* @param {number} end
|
|
12
|
+
* @param {function(T[],number, number):*} [swap_operator]
|
|
13
|
+
* @param {*} [swap_context]
|
|
11
14
|
*/
|
|
12
|
-
export function arrayQuickSort(data,
|
|
15
|
+
export function arrayQuickSort(data, score_function, score_function_context, start, end, swap_operator = arraySwapElements, swap_context = undefined) {
|
|
13
16
|
if (start >= end) {
|
|
14
17
|
// section of 0 size, nothing to sort
|
|
15
18
|
return;
|
|
@@ -32,15 +35,15 @@ export function arrayQuickSort(data, keyExtractor, start, end) {
|
|
|
32
35
|
|
|
33
36
|
const pivotIndex = (left + right) >> 1;
|
|
34
37
|
|
|
35
|
-
const pivot =
|
|
38
|
+
const pivot = score_function.call(score_function_context,data[pivotIndex]);
|
|
36
39
|
|
|
37
40
|
/* partition */
|
|
38
41
|
while (i <= j) {
|
|
39
|
-
while (
|
|
42
|
+
while (score_function.call(score_function_context,data[i]) < pivot) {
|
|
40
43
|
i++;
|
|
41
44
|
}
|
|
42
45
|
|
|
43
|
-
while (
|
|
46
|
+
while (score_function.call(score_function_context,data[j]) > pivot) {
|
|
44
47
|
j--;
|
|
45
48
|
}
|
|
46
49
|
|
|
@@ -48,7 +51,7 @@ export function arrayQuickSort(data, keyExtractor, start, end) {
|
|
|
48
51
|
|
|
49
52
|
if (i !== j) {
|
|
50
53
|
//do swap
|
|
51
|
-
|
|
54
|
+
swap_operator.call(swap_context, data, i, j);
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
i++;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {T[]|ArrayLike<T>|TypedArray|Uint8ClampedArray|Uint8Array} a
|
|
4
|
+
* @param {number} a_offset
|
|
5
|
+
* @param {T[]|ArrayLike<T>|TypedArray|Uint8ClampedArray|Uint8Array} b
|
|
6
|
+
* @param {number} b_offset
|
|
7
|
+
* @param {number} length How many elements should be moved
|
|
8
|
+
*/
|
|
9
|
+
export function array_swap(a, a_offset, b, b_offset, length) {
|
|
10
|
+
|
|
11
|
+
let i, j, k;
|
|
12
|
+
|
|
13
|
+
for (k = 0; k < length; k++) {
|
|
14
|
+
i = a_offset + k;
|
|
15
|
+
j = b_offset + k;
|
|
16
|
+
|
|
17
|
+
const t = b[j];
|
|
18
|
+
|
|
19
|
+
b[j] = a[i];
|
|
20
|
+
a[i] = t;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @template T
|
|
3
|
+
* @param {T[]} array
|
|
4
|
+
* @param {function(T):number} elementHashFunction
|
|
5
|
+
*/
|
|
6
|
+
export function computeHashArray(array, elementHashFunction) {
|
|
7
|
+
|
|
8
|
+
const numArguments = array.length;
|
|
9
|
+
let hash = numArguments;
|
|
10
|
+
|
|
11
|
+
for (let i = 0; i < numArguments; i++) {
|
|
12
|
+
|
|
13
|
+
const singleValue = array[i];
|
|
14
|
+
|
|
15
|
+
const elementHash = elementHashFunction(singleValue);
|
|
16
|
+
|
|
17
|
+
hash = ((hash << 5) - hash) + elementHash;
|
|
18
|
+
hash |= 0; // Convert to 32bit integer
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return hash;
|
|
22
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Computes hash on integer values
|
|
3
|
+
* @param {...number} value
|
|
4
|
+
* @returns {number}
|
|
5
|
+
*/
|
|
6
|
+
export function computeHashIntegerArray(value) {
|
|
7
|
+
let hash = 0;
|
|
8
|
+
const numArguments = arguments.length;
|
|
9
|
+
for (let i = 0; i < numArguments; i++) {
|
|
10
|
+
const singleValue = arguments[i];
|
|
11
|
+
hash = ((hash << 5) - hash) + singleValue;
|
|
12
|
+
hash |= 0; // Convert to 32bit integer
|
|
13
|
+
}
|
|
14
|
+
return hash;
|
|
15
|
+
}
|
|
@@ -16,4 +16,19 @@ export const DataType2TypedArrayConstructorMapping = {
|
|
|
16
16
|
[DataType.Float16]: Uint16Array,
|
|
17
17
|
[DataType.Float32]: Float32Array,
|
|
18
18
|
[DataType.Float64]: Float64Array,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param {DataType} dt
|
|
24
|
+
* @returns {constructor|function}
|
|
25
|
+
*/
|
|
26
|
+
export function compute_typed_array_constructor_from_data_type(dt) {
|
|
27
|
+
const r = DataType2TypedArrayConstructorMapping[dt];
|
|
28
|
+
|
|
29
|
+
if (r === undefined) {
|
|
30
|
+
throw new Error(`Unsupported data type '${dt}'`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return r;
|
|
19
34
|
}
|
package/core/color/Color.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { assert } from "../assert.js";
|
|
2
2
|
import Signal from "../events/signal/Signal.js";
|
|
3
|
-
import { computeHashFloat, computeHashIntegerArray } from "../math/MathUtils.js";
|
|
4
3
|
import { parseColor, rgb2hsv } from "./ColorUtils.js";
|
|
5
4
|
import { clamp } from "../math/clamp.js";
|
|
6
5
|
import { min2 } from "../math/min2.js";
|
|
7
6
|
import { max2 } from "../math/max2.js";
|
|
8
7
|
import { min3 } from "../math/min3.js";
|
|
8
|
+
import { computeHashIntegerArray } from "../collection/array/computeHashIntegerArray.js";
|
|
9
|
+
import { computeHashFloat } from "../math/hash/computeHashFloat.js";
|
|
9
10
|
|
|
10
11
|
class Color {
|
|
11
12
|
/**
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { assert } from "../assert.js";
|
|
2
2
|
import { Cache } from "../cache/Cache.js";
|
|
3
3
|
import { isArrayEqualStrict } from "../collection/array/isArrayEqualStrict.js";
|
|
4
|
-
import { computeHashArray, computeHashIntegerArray } from "../math/MathUtils.js";
|
|
5
4
|
import { invokeObjectEquals } from "../model/object/invokeObjectEquals.js";
|
|
6
5
|
import { invokeObjectHash } from "../model/object/invokeObjectHash.js";
|
|
7
6
|
import { computeStringHash } from "../primitives/strings/computeStringHash.js";
|
|
8
7
|
import { computeUTF8StringByteSize } from "../primitives/strings/StringUtils.js";
|
|
8
|
+
import { computeHashArray } from "../collection/array/computeHashArray.js";
|
|
9
|
+
import { computeHashIntegerArray } from "../collection/array/computeHashIntegerArray.js";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Hash is an integer value, so this is an invalid value for a computed hash
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { computePointDistanceToPlane } from "../../Plane.js";
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* @param {number} plane_normal_x
|
|
5
3
|
* @param {number} plane_normal_y
|
|
@@ -14,38 +12,16 @@ import { computePointDistanceToPlane } from "../../Plane.js";
|
|
|
14
12
|
* @returns {number}
|
|
15
13
|
*/
|
|
16
14
|
export function aabb3_computeDistanceAbovePlane(
|
|
17
|
-
plane_normal_x,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
plane_constant,
|
|
21
|
-
_x0,
|
|
22
|
-
_y0,
|
|
23
|
-
_z0,
|
|
24
|
-
_x1,
|
|
25
|
-
_y1,
|
|
26
|
-
_z1
|
|
15
|
+
plane_normal_x, plane_normal_y, plane_normal_z, plane_constant,
|
|
16
|
+
_x0, _y0, _z0,
|
|
17
|
+
_x1, _y1, _z1
|
|
27
18
|
) {
|
|
28
19
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
px = _x1;
|
|
34
|
-
} else {
|
|
35
|
-
px = _x0;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (plane_normal_y > 0) {
|
|
39
|
-
py = _y1;
|
|
40
|
-
} else {
|
|
41
|
-
py = _y0;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (plane_normal_z > 0) {
|
|
45
|
-
pz = _z1;
|
|
46
|
-
} else {
|
|
47
|
-
pz = _z0;
|
|
48
|
-
}
|
|
20
|
+
// pick a corner point furthest along the plane normal
|
|
21
|
+
const px = plane_normal_x > 0 ? _x1 : _x0;
|
|
22
|
+
const py = plane_normal_y > 0 ? _y1 : _y0;
|
|
23
|
+
const pz = plane_normal_z > 0 ? _z1 : _z0;
|
|
49
24
|
|
|
50
|
-
|
|
25
|
+
// dot(v4,v4) inlined for speed
|
|
26
|
+
return (plane_normal_x * px + plane_normal_y * py + plane_normal_z * pz) + plane_constant;
|
|
51
27
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ray_computeNearestPointToPoint } from "../../LineSegment.js";
|
|
2
1
|
import { computePlanePlaneIntersection, computePointDistanceToPlane } from "../../Plane.js";
|
|
3
2
|
import Vector3 from "../../Vector3.js";
|
|
4
3
|
import { plane3_projectPoint } from "../plane/plane3_projectPoint.js";
|
|
5
4
|
import { plane_three_computeConvex3PlaneIntersection } from "../plane/plane_computeConvex3PlaneIntersection.js";
|
|
5
|
+
import { ray_computeNearestPointToPoint } from "../ray/ray_computeNearestPointToPoint.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { clamp } from "../../../math/clamp.js";
|
|
2
|
+
import { v3_distance_sqr } from "../../v3_distance_sqr.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Computes shortest distance between a line segment(defined by 2 points) and a point
|
|
6
|
+
* @param {number} x0
|
|
7
|
+
* @param {number} y0
|
|
8
|
+
* @param {number} z0
|
|
9
|
+
* @param {number} x1
|
|
10
|
+
* @param {number} y1
|
|
11
|
+
* @param {number} z1
|
|
12
|
+
* @param {number} px
|
|
13
|
+
* @param {number} py
|
|
14
|
+
* @param {number} pz
|
|
15
|
+
*/
|
|
16
|
+
export function line3_computeSegmentPointDistance_sqr(x0, y0, z0, x1, y1, z1, px, py, pz) {
|
|
17
|
+
// get line delta
|
|
18
|
+
const line_delta_x = x1 - x0;
|
|
19
|
+
const line_delta_y = y1 - y0;
|
|
20
|
+
const line_delta_z = z1 - z0;
|
|
21
|
+
|
|
22
|
+
// find closest point
|
|
23
|
+
const sp0_x = px - x0;
|
|
24
|
+
const sp0_y = py - y0;
|
|
25
|
+
const sp0_z = pz - z0;
|
|
26
|
+
|
|
27
|
+
//
|
|
28
|
+
const d2 = line_delta_x * line_delta_x + line_delta_y * line_delta_y + line_delta_z * line_delta_z;
|
|
29
|
+
|
|
30
|
+
const d3 = line_delta_x * sp0_x + line_delta_y * sp0_y + line_delta_z * sp0_z;
|
|
31
|
+
|
|
32
|
+
const t = clamp(d3 / d2, 0, 1);
|
|
33
|
+
|
|
34
|
+
// compute point on the line
|
|
35
|
+
const lp_x = line_delta_x * t + x0;
|
|
36
|
+
const lp_y = line_delta_y * t + y0;
|
|
37
|
+
const lp_z = line_delta_z * t + z0;
|
|
38
|
+
|
|
39
|
+
// compute distance from the point in question to the point on the line
|
|
40
|
+
return v3_distance_sqr(px, py, pz, lp_x, lp_y, lp_z);
|
|
41
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* method to separate bits from a given integer 3 positions apart
|
|
3
|
+
* we only look at the first 10 bits
|
|
3
4
|
* @param {number} a
|
|
4
5
|
* @returns {number}
|
|
5
6
|
*/
|
|
6
7
|
function splitBy3(a) {
|
|
7
|
-
let x = a
|
|
8
|
+
let x = a;
|
|
8
9
|
x = (x | x << 16) & 0x30000ff;
|
|
9
10
|
x = (x | x << 8) & 0x0300f00f;
|
|
10
11
|
x = (x | x << 4) & 0x30c30c3;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const b = new ArrayBuffer(4);
|
|
2
|
+
const b_f32 = new Float32Array(b);
|
|
3
|
+
const b_i32 = new Int32Array(b);
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param {number} value
|
|
8
|
+
* @returns {number}
|
|
9
|
+
*/
|
|
10
|
+
export function reinterpret_float32_as_int32(value) {
|
|
11
|
+
b_f32[0] = value;
|
|
12
|
+
return b_i32[0];
|
|
13
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { mortonEncode_magicbits } from "./mortonEncode_magicbits.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Assumes that coordinates will be mapped to -1..1 range after transform
|
|
5
|
+
* @param {number} x
|
|
6
|
+
* @param {number} y
|
|
7
|
+
* @param {number} z
|
|
8
|
+
* @param {number[]} matrix matrix to transform supplied coordinates to Normalized Device Coordinates
|
|
9
|
+
* @returns {number}
|
|
10
|
+
*/
|
|
11
|
+
export function v3_morton_encode_transformed(x, y, z, matrix) {
|
|
12
|
+
|
|
13
|
+
// apply matrix transform
|
|
14
|
+
const _x = matrix[0] * x + matrix[4] * y + matrix[8] * z + matrix[12];
|
|
15
|
+
const _y = matrix[1] * x + matrix[5] * y + matrix[9] * z + matrix[13];
|
|
16
|
+
const _z = matrix[2] * x + matrix[6] * y + matrix[10] * z + matrix[14];
|
|
17
|
+
const _w = matrix[3] * x + matrix[7] * y + matrix[11] * z + matrix[15];
|
|
18
|
+
|
|
19
|
+
const d = 1 / _w;
|
|
20
|
+
|
|
21
|
+
// apply perspective divide, values are now in Normalized Coordinate system (-1,1)
|
|
22
|
+
const px = _x * d;
|
|
23
|
+
const py = _y * d;
|
|
24
|
+
const pz = _z * d;
|
|
25
|
+
|
|
26
|
+
// scale each value up to 10 bits (for 10 bits, the multiplier = 1024. As we have -1,1 range, we do (v+1)/2. 1024/2 = 512)
|
|
27
|
+
|
|
28
|
+
const cx = ((px + 1) * 512) | 0;
|
|
29
|
+
const cy = ((py + 1) * 512) | 0;
|
|
30
|
+
const cz = ((pz + 1) * 512) | 0;
|
|
31
|
+
|
|
32
|
+
return mortonEncode_magicbits(cx, cy, cz);
|
|
33
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { v3_dot } from "../../v3_dot.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {Vector3} result
|
|
6
|
+
* @param {number} origin_x
|
|
7
|
+
* @param {number} origin_y
|
|
8
|
+
* @param {number} origin_z
|
|
9
|
+
* @param {number} direction_x
|
|
10
|
+
* @param {number} direction_y
|
|
11
|
+
* @param {number} direction_z
|
|
12
|
+
* @param {number} px
|
|
13
|
+
* @param {number} py
|
|
14
|
+
* @param {number} pz
|
|
15
|
+
* @returns {number} distance from origin, negative means that the point lies behind the origin in the direction opposite to the ray's own
|
|
16
|
+
*/
|
|
17
|
+
export function ray_computeNearestPointToPoint(result, origin_x, origin_y, origin_z, direction_x, direction_y, direction_z, px, py, pz) {
|
|
18
|
+
// find closest point
|
|
19
|
+
const sp0_x = px - origin_x;
|
|
20
|
+
const sp0_y = py - origin_y;
|
|
21
|
+
const sp0_z = pz - origin_z;
|
|
22
|
+
|
|
23
|
+
//
|
|
24
|
+
const d2 = v3_dot(direction_x, direction_y, direction_z, direction_x, direction_y, direction_z);
|
|
25
|
+
const d3 = v3_dot(direction_x, direction_y, direction_z, sp0_x, sp0_y, sp0_z);
|
|
26
|
+
|
|
27
|
+
const t = d3 / d2;
|
|
28
|
+
|
|
29
|
+
// compute point on the ray
|
|
30
|
+
const lp_x = direction_x * t + origin_x;
|
|
31
|
+
const lp_y = direction_y * t + origin_y;
|
|
32
|
+
const lp_z = direction_z * t + origin_z;
|
|
33
|
+
|
|
34
|
+
result.set(lp_x, lp_y, lp_z);
|
|
35
|
+
|
|
36
|
+
return t;
|
|
37
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export class AbstractShape3D {
|
|
2
|
+
constructor() {
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param {number[]} result
|
|
8
|
+
* @param {number} result_offset
|
|
9
|
+
* @param {function} random
|
|
10
|
+
*/
|
|
11
|
+
sample_random_point_in_volume(result, result_offset, random) {
|
|
12
|
+
throw new Error('Not Implemented');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Total volume of the shape
|
|
17
|
+
* @returns {number}
|
|
18
|
+
*/
|
|
19
|
+
get volume() {
|
|
20
|
+
throw new Error('Not Implemented');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @returns {number}
|
|
25
|
+
*/
|
|
26
|
+
get surface_area() {
|
|
27
|
+
throw new Error('Not Implemented');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { AbstractShape3D } from "./AbstractShape3D.js";
|
|
2
|
+
import { weightedRandomFromArray } from "../../../collection/array/weightedRandomFromArray.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const scratch_array = [];
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {AbstractShape3D} shape
|
|
10
|
+
* @return {number}
|
|
11
|
+
*/
|
|
12
|
+
function getVolume(shape) {
|
|
13
|
+
return shape.volume;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class CompositeShape extends AbstractShape3D {
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @type {AbstractShape3D[]}
|
|
23
|
+
*/
|
|
24
|
+
this.children = [];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
get volume() {
|
|
28
|
+
let r = 0;
|
|
29
|
+
|
|
30
|
+
const children = this.children;
|
|
31
|
+
const child_count = children.length;
|
|
32
|
+
for (let i = 0; i < child_count; i++) {
|
|
33
|
+
const child = children[i];
|
|
34
|
+
|
|
35
|
+
r += child.volume;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return r;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
get surface_area(){
|
|
42
|
+
let r = 0;
|
|
43
|
+
|
|
44
|
+
const children = this.children;
|
|
45
|
+
const child_count = children.length;
|
|
46
|
+
for (let i = 0; i < child_count; i++) {
|
|
47
|
+
const child = children[i];
|
|
48
|
+
|
|
49
|
+
r += child.surface_area;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return r;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
sample_random_point_in_volume(result, result_offset, random) {
|
|
56
|
+
const child = weightedRandomFromArray(this.children, random, getVolume);
|
|
57
|
+
|
|
58
|
+
return child.sample_random_point_in_volume(result, result_offset, random);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { mat4, vec3 } from "gl-matrix";
|
|
2
|
+
import { AbstractShape3D } from "./AbstractShape3D.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @type {number[]|Float32Array|vec3}
|
|
7
|
+
*/
|
|
8
|
+
const scratch_v3 = [];
|
|
9
|
+
|
|
10
|
+
export class TransformedShape3D extends AbstractShape3D {
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @type {number[]|Float32Array|mat4}
|
|
17
|
+
* @private
|
|
18
|
+
*/
|
|
19
|
+
this.__matrix = new Float32Array(16);
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @type {AbstractShape3D|null}
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
25
|
+
this.__subject = null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param {number[]|Float32Array} m4
|
|
31
|
+
* @param {AbstractShape3D} subject
|
|
32
|
+
* @returns {TransformedShape3D}
|
|
33
|
+
*/
|
|
34
|
+
static from_m4(subject, m4) {
|
|
35
|
+
const r = new TransformedShape3D();
|
|
36
|
+
|
|
37
|
+
r.__subject = subject;
|
|
38
|
+
r.__matrix = m4;
|
|
39
|
+
|
|
40
|
+
return r;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @param {number[]|Float32Array} m
|
|
46
|
+
*/
|
|
47
|
+
set transform(m) {
|
|
48
|
+
this.__matrix.set(m);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
get volume() {
|
|
52
|
+
mat4.getScaling(scratch_v3, this.__matrix);
|
|
53
|
+
|
|
54
|
+
const scale_modifier = scratch_v3[0] * scratch_v3[1] * scratch_v3[2];
|
|
55
|
+
|
|
56
|
+
return this.__subject.volume * scale_modifier;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
sample_random_point_in_volume(result, result_offset, random) {
|
|
60
|
+
this.__subject.sample_random_point_in_volume(scratch_v3, 0, random);
|
|
61
|
+
|
|
62
|
+
// apply transform
|
|
63
|
+
vec3.transformMat4(scratch_v3, scratch_v3, this.__matrix);
|
|
64
|
+
|
|
65
|
+
// write out
|
|
66
|
+
result[0] = scratch_v3[0];
|
|
67
|
+
result[1] = scratch_v3[1];
|
|
68
|
+
result[2] = scratch_v3[2];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AbstractShape3D } from "./AbstractShape3D.js";
|
|
2
|
+
import { randomPointInBox } from "../../random/randomPointInBox.js";
|
|
3
|
+
|
|
4
|
+
export class UnitCubeShape3D extends AbstractShape3D {
|
|
5
|
+
|
|
6
|
+
get volume() {
|
|
7
|
+
return 1;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
sample_random_point_in_volume(result, result_offset, random) {
|
|
11
|
+
randomPointInBox(random, result, result_offset);
|
|
12
|
+
}
|
|
13
|
+
}
|