@woosh/meep-engine 2.109.16 → 2.109.18
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/build/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +86 -50
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +86 -50
- package/package.json +1 -1
- package/src/core/color/Color.d.ts.map +1 -1
- package/src/core/color/Color.js +29 -6
- package/src/core/color/rgb2uint24.js +1 -0
- package/src/core/color/rgb2uint32.d.ts +10 -0
- package/src/core/color/rgb2uint32.d.ts.map +1 -0
- package/src/core/color/rgb2uint32.js +18 -0
- package/src/core/geom/3d/Ray3.d.ts +1 -1
- package/src/core/geom/3d/Ray3.d.ts.map +1 -1
- package/src/core/geom/3d/Ray3.js +1 -1
- package/src/core/geom/3d/aabb/aabb3_raycast.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_raycast.js +3 -2
- package/src/core/geom/3d/apply_mat4_transform_to_direction_v3_array.d.ts.map +1 -1
- package/src/core/geom/3d/apply_mat4_transform_to_direction_v3_array.js +3 -1
- package/src/core/geom/3d/decompose_matrix_4_array.js +4 -4
- package/src/core/geom/3d/frustum/frustum_from_projection_matrix_array.d.ts.map +1 -1
- package/src/core/geom/3d/frustum/frustum_from_projection_matrix_array.js +3 -1
- package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.d.ts.map +1 -1
- package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.js +2 -1
- package/src/core/geom/3d/quaternion/quat_encode_to_uint32.d.ts.map +1 -1
- package/src/core/geom/3d/quaternion/quat_encode_to_uint32.js +2 -1
- package/src/core/geom/3d/ray/ray3_array_apply_matrix4.d.ts.map +1 -1
- package/src/core/geom/3d/ray/ray3_array_apply_matrix4.js +3 -1
- package/src/core/geom/3d/ray/ray3_interval_array_apply_matrix4.d.ts.map +1 -1
- package/src/core/geom/3d/ray/ray3_interval_array_apply_matrix4.js +3 -1
- package/src/core/geom/3d/shape/TransformedShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/TransformedShape3D.js +7 -6
- package/src/core/geom/3d/shape/UnitSphereShape3D.js +1 -1
- package/src/core/geom/3d/topology/tm_vertex_compute_normal.d.ts.map +1 -1
- package/src/core/geom/3d/topology/tm_vertex_compute_normal.js +2 -1
- package/src/core/geom/3d/v3_compute_triangle_normal.spec.js +2 -1
- package/src/core/geom/mat3/m3_rm_extract_scale.d.ts.map +1 -1
- package/src/core/geom/mat3/m3_rm_extract_scale.js +4 -2
- package/src/core/geom/vec2/v2_length.d.ts +8 -0
- package/src/core/geom/vec2/v2_length.d.ts.map +1 -0
- package/src/core/geom/vec2/v2_length.js +11 -0
- package/src/core/geom/vec3/v3_distance.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_distance.js +3 -1
- package/src/core/geom/vec3/v3_length.js +1 -1
- package/src/core/geom/vec3/v3_matrix4_rotate.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_matrix4_rotate.js +3 -1
- package/src/core/geom/vec3/v3_normalize_array.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_normalize_array.js +3 -1
- package/src/engine/asset/loaders/material/computeTextureHash.d.ts.map +1 -1
- package/src/engine/asset/loaders/material/computeTextureHash.js +5 -1
- package/src/engine/graphics/canvas/canvas2d_draw_linear_scale.d.ts.map +1 -1
- package/src/engine/graphics/canvas/canvas2d_draw_linear_scale.js +2 -1
- package/src/engine/graphics/ecs/highlight/HighlightDefinition.d.ts +3 -0
- package/src/engine/graphics/ecs/highlight/HighlightDefinition.d.ts.map +1 -1
- package/src/engine/graphics/ecs/highlight/HighlightDefinition.js +31 -28
- package/src/engine/graphics/ecs/path/tube/build/build_geometry_catmullrom.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/tube/build/build_geometry_catmullrom.js +2 -1
- package/src/engine/graphics/ecs/path/tube/build/compute_smooth_profile_normals.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/tube/build/compute_smooth_profile_normals.js +5 -3
- package/src/engine/graphics/ecs/path/tube/build/makeTubeGeometry.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/tube/build/makeTubeGeometry.js +2 -1
- package/src/engine/graphics/ecs/path/tube/build/make_cap.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/tube/build/make_cap.js +3 -2
- package/src/engine/graphics/ecs/path/tube/build/make_ring_vertices.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/tube/build/make_ring_vertices.js +6 -5
- package/src/engine/graphics/sh3/gi/material/common.glsl +51 -9
- package/src/engine/graphics/sh3/gi/material/makeOctahedralDepthAtlas.d.ts.map +1 -1
- package/src/engine/graphics/sh3/gi/material/makeOctahedralDepthAtlas.js +3 -3
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts +5 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +11 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.js +1 -1
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.js +30 -15
- package/src/engine/graphics/sh3/lpv/depth/octahedral/stitching/frag.glsl +88 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/stitching/prototype.d.ts +2 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/stitching/prototype.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/stitching/prototype.js +96 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/stitching/vert.glsl +65 -0
- package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/VLPDepthMapVisualisation.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/VLPDepthMapVisualisation.js +2 -1
- package/src/engine/graphics/sh3/lpv/depth/octahedral/v2/visualise.frag.glsl +283 -27
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/probe_volume_to_textures.js +2 -6
- package/src/engine/graphics/sh3/lpv/serialization/LightProbeVolumeSerializationAdapter.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/serialization/LightProbeVolumeSerializationAdapter.js +1 -0
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/sampling/getBiasedNormalSample.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/sampling/getBiasedNormalSample.js +2 -1
- package/src/engine/graphics/sh3/path_tracer/sampling/getCosineDirection.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/sampling/getCosineDirection.js +2 -1
- package/src/engine/graphics/sh3/path_tracer/sampling/v3_orthonormal_matrix_from_normal.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/sampling/v3_orthonormal_matrix_from_normal.js +3 -1
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +8 -6
package/build/meep.module.js
CHANGED
|
@@ -703,8 +703,17 @@ function compose_matrix4_array(result, position, rotation, scale) {
|
|
|
703
703
|
result[15] = 1;
|
|
704
704
|
}
|
|
705
705
|
|
|
706
|
-
|
|
707
|
-
|
|
706
|
+
/**
|
|
707
|
+
*
|
|
708
|
+
* @param {number} x
|
|
709
|
+
* @param {number} y
|
|
710
|
+
* @param {number} z
|
|
711
|
+
* @returns {number}
|
|
712
|
+
*/
|
|
713
|
+
function v3_length(x, y, z) {
|
|
714
|
+
return Math.sqrt(x * x + y * y + z * z);
|
|
715
|
+
}
|
|
716
|
+
|
|
708
717
|
/**
|
|
709
718
|
*
|
|
710
719
|
* @param {number[]} mat4
|
|
@@ -717,19 +726,19 @@ function decompose_matrix_4_array(mat4, position, rotation, scale) {
|
|
|
717
726
|
const m12 = mat4[1];
|
|
718
727
|
const m13 = mat4[2];
|
|
719
728
|
|
|
720
|
-
const scale_x =
|
|
729
|
+
const scale_x = v3_length(m11, m12, m13);
|
|
721
730
|
|
|
722
731
|
const m21 = mat4[4];
|
|
723
732
|
const m22 = mat4[5];
|
|
724
733
|
const m23 = mat4[6];
|
|
725
734
|
|
|
726
|
-
const scale_y =
|
|
735
|
+
const scale_y = v3_length(m21, m22, m23);
|
|
727
736
|
|
|
728
737
|
const m31 = mat4[8];
|
|
729
738
|
const m32 = mat4[9];
|
|
730
739
|
const m33 = mat4[10];
|
|
731
740
|
|
|
732
|
-
const scale_z =
|
|
741
|
+
const scale_z = v3_length(m31, m32, m33);
|
|
733
742
|
|
|
734
743
|
// extract rotation matrix
|
|
735
744
|
// take care of potential division by 0 when scale is 0. Result is inexact, but we get don't break the system at least
|
|
@@ -1822,6 +1831,30 @@ function quat_decode_from_uint32(output, output_offset, value) {
|
|
|
1822
1831
|
output[output_offset + 3] = w;
|
|
1823
1832
|
}
|
|
1824
1833
|
|
|
1834
|
+
/**
|
|
1835
|
+
*
|
|
1836
|
+
* @param {number} x
|
|
1837
|
+
* @param {number} y
|
|
1838
|
+
* @param {number} z
|
|
1839
|
+
* @param {number} w
|
|
1840
|
+
* @returns {number}
|
|
1841
|
+
*/
|
|
1842
|
+
function v4_length_sqr(x, y, z, w) {
|
|
1843
|
+
return x * x + y * y + z * z + w * w;
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1846
|
+
/**
|
|
1847
|
+
*
|
|
1848
|
+
* @param {number} x
|
|
1849
|
+
* @param {number} y
|
|
1850
|
+
* @param {number} z
|
|
1851
|
+
* @param {number} w
|
|
1852
|
+
* @returns {number}
|
|
1853
|
+
*/
|
|
1854
|
+
function v4_length(x, y, z, w) {
|
|
1855
|
+
return Math.sqrt(v4_length_sqr(x, y, z, w));
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1825
1858
|
/**
|
|
1826
1859
|
* Based on GDC talk from Bungie on destiny, compressing quaternions for animation
|
|
1827
1860
|
* @param {number} x
|
|
@@ -1907,7 +1940,7 @@ function quat_encode_to_uint32(x, y, z, w) {
|
|
|
1907
1940
|
v2 = -v2;
|
|
1908
1941
|
}
|
|
1909
1942
|
|
|
1910
|
-
const l =
|
|
1943
|
+
const l = v4_length(v0, v1, v2, dropped);
|
|
1911
1944
|
const m = 511 / (l * Math.SQRT1_2);
|
|
1912
1945
|
|
|
1913
1946
|
//re-normalize the remaining components to 10 bit UINT value
|
|
@@ -1936,30 +1969,6 @@ function v3_dot(x0, y0, z0, x1, y1, z1) {
|
|
|
1936
1969
|
return (x0 * x1 + y0 * y1 + z0 * z1);
|
|
1937
1970
|
}
|
|
1938
1971
|
|
|
1939
|
-
/**
|
|
1940
|
-
*
|
|
1941
|
-
* @param {number} x
|
|
1942
|
-
* @param {number} y
|
|
1943
|
-
* @param {number} z
|
|
1944
|
-
* @param {number} w
|
|
1945
|
-
* @returns {number}
|
|
1946
|
-
*/
|
|
1947
|
-
function v4_length_sqr(x, y, z, w) {
|
|
1948
|
-
return x * x + y * y + z * z + w * w;
|
|
1949
|
-
}
|
|
1950
|
-
|
|
1951
|
-
/**
|
|
1952
|
-
*
|
|
1953
|
-
* @param {number} x
|
|
1954
|
-
* @param {number} y
|
|
1955
|
-
* @param {number} z
|
|
1956
|
-
* @param {number} w
|
|
1957
|
-
* @returns {number}
|
|
1958
|
-
*/
|
|
1959
|
-
function v4_length(x, y, z, w) {
|
|
1960
|
-
return Math.sqrt(v4_length_sqr(x, y, z, w));
|
|
1961
|
-
}
|
|
1962
|
-
|
|
1963
1972
|
/**
|
|
1964
1973
|
*
|
|
1965
1974
|
* @param {number} v
|
|
@@ -1969,17 +1978,6 @@ function sign$1(v) {
|
|
|
1969
1978
|
return v > 0 ? 1 : (v < 0 ? -1 : 0);
|
|
1970
1979
|
}
|
|
1971
1980
|
|
|
1972
|
-
/**
|
|
1973
|
-
*
|
|
1974
|
-
* @param {number} x
|
|
1975
|
-
* @param {number} y
|
|
1976
|
-
* @param {number} z
|
|
1977
|
-
* @returns {number}
|
|
1978
|
-
*/
|
|
1979
|
-
function v3_length(x, y, z) {
|
|
1980
|
-
return Math.hypot(x, y, z);
|
|
1981
|
-
}
|
|
1982
|
-
|
|
1983
1981
|
/**
|
|
1984
1982
|
*
|
|
1985
1983
|
* @param {number} x0
|
|
@@ -53588,6 +53586,22 @@ function rgb2uint24(r, g, b) {
|
|
|
53588
53586
|
;
|
|
53589
53587
|
}
|
|
53590
53588
|
|
|
53589
|
+
/**
|
|
53590
|
+
*
|
|
53591
|
+
* @param {number} r in 0..1 range
|
|
53592
|
+
* @param {number} g in 0..1 range
|
|
53593
|
+
* @param {number} b in 0..1 range
|
|
53594
|
+
* @param {number} a in 0..1 range
|
|
53595
|
+
* @returns {number}
|
|
53596
|
+
*/
|
|
53597
|
+
function rgb2uint32(r, g, b, a) {
|
|
53598
|
+
const partial = rgb2uint24(r, b, g);
|
|
53599
|
+
|
|
53600
|
+
const _a = float_to_uint8(a);
|
|
53601
|
+
|
|
53602
|
+
return (partial << 8) | (_a & 0xFF);
|
|
53603
|
+
}
|
|
53604
|
+
|
|
53591
53605
|
/**
|
|
53592
53606
|
*
|
|
53593
53607
|
* @param {number} r
|
|
@@ -53671,9 +53685,10 @@ class Color {
|
|
|
53671
53685
|
* @param {number} [r] Red from 0 to 1
|
|
53672
53686
|
* @param {number} [g] Green from 0 to 1
|
|
53673
53687
|
* @param {number} [b] Blue from 0 to 1
|
|
53674
|
-
* @param {number} [a]
|
|
53688
|
+
* @param {number} [a] Alpha from 0 to 1 (transparency)
|
|
53675
53689
|
*/
|
|
53676
53690
|
constructor(r = 0, g = 0, b = 0, a = 1) {
|
|
53691
|
+
|
|
53677
53692
|
/**
|
|
53678
53693
|
* Red channel
|
|
53679
53694
|
* Value from 0 to 1
|
|
@@ -54065,14 +54080,21 @@ class Color {
|
|
|
54065
54080
|
}
|
|
54066
54081
|
|
|
54067
54082
|
/**
|
|
54068
|
-
*
|
|
54083
|
+
* Encodes RGB to uint24
|
|
54069
54084
|
* @returns {number}
|
|
54070
54085
|
*/
|
|
54071
54086
|
toUint() {
|
|
54072
|
-
|
|
54073
54087
|
return rgb2uint24(this.r, this.g, this.b);
|
|
54074
54088
|
}
|
|
54075
54089
|
|
|
54090
|
+
/**
|
|
54091
|
+
* Encodes RGBA to uint32
|
|
54092
|
+
* @returns {number}
|
|
54093
|
+
*/
|
|
54094
|
+
toUint32() {
|
|
54095
|
+
return rgb2uint32(this.r, this.g, this.b, this.a);
|
|
54096
|
+
}
|
|
54097
|
+
|
|
54076
54098
|
/**
|
|
54077
54099
|
*
|
|
54078
54100
|
* @param {number} value
|
|
@@ -54171,16 +54193,20 @@ class Color {
|
|
|
54171
54193
|
|
|
54172
54194
|
/**
|
|
54173
54195
|
*
|
|
54174
|
-
* @param {number[]} destination
|
|
54175
|
-
* @param {number} destination_offset
|
|
54196
|
+
* @param {number[]} [destination]
|
|
54197
|
+
* @param {number} [destination_offset]
|
|
54198
|
+
* @returns {number[]}
|
|
54176
54199
|
*/
|
|
54177
|
-
|
|
54200
|
+
toArray(destination = [], destination_offset = 0) {
|
|
54178
54201
|
destination[destination_offset] = this.r;
|
|
54179
54202
|
destination[destination_offset + 1] = this.g;
|
|
54180
54203
|
destination[destination_offset + 2] = this.b;
|
|
54181
54204
|
destination[destination_offset + 3] = this.a;
|
|
54205
|
+
|
|
54206
|
+
return destination;
|
|
54182
54207
|
}
|
|
54183
54208
|
|
|
54209
|
+
|
|
54184
54210
|
/**
|
|
54185
54211
|
*
|
|
54186
54212
|
* @param {BinaryBuffer} buffer
|
|
@@ -54294,6 +54320,12 @@ class Color {
|
|
|
54294
54320
|
}
|
|
54295
54321
|
}
|
|
54296
54322
|
|
|
54323
|
+
/**
|
|
54324
|
+
* Shortcut
|
|
54325
|
+
* @readonly
|
|
54326
|
+
*/
|
|
54327
|
+
Color.prototype.writeToArray = Color.prototype.toArray;
|
|
54328
|
+
|
|
54297
54329
|
/**
|
|
54298
54330
|
* @readonly
|
|
54299
54331
|
* @type {Readonly<Color>}
|
|
@@ -57081,7 +57113,7 @@ function ray3_array_apply_matrix4(output, output_offset, input, input_offset, m4
|
|
|
57081
57113
|
const out_direction_z = m4[2] * direction_x + m4[6] * direction_y + m4[10] * direction_z;
|
|
57082
57114
|
|
|
57083
57115
|
// normalize direction
|
|
57084
|
-
const out_direction_magnitude =
|
|
57116
|
+
const out_direction_magnitude = v3_length(out_direction_x, out_direction_y, out_direction_z);
|
|
57085
57117
|
|
|
57086
57118
|
if (out_direction_magnitude === 0) {
|
|
57087
57119
|
return false;
|
|
@@ -76466,7 +76498,11 @@ function computeTextureHash(t) {
|
|
|
76466
76498
|
t.premultiplyAlpha ? 1 : 0,
|
|
76467
76499
|
t.flipY ? 1 : 0,
|
|
76468
76500
|
t.unpackAlignment,
|
|
76469
|
-
|
|
76501
|
+
/*
|
|
76502
|
+
we are excluding encoding from hash, as this property has disappeared in later version of three.js
|
|
76503
|
+
This property is rarely going to have the deciding role for the hash anyway. This notice is left for historical purposes only
|
|
76504
|
+
*/
|
|
76505
|
+
// t.encoding,
|
|
76470
76506
|
specificHash
|
|
76471
76507
|
);
|
|
76472
76508
|
}
|
|
@@ -106414,7 +106450,7 @@ function v3_distance(
|
|
|
106414
106450
|
x0, y0, z0,
|
|
106415
106451
|
x1, y1, z1
|
|
106416
106452
|
) {
|
|
106417
|
-
return
|
|
106453
|
+
return v3_length(x1 - x0, y1 - y0, z1 - z0);
|
|
106418
106454
|
}
|
|
106419
106455
|
|
|
106420
106456
|
class AbstractTextureAtlas {
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Color.d.ts","sourceRoot":"","sources":["../../../../src/core/color/Color.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Color.d.ts","sourceRoot":"","sources":["../../../../src/core/color/Color.js"],"names":[],"mappings":"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"}
|
package/src/core/color/Color.js
CHANGED
|
@@ -11,6 +11,7 @@ import { rgb2hex } from "./hex/rgb2hex.js";
|
|
|
11
11
|
import { rgb2hsv } from "./hsv/rgb2hsv.js";
|
|
12
12
|
import { parse_color } from "./parse_color.js";
|
|
13
13
|
import { rgb2uint24 } from "./rgb2uint24.js";
|
|
14
|
+
import { rgb2uint32 } from "./rgb2uint32.js";
|
|
14
15
|
import { rgb_to_luminance } from "./rgb_to_luminance.js";
|
|
15
16
|
import { linear_to_sRGB } from "./sRGB/linear_to_sRGB.js";
|
|
16
17
|
import { sRGB_to_linear } from "./sRGB/sRGB_to_linear.js";
|
|
@@ -25,9 +26,14 @@ export class Color {
|
|
|
25
26
|
* @param {number} [r] Red from 0 to 1
|
|
26
27
|
* @param {number} [g] Green from 0 to 1
|
|
27
28
|
* @param {number} [b] Blue from 0 to 1
|
|
28
|
-
* @param {number} [a]
|
|
29
|
+
* @param {number} [a] Alpha from 0 to 1 (transparency)
|
|
29
30
|
*/
|
|
30
31
|
constructor(r = 0, g = 0, b = 0, a = 1) {
|
|
32
|
+
assert.isNumber(r, 'r');
|
|
33
|
+
assert.isNumber(g, 'g');
|
|
34
|
+
assert.isNumber(b, 'b');
|
|
35
|
+
assert.isNumber(a, 'a');
|
|
36
|
+
|
|
31
37
|
/**
|
|
32
38
|
* Red channel
|
|
33
39
|
* Value from 0 to 1
|
|
@@ -433,14 +439,21 @@ export class Color {
|
|
|
433
439
|
}
|
|
434
440
|
|
|
435
441
|
/**
|
|
436
|
-
*
|
|
442
|
+
* Encodes RGB to uint24
|
|
437
443
|
* @returns {number}
|
|
438
444
|
*/
|
|
439
445
|
toUint() {
|
|
440
|
-
|
|
441
446
|
return rgb2uint24(this.r, this.g, this.b);
|
|
442
447
|
}
|
|
443
448
|
|
|
449
|
+
/**
|
|
450
|
+
* Encodes RGBA to uint32
|
|
451
|
+
* @returns {number}
|
|
452
|
+
*/
|
|
453
|
+
toUint32() {
|
|
454
|
+
return rgb2uint32(this.r, this.g, this.b, this.a);
|
|
455
|
+
}
|
|
456
|
+
|
|
444
457
|
/**
|
|
445
458
|
*
|
|
446
459
|
* @param {number} value
|
|
@@ -540,16 +553,20 @@ export class Color {
|
|
|
540
553
|
|
|
541
554
|
/**
|
|
542
555
|
*
|
|
543
|
-
* @param {number[]} destination
|
|
544
|
-
* @param {number} destination_offset
|
|
556
|
+
* @param {number[]} [destination]
|
|
557
|
+
* @param {number} [destination_offset]
|
|
558
|
+
* @returns {number[]}
|
|
545
559
|
*/
|
|
546
|
-
|
|
560
|
+
toArray(destination = [], destination_offset = 0) {
|
|
547
561
|
destination[destination_offset] = this.r;
|
|
548
562
|
destination[destination_offset + 1] = this.g;
|
|
549
563
|
destination[destination_offset + 2] = this.b;
|
|
550
564
|
destination[destination_offset + 3] = this.a;
|
|
565
|
+
|
|
566
|
+
return destination;
|
|
551
567
|
}
|
|
552
568
|
|
|
569
|
+
|
|
553
570
|
/**
|
|
554
571
|
*
|
|
555
572
|
* @param {BinaryBuffer} buffer
|
|
@@ -663,6 +680,12 @@ export class Color {
|
|
|
663
680
|
}
|
|
664
681
|
}
|
|
665
682
|
|
|
683
|
+
/**
|
|
684
|
+
* Shortcut
|
|
685
|
+
* @readonly
|
|
686
|
+
*/
|
|
687
|
+
Color.prototype.writeToArray = Color.prototype.toArray;
|
|
688
|
+
|
|
666
689
|
/**
|
|
667
690
|
* @readonly
|
|
668
691
|
* @type {Readonly<Color>}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number} r in 0..1 range
|
|
4
|
+
* @param {number} g in 0..1 range
|
|
5
|
+
* @param {number} b in 0..1 range
|
|
6
|
+
* @param {number} a in 0..1 range
|
|
7
|
+
* @returns {number}
|
|
8
|
+
*/
|
|
9
|
+
export function rgb2uint32(r: number, g: number, b: number, a: number): number;
|
|
10
|
+
//# sourceMappingURL=rgb2uint32.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rgb2uint32.d.ts","sourceRoot":"","sources":["../../../../src/core/color/rgb2uint32.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,8BANW,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CAQlB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { float_to_uint8 } from "../binary/float_to_uint8.js";
|
|
2
|
+
import { rgb2uint24 } from "./rgb2uint24.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {number} r in 0..1 range
|
|
7
|
+
* @param {number} g in 0..1 range
|
|
8
|
+
* @param {number} b in 0..1 range
|
|
9
|
+
* @param {number} a in 0..1 range
|
|
10
|
+
* @returns {number}
|
|
11
|
+
*/
|
|
12
|
+
export function rgb2uint32(r, g, b, a) {
|
|
13
|
+
const partial = rgb2uint24(r, b, g);
|
|
14
|
+
|
|
15
|
+
const _a = float_to_uint8(a);
|
|
16
|
+
|
|
17
|
+
return (partial << 8) | (_a & 0xFF);
|
|
18
|
+
}
|
|
@@ -54,7 +54,7 @@ export class Ray3 extends Float32Array {
|
|
|
54
54
|
* @param {number[]|Float32Array|mat4} transform
|
|
55
55
|
* @param {number[]|Float32Array|mat4} projection_inverse
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
projectFromPerspectiveCamera(x: number, y: number, z: number, transform: number[] | Float32Array | mat4, projection_inverse: number[] | Float32Array | mat4): void;
|
|
58
58
|
/**
|
|
59
59
|
*
|
|
60
60
|
* @param {number} distance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ray3.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/3d/Ray3.js"],"names":[],"mappings":"AASA;;;GAGG;AACH;IACI,cAKC;IAMD,mBAEC;IAND,gBAEC;IAGG,OAAW;IAOf;;;OAGG;IACH,yCAEC;IAVD,sCAEC;IAUD,uBAEC;IAED,uBAEC;IAED,uBAEC;IAGD;;;;;OAKG;IACH,aAJW,MAAM,KACN,MAAM,KACN,MAAM,QAUhB;IAHG,UAAW;IACX,UAAW;IACX,UAAW;IAQf;;;OAGG;IACH,4CAEC;IAVD,yCAEC;IAWD,0BAEC;IAED,0BAEC;IAED,0BAEC;IAED;;;;;OAKG;IACH,gBAJW,MAAM,KACN,MAAM,KACN,MAAM,QAUhB;IAHG,UAAW;IACX,UAAW;IACX,UAAW;IAGf,2BAEC;IAED;;;;;;;OAOG;IACH,
|
|
1
|
+
{"version":3,"file":"Ray3.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/3d/Ray3.js"],"names":[],"mappings":"AASA;;;GAGG;AACH;IACI,cAKC;IAMD,mBAEC;IAND,gBAEC;IAGG,OAAW;IAOf;;;OAGG;IACH,yCAEC;IAVD,sCAEC;IAUD,uBAEC;IAED,uBAEC;IAED,uBAEC;IAGD;;;;;OAKG;IACH,aAJW,MAAM,KACN,MAAM,KACN,MAAM,QAUhB;IAHG,UAAW;IACX,UAAW;IACX,UAAW;IAQf;;;OAGG;IACH,4CAEC;IAVD,yCAEC;IAWD,0BAEC;IAED,0BAEC;IAED,0BAEC;IAED;;;;;OAKG;IACH,gBAJW,MAAM,KACN,MAAM,KACN,MAAM,QAUhB;IAHG,UAAW;IACX,UAAW;IACX,UAAW;IAGf,2BAEC;IAED;;;;;;;OAOG;IACH,gCANW,MAAM,KACN,MAAM,KACN,MAAM,aACN,MAAM,EAAE,GAAC,YAAY,OAAK,sBAC1B,MAAM,EAAE,GAAC,YAAY,OAAK,QA6BpC;IAED;;;OAGG;IACH,uBAFW,MAAM,QAMhB;IAED;;;OAGG;IACH,iBAFW,MAAM,EAAE,UAAM,YAAY,QAepC;IAED;;;OAGG;IACH,SAFa,IAAI,CAQhB;IAED;;;OAGG;IACH,YAFW,IAAI,QAId;IAED,eAEC;IAED;;;;OAIG;IACH,cAHW,IAAI,GACF,OAAO,CAInB;CACJ"}
|
package/src/core/geom/3d/Ray3.js
CHANGED
|
@@ -122,7 +122,7 @@ export class Ray3 extends Float32Array {
|
|
|
122
122
|
* @param {number[]|Float32Array|mat4} transform
|
|
123
123
|
* @param {number[]|Float32Array|mat4} projection_inverse
|
|
124
124
|
*/
|
|
125
|
-
|
|
125
|
+
projectFromPerspectiveCamera(
|
|
126
126
|
x, y, z,
|
|
127
127
|
transform,
|
|
128
128
|
projection_inverse
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aabb3_raycast.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/aabb3_raycast.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"aabb3_raycast.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/aabb3_raycast.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,sCArBW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,iBACvC,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,YACN,MAAM,YACN,MAAM,YACN,MAAM,eACN,MAAM,eACN,MAAM,eACN,MAAM,GACJ,OAAO,CAqFnB"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
//
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
import { min2 } from "../../../math/min2.js";
|
|
5
4
|
import { max2 } from "../../../math/max2.js";
|
|
5
|
+
import { min2 } from "../../../math/min2.js";
|
|
6
|
+
import { v3_length } from "../../vec3/v3_length.js";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
*
|
|
@@ -94,7 +95,7 @@ export function aabb3_raycast(
|
|
|
94
95
|
const normal_z = (p_z / Math.abs(d_z) * bias) | 0;
|
|
95
96
|
|
|
96
97
|
// normalize surface normal vector
|
|
97
|
-
const normal_inv_length = 1 /
|
|
98
|
+
const normal_inv_length = 1 / v3_length(normal_x, normal_y, normal_z);
|
|
98
99
|
|
|
99
100
|
result[result_offset] = hit_x;
|
|
100
101
|
result[result_offset + 1] = hit_y;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply_mat4_transform_to_direction_v3_array.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/3d/apply_mat4_transform_to_direction_v3_array.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apply_mat4_transform_to_direction_v3_array.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/3d/apply_mat4_transform_to_direction_v3_array.js"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,mEAPW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,iBAClC,MAAM,eACN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,sBAClC,MAAM,gBACN,MAAM,mBA6ChB"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { v3_length } from "../vec3/v3_length.js";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Matrix-transform an array of 3d direction vectors
|
|
3
5
|
* Code is inlined for speed
|
|
@@ -39,7 +41,7 @@ export function apply_mat4_transform_to_direction_v3_array(
|
|
|
39
41
|
const y = a1 * _x + b1 * _y + c1 * _z;
|
|
40
42
|
const z = a2 * _x + b2 * _y + c2 * _z;
|
|
41
43
|
|
|
42
|
-
const normal_multiplier = 1 /
|
|
44
|
+
const normal_multiplier = 1 / v3_length(x, y, z);
|
|
43
45
|
|
|
44
46
|
const destination_vertex_address = destination_offset + i3;
|
|
45
47
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { v3_length } from "../vec3/v3_length.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
@@ -12,19 +12,19 @@ export function decompose_matrix_4_array(mat4, position, rotation, scale) {
|
|
|
12
12
|
const m12 = mat4[1];
|
|
13
13
|
const m13 = mat4[2];
|
|
14
14
|
|
|
15
|
-
const scale_x =
|
|
15
|
+
const scale_x = v3_length(m11, m12, m13);
|
|
16
16
|
|
|
17
17
|
const m21 = mat4[4];
|
|
18
18
|
const m22 = mat4[5];
|
|
19
19
|
const m23 = mat4[6];
|
|
20
20
|
|
|
21
|
-
const scale_y =
|
|
21
|
+
const scale_y = v3_length(m21, m22, m23);
|
|
22
22
|
|
|
23
23
|
const m31 = mat4[8];
|
|
24
24
|
const m32 = mat4[9];
|
|
25
25
|
const m33 = mat4[10];
|
|
26
26
|
|
|
27
|
-
const scale_z =
|
|
27
|
+
const scale_z = v3_length(m31, m32, m33);
|
|
28
28
|
|
|
29
29
|
// extract rotation matrix
|
|
30
30
|
// take care of potential division by 0 when scale is 0. Result is inexact, but we get don't break the system at least
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frustum_from_projection_matrix_array.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/frustum/frustum_from_projection_matrix_array.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"frustum_from_projection_matrix_array.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/frustum/frustum_from_projection_matrix_array.js"],"names":[],"mappings":"AA2BA;;;;;;GAMG;AACH,qEAHW,MAAM,EAAE,GAAC,YAAY,MACrB,MAAM,EAAE,QAkClB"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { v3_length } from "../../vec3/v3_length.js";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
*
|
|
3
5
|
* @param {number[]} destination
|
|
@@ -12,7 +14,7 @@ function array_set_plane_normalized(
|
|
|
12
14
|
x, y, z, w
|
|
13
15
|
) {
|
|
14
16
|
// compute vector length
|
|
15
|
-
const length =
|
|
17
|
+
const length = v3_length(x, y, z);
|
|
16
18
|
|
|
17
19
|
const inverse_length = 1.0 / length;
|
|
18
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode_octahedron_to_unit.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decode_octahedron_to_unit.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,kDALW,MAAM,EAAE,aAAS,YAAY,iBAC7B,MAAM,KACN,MAAM,KACN,MAAM,QA0BhB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { sign_not_zero } from "../../../../math/sign_not_zero.js";
|
|
2
|
+
import { v3_length } from "../../../vec3/v3_length.js";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @see A Survey of Efficient Representations for Independent Unit Vectors (Journal of Computer Graphics Techniques Vol. 3, No. 2, 2014) - page 13
|
|
@@ -27,7 +28,7 @@ export function decode_octahedron_to_unit(
|
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
// normalize
|
|
30
|
-
const m = 1 /
|
|
31
|
+
const m = 1 / v3_length(v_x, v_y, v_z);
|
|
31
32
|
|
|
32
33
|
output[output_offset] = v_x * m;
|
|
33
34
|
output[output_offset + 1] = v_y * m;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quat_encode_to_uint32.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/quaternion/quat_encode_to_uint32.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"quat_encode_to_uint32.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/quaternion/quat_encode_to_uint32.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,yCANW,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CAgGlB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { assert } from "../../../assert.js";
|
|
2
|
+
import { v4_length } from "../../vec4/v4_length.js";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Based on GDC talk from Bungie on destiny, compressing quaternions for animation
|
|
@@ -85,7 +86,7 @@ export function quat_encode_to_uint32(x, y, z, w) {
|
|
|
85
86
|
v2 = -v2;
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
const l =
|
|
89
|
+
const l = v4_length(v0, v1, v2, dropped);
|
|
89
90
|
const m = 511 / (l * Math.SQRT1_2);
|
|
90
91
|
|
|
91
92
|
//re-normalize the remaining components to 10 bit UINT value
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ray3_array_apply_matrix4.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/ray/ray3_array_apply_matrix4.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ray3_array_apply_matrix4.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/ray/ray3_array_apply_matrix4.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,iDAPW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,iBACvC,MAAM,SACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,gBACvC,MAAM,MACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,GACrC,OAAO,CAkDnB"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { v3_length } from "../../vec3/v3_length.js";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
*
|
|
3
5
|
* @param {number[]|ArrayLike<number>|Float32Array} output 6 component vector, [origin_x, origin_y, origin_z, direction_x, direction_y, direction_z]
|
|
@@ -34,7 +36,7 @@ export function ray3_array_apply_matrix4(output, output_offset, input, input_off
|
|
|
34
36
|
const out_direction_z = m4[2] * direction_x + m4[6] * direction_y + m4[10] * direction_z;
|
|
35
37
|
|
|
36
38
|
// normalize direction
|
|
37
|
-
const out_direction_magnitude =
|
|
39
|
+
const out_direction_magnitude = v3_length(out_direction_x, out_direction_y, out_direction_z);
|
|
38
40
|
|
|
39
41
|
if (out_direction_magnitude === 0) {
|
|
40
42
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ray3_interval_array_apply_matrix4.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/ray/ray3_interval_array_apply_matrix4.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ray3_interval_array_apply_matrix4.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/ray/ray3_interval_array_apply_matrix4.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,0DAPW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,iBACvC,MAAM,SACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,gBACvC,MAAM,MACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC,YAAY,GACrC,OAAO,CAoEnB"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { v3_length } from "../../vec3/v3_length.js";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
*
|
|
3
5
|
* @param {number[]|ArrayLike<number>|Float32Array} output 7 component vector, [origin_x, origin_y, origin_z, direction_x, direction_y, direction_z, tMax]
|
|
@@ -54,7 +56,7 @@ export function ray3_interval_array_apply_matrix4(
|
|
|
54
56
|
const delta_z = out_max_z - out_min_z;
|
|
55
57
|
|
|
56
58
|
// normalize direction
|
|
57
|
-
const out_direction_magnitude =
|
|
59
|
+
const out_direction_magnitude = v3_length(delta_x, delta_y, delta_z);
|
|
58
60
|
|
|
59
61
|
const out_direction_magnitude_inverse = 1 / out_direction_magnitude;
|
|
60
62
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransformedShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/TransformedShape3D.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"TransformedShape3D.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/shape/TransformedShape3D.js"],"names":[],"mappings":";AAcA;IAkCI;;;;;OAKG;IACH,wBAHW,eAAe,MADf,MAAM,EAAE,GAAC,YAAY,GAAC,IAAI,GAExB,kBAAkB,CAS9B;IAED;;;;;OAKG;IACH,uCAJW,eAAe,eACf,MAAM,EAAE,SACR,MAAM,EAAE,sBAQlB;IAED;;;;;OAKG;IACH,2BAHW,eAAe,SACf,MAAM,EAAE,GAAC,YAAY,GAAC,IAAI,GAFxB,kBAAkB,CAS9B;IAtEG;;;;OAIG;IACH,iBAAoC;IAEpC;;;;OAIG;IACH,yBAA4C;IAE5C;;;;OAIG;IACH,kBAAqB;IAGzB;;;OAGG;IACH,+BAEC;IA4CD;;;OAGG;IACH,4CAIC;IAED,yCAEC;IAED,qBAMC;IAED,wCAKC;IAED,mEAgDC;IAED,6CAEC;IAED,gCAKC;IAED,kFAUC;IAED;;;;OAIG;IACH,cAHW,kBAAkB,GAChB,OAAO,CAOnB;IAED,eAGC;CACJ;;8BAIS,OAAO;;gCA9Me,sBAAsB;qBAN3B,WAAW;qBAAX,WAAW"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { mat4, vec3 } from "gl-matrix";
|
|
2
|
-
import { AbstractShape3D } from "./AbstractShape3D.js";
|
|
3
|
-
import { sign } from "../../../math/sign.js";
|
|
4
2
|
import { isArrayEqualStrict } from "../../../collection/array/isArrayEqualStrict.js";
|
|
5
3
|
import { computeHashFloatArray } from "../../../math/hash/computeHashFloatArray.js";
|
|
4
|
+
import { sign } from "../../../math/sign.js";
|
|
5
|
+
import { v3_length } from "../../vec3/v3_length.js";
|
|
6
6
|
import { aabb3_matrix4_project } from "../aabb/aabb3_matrix4_project.js";
|
|
7
|
+
import { AbstractShape3D } from "./AbstractShape3D.js";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
*
|
|
@@ -139,16 +140,16 @@ export class TransformedShape3D extends AbstractShape3D {
|
|
|
139
140
|
const m32 = m[9];
|
|
140
141
|
const m33 = m[10];
|
|
141
142
|
|
|
142
|
-
const scale_x =
|
|
143
|
-
const scale_y =
|
|
144
|
-
const scale_z =
|
|
143
|
+
const scale_x = v3_length(m11, m12, m13);
|
|
144
|
+
const scale_y = v3_length(m21, m22, m23);
|
|
145
|
+
const scale_z = v3_length(m31, m32, m33);
|
|
145
146
|
|
|
146
147
|
const scaled_gx = scratch_v3_0[0] * scale_x;
|
|
147
148
|
const scaled_gy = scratch_v3_0[1] * scale_y;
|
|
148
149
|
const scaled_gz = scratch_v3_0[2] * scale_z;
|
|
149
150
|
|
|
150
151
|
// normalize gradient
|
|
151
|
-
const gd = distance /
|
|
152
|
+
const gd = distance / v3_length(scratch_v3_0[0], scratch_v3_0[1], scratch_v3_0[2]);
|
|
152
153
|
|
|
153
154
|
const scaled_dx = scaled_gx * gd;
|
|
154
155
|
const scaled_dy = scaled_gy * gd;
|