@woosh/meep-engine 2.134.4 → 2.135.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bundle-worker-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/editor/tools/v2/TransformControlsGizmo.js +1 -1
- package/editor/view/node-graph/NodeGraphEditorView.js +2 -2
- package/package.json +1 -1
- package/src/core/assert.d.ts +0 -2
- package/src/core/assert.d.ts.map +1 -1
- package/src/core/assert.js +0 -6
- package/src/core/color/Color.d.ts +0 -5
- package/src/core/color/Color.d.ts.map +1 -1
- package/src/core/color/Color.js +1 -7
- package/src/core/geom/2d/hash-grid/SpatialHashGrid.js +386 -386
- package/src/core/geom/2d/line/line_segment_compute_line_segment_intersection_2d.js +1 -1
- package/src/core/geom/2d/quad-tree-binary/QuadTree.js +714 -714
- package/src/core/geom/3d/triangle/computeTriangleRayIntersection.js +160 -160
- package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentric.js +96 -96
- package/src/core/geom/packing/max-rect/MaxRectanglesPacker.js +1 -1
- package/src/core/geom/packing/max-rect/findBestContainer.js +4 -4
- package/src/core/geom/packing/max-rect/packOneBox.js +2 -2
- package/src/core/geom/vec3/v3_rigid_align_paired_unit_vectors.d.ts +23 -0
- package/src/core/geom/vec3/v3_rigid_align_paired_unit_vectors.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_rigid_align_paired_unit_vectors.js +96 -0
- package/src/core/graph/layout/box/BoxLayouter.js +7 -7
- package/src/core/graph/layout/box/position_box_next_to_box.js +6 -6
- package/src/core/math/computeWholeDivisorLow.js +33 -33
- package/src/core/math/linalg/eigen/eigen_values_find_spectral_gap.d.ts.map +1 -0
- package/src/core/math/linalg/eigen/matrix_eigenvalues_in_place.d.ts +10 -0
- package/src/core/math/linalg/eigen/matrix_eigenvalues_in_place.d.ts.map +1 -0
- package/src/core/{graph → math/linalg}/eigen/matrix_eigenvalues_in_place.js +8 -7
- package/src/core/math/linalg/eigen/matrix_householder_in_place.d.ts.map +1 -0
- package/src/core/{graph → math/linalg}/eigen/matrix_householder_in_place.js +11 -5
- package/src/core/math/linalg/eigen/matrix_qr_in_place.d.ts +15 -0
- package/src/core/math/linalg/eigen/matrix_qr_in_place.d.ts.map +1 -0
- package/src/core/{graph → math/linalg}/eigen/matrix_qr_in_place.js +8 -2
- package/src/core/math/linalg/eigen/matrix_top_eigenvector_power_iteration.d.ts +17 -0
- package/src/core/math/linalg/eigen/matrix_top_eigenvector_power_iteration.d.ts.map +1 -0
- package/src/core/math/linalg/eigen/matrix_top_eigenvector_power_iteration.js +107 -0
- package/src/core/math/linalg/polynomial_complex_roots_aberth_ehrlich.d.ts +19 -0
- package/src/core/math/linalg/polynomial_complex_roots_aberth_ehrlich.d.ts.map +1 -0
- package/src/core/math/linalg/polynomial_complex_roots_aberth_ehrlich.js +161 -0
- package/src/core/math/linalg/polynomial_real_roots_in_interval.d.ts +15 -0
- package/src/core/math/linalg/polynomial_real_roots_in_interval.d.ts.map +1 -0
- package/src/core/math/linalg/polynomial_real_roots_in_interval.js +200 -0
- package/src/core/math/solveCubic.d.ts +15 -0
- package/src/core/math/solveCubic.d.ts.map +1 -0
- package/src/core/math/solveCubic.js +82 -0
- package/src/core/math/spline/spline3_hermite_bounds_t.d.ts +23 -0
- package/src/core/math/spline/spline3_hermite_bounds_t.d.ts.map +1 -0
- package/src/core/math/spline/spline3_hermite_bounds_t.js +109 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite.d.ts +25 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite.d.ts.map +1 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite.js +44 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_1d.d.ts +16 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_1d.d.ts.map +1 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_1d.js +120 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_2d.d.ts +11 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_2d.d.ts.map +1 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_2d.js +451 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_nd.d.ts +12 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_nd.d.ts.map +1 -0
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_nd.js +339 -0
- package/src/core/math/spline/spline3_hermite_intersects_spline3_hermite.d.ts +15 -0
- package/src/core/math/spline/spline3_hermite_intersects_spline3_hermite.d.ts.map +1 -0
- package/src/core/math/spline/spline3_hermite_intersects_spline3_hermite.js +21 -0
- package/src/core/math/spline/spline3_hermite_to_monomial.d.ts +24 -0
- package/src/core/math/spline/spline3_hermite_to_monomial.d.ts.map +1 -0
- package/src/core/math/spline/spline3_hermite_to_monomial.js +37 -0
- package/src/core/math/spline/v3_computeCatmullRomSplineUniformDistance.js +1 -1
- package/src/core/model/node-graph/visual/NodeGraphVisualData.js +1 -1
- package/src/core/model/reactive/model/util/createRandomReactiveExpression.js +185 -185
- package/src/core/process/delay.js +16 -16
- package/src/engine/animation/async/TimeSeries.js +300 -300
- package/src/engine/animation/curve/AnimationCurve.d.ts +3 -2
- package/src/engine/animation/curve/AnimationCurve.d.ts.map +1 -1
- package/src/engine/animation/curve/AnimationCurve.js +3 -2
- package/src/engine/animation/curve/draw/position_canvas_to_curve.js +2 -2
- package/src/engine/animation/curve/draw/position_curve_to_canvas.js +2 -2
- package/src/engine/ecs/fow/shader/FogOfWarRenderer.js +145 -145
- package/src/engine/ecs/gui/position/ViewportPositionSystem.js +2 -2
- package/src/engine/ecs/parent/entity_node_compute_bounding_box.js +1 -1
- package/src/engine/ecs/transform/Transform.d.ts +0 -10
- package/src/engine/ecs/transform/Transform.d.ts.map +1 -1
- package/src/engine/ecs/transform/Transform.js +0 -12
- package/src/engine/graphics/composit/CompositLayer.js +254 -254
- package/src/engine/graphics/ecs/mesh-v2/sg_hierarchy_compute_bounding_box_via_parent_entity.js +1 -1
- package/src/engine/graphics/ecs/path/tube/build/build_geometry_linear.js +2 -2
- package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +3 -3
- package/src/engine/graphics/particles/particular/engine/utils/volume/AttributeValue.js +201 -201
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +1 -1
- package/src/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameterSet.js +2 -2
- package/src/engine/graphics/render/forward_plus/LightManager.js +1226 -1226
- package/src/engine/graphics/render/forward_plus/model/PointLight.js +1 -1
- package/src/engine/graphics/sh3/lpv/lpv_obtain_storage_cached_volume.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +2 -2
- package/src/engine/graphics/texture/atlas/TextureAtlasDebugger.js +1 -1
- package/src/engine/graphics/texture/sampler/HarmonicDiffusionGrid.js +145 -145
- package/src/engine/graphics/texture/sampler/serialization/TextureBinaryBufferSerializer.js +2 -2
- package/src/engine/intelligence/behavior/ecs/BehaviorComponent.d.ts +2 -6
- package/src/engine/intelligence/behavior/ecs/BehaviorComponent.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/ecs/BehaviorComponent.js +0 -10
- package/src/engine/intelligence/mcts/MonteCarlo.js +275 -275
- package/src/engine/navigation/ecs/path_following/PathFollower.js +222 -222
- package/src/generation/grid/GridData.js +220 -220
- package/src/generation/grid/generation/GridTaskDensityMarkerDistribution.js +385 -385
- package/src/view/elements/image/SvgImageView.js +1 -1
- package/src/view/elements/windrose/WindRoseDiagram.js +369 -369
- package/src/view/minimap/gl/MinimapFogOfWar.js +3 -3
- package/src/view/util/DomSizeObserver.js +1 -1
- package/src/core/binary/clz32.d.ts +0 -6
- package/src/core/binary/clz32.d.ts.map +0 -1
- package/src/core/binary/clz32.js +0 -5
- package/src/core/binary/type/dataTypeFromTypedArray.d.ts +0 -8
- package/src/core/binary/type/dataTypeFromTypedArray.d.ts.map +0 -1
- package/src/core/binary/type/dataTypeFromTypedArray.js +0 -11
- package/src/core/collection/array/computeHashIntegerArray.d.ts +0 -1
- package/src/core/collection/array/computeHashIntegerArray.d.ts.map +0 -1
- package/src/core/collection/array/computeHashIntegerArray.js +0 -7
- package/src/core/collection/array/typed/typedArrayToDataType.d.ts +0 -6
- package/src/core/collection/array/typed/typedArrayToDataType.d.ts.map +0 -1
- package/src/core/collection/array/typed/typedArrayToDataType.js +0 -6
- package/src/core/geom/3d/mat4/MATRIX_4_IDENTITY.d.ts +0 -6
- package/src/core/geom/3d/mat4/MATRIX_4_IDENTITY.d.ts.map +0 -1
- package/src/core/geom/3d/mat4/MATRIX_4_IDENTITY.js +0 -7
- package/src/core/graph/eigen/eigen_values_find_spectral_gap.d.ts.map +0 -1
- package/src/core/graph/eigen/matrix_eigenvalues_in_place.d.ts +0 -8
- package/src/core/graph/eigen/matrix_eigenvalues_in_place.d.ts.map +0 -1
- package/src/core/graph/eigen/matrix_householder_in_place.d.ts.map +0 -1
- package/src/core/graph/eigen/matrix_qr_in_place.d.ts +0 -9
- package/src/core/graph/eigen/matrix_qr_in_place.d.ts.map +0 -1
- package/src/core/math/spline/cubicCurve.d.ts +0 -6
- package/src/core/math/spline/cubicCurve.d.ts.map +0 -1
- package/src/core/math/spline/cubicCurve.js +0 -6
- package/src/core/math/spline/spline_bezier2.d.ts +0 -6
- package/src/core/math/spline/spline_bezier2.d.ts.map +0 -1
- package/src/core/math/spline/spline_bezier2.js +0 -6
- package/src/core/math/spline/spline_bezier3.d.ts +0 -6
- package/src/core/math/spline/spline_bezier3.d.ts.map +0 -1
- package/src/core/math/spline/spline_bezier3.js +0 -6
- package/src/core/math/spline/spline_bezier3_bounds.d.ts +0 -6
- package/src/core/math/spline/spline_bezier3_bounds.d.ts.map +0 -1
- package/src/core/math/spline/spline_bezier3_bounds.js +0 -6
- package/src/core/math/spline/spline_hermite3.d.ts +0 -6
- package/src/core/math/spline/spline_hermite3.d.ts.map +0 -1
- package/src/core/math/spline/spline_hermite3.js +0 -6
- package/src/core/math/spline/spline_hermite3_bounds.d.ts +0 -6
- package/src/core/math/spline/spline_hermite3_bounds.d.ts.map +0 -1
- package/src/core/math/spline/spline_hermite3_bounds.js +0 -6
- package/src/core/math/spline/spline_hermite3_to_bezier.d.ts +0 -2
- package/src/core/math/spline/spline_hermite3_to_bezier.d.ts.map +0 -1
- package/src/core/math/spline/spline_hermite3_to_bezier.js +0 -6
- package/src/engine/intelligence/behavior/decorator/RepeatUntilFailureBehavior.d.ts +0 -37
- package/src/engine/intelligence/behavior/decorator/RepeatUntilFailureBehavior.d.ts.map +0 -1
- package/src/engine/intelligence/behavior/decorator/RepeatUntilFailureBehavior.js +0 -70
- /package/src/core/{graph → math/linalg}/eigen/eigen_values_find_spectral_gap.d.ts +0 -0
- /package/src/core/{graph → math/linalg}/eigen/eigen_values_find_spectral_gap.js +0 -0
- /package/src/core/{graph → math/linalg}/eigen/matrix_householder_in_place.d.ts +0 -0
|
@@ -1,145 +1,145 @@
|
|
|
1
|
-
import { Mesh, OrthographicCamera, Scene } from "three";
|
|
2
|
-
import { assert } from "../../../../core/assert.js";
|
|
3
|
-
import { isValueBetweenInclusive } from "../../../../core/math/interval/isValueBetweenInclusive.js";
|
|
4
|
-
import { FULL_SCREEN_TRIANGLE_GEOMETRY } from "../../../graphics/geometry/FULL_SCREEN_TRIANGLE_GEOMETRY.js";
|
|
5
|
-
import { buildScreenSpaceFogOfWarShader } from "./screenSpaceFogOfWarShader.js";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
* @param {FogOfWar} fow
|
|
10
|
-
* @param {function(number, number, number, number)} callback
|
|
11
|
-
*/
|
|
12
|
-
export function computeUvTransformFromFogOfWar(fow, callback) {
|
|
13
|
-
|
|
14
|
-
const sampler = fow.sampler;
|
|
15
|
-
|
|
16
|
-
const samplerWidth = sampler.width;
|
|
17
|
-
const samplerHeight = sampler.height;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const scaleX = (fow.scale * fow.size.x) * (samplerWidth / (samplerWidth - 3));
|
|
21
|
-
const scaleY = (fow.scale * fow.size.y) * (samplerHeight / (samplerHeight - 3));
|
|
22
|
-
|
|
23
|
-
const offsetX = 1.5 / samplerWidth;
|
|
24
|
-
const offsetY = 1.5 / samplerHeight;
|
|
25
|
-
|
|
26
|
-
callback(offsetX, offsetY, 1 / scaleX, 1 / scaleY);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export class FogOfWarRenderer {
|
|
30
|
-
constructor() {
|
|
31
|
-
/**
|
|
32
|
-
*
|
|
33
|
-
* @type {ShaderMaterial}
|
|
34
|
-
*/
|
|
35
|
-
this.material = buildScreenSpaceFogOfWarShader();
|
|
36
|
-
|
|
37
|
-
this.quad = new Mesh(FULL_SCREEN_TRIANGLE_GEOMETRY, this.material);
|
|
38
|
-
|
|
39
|
-
this.camera = new OrthographicCamera(-1, 1, 1, -1, 0, 1);
|
|
40
|
-
this.scene = new Scene();
|
|
41
|
-
this.scene.add(this.quad);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
* @param {FogOfWar} fow
|
|
47
|
-
*/
|
|
48
|
-
setUvTransformFromFog(fow) {
|
|
49
|
-
computeUvTransformFromFogOfWar(fow, (offsetX, offsetY, scaleX, scaleY) => {
|
|
50
|
-
|
|
51
|
-
this.setUvTransform(offsetX, offsetY, scaleX, scaleY);
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
*
|
|
57
|
-
* @param {number} offsetX UV u offset, between 0 and 1
|
|
58
|
-
* @param {number} offsetY UV v offset, between 0 and 1
|
|
59
|
-
* @param {number} scaleX Transform scale from world coordinate position to UV u coordinate, minus offsetX
|
|
60
|
-
* @param {number} scaleY Transform scale from world coordinate position to UV v coordinate, minus offsetY
|
|
61
|
-
*/
|
|
62
|
-
setUvTransform(offsetX, offsetY, scaleX, scaleY) {
|
|
63
|
-
assert.isNumber(offsetX, 'offsetX');
|
|
64
|
-
assert.notNaN(offsetX, 'offsetX');
|
|
65
|
-
assert.ok(isValueBetweenInclusive(offsetX, 0, 1), `expected offsetX to be between 0 and 1, instead was '${offsetX}'`);
|
|
66
|
-
|
|
67
|
-
assert.isNumber(offsetY, 'offsetY');
|
|
68
|
-
assert.notNaN(offsetY, 'offsetY');
|
|
69
|
-
assert.ok(isValueBetweenInclusive(offsetY, 0, 1), `expected offsetY to be between 0 and 1, instead was '${offsetY}'`);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
assert.isNumber(scaleX, 'scaleX');
|
|
73
|
-
assert.notNaN(scaleX, 'scaleX');
|
|
74
|
-
assert.
|
|
75
|
-
|
|
76
|
-
assert.isNumber(scaleY, 'scaleY');
|
|
77
|
-
assert.notNaN(scaleY, 'scaleY');
|
|
78
|
-
assert.
|
|
79
|
-
|
|
80
|
-
this.material.uniforms.uFogUvTransform.value.set(offsetX, offsetY, scaleX, scaleY);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
*
|
|
85
|
-
* @param {Texture} texture
|
|
86
|
-
*/
|
|
87
|
-
setDepthBuffer(texture) {
|
|
88
|
-
// assert.equal(texture.type, UnsignedShortType, `expected texture type to be UnsignedShort(=${UnsignedShortType}), instead got something else (=${texture.type})`)
|
|
89
|
-
|
|
90
|
-
this.material.uniforms.tDepth.value = texture;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
*
|
|
95
|
-
* @param {Texture} buffer
|
|
96
|
-
*/
|
|
97
|
-
setFogBuffer(buffer) {
|
|
98
|
-
this.material.uniforms.tFog.value = buffer;
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Resolution of the fog texture
|
|
104
|
-
* @param {number} x
|
|
105
|
-
* @param {number} y
|
|
106
|
-
*/
|
|
107
|
-
setResolution(x, y) {
|
|
108
|
-
this.material.uniforms.uResolution.value.set(x, y);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
*
|
|
113
|
-
* @param {Vector4} color
|
|
114
|
-
*/
|
|
115
|
-
setFogColor(color) {
|
|
116
|
-
this.material.uniforms.uColor.value.copy(color);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
*
|
|
121
|
-
* @param {WebGLRenderer} renderer
|
|
122
|
-
* @param {PerspectiveCamera|OrthographicCamera} camera
|
|
123
|
-
* @param {Scene} scene
|
|
124
|
-
* @param {WebGLRenderTarget} target
|
|
125
|
-
*/
|
|
126
|
-
render(renderer, camera, scene, target) {
|
|
127
|
-
assert.ok(camera.isCamera, 'Not a camera');
|
|
128
|
-
assert.ok(camera.isPerspectiveCamera || camera.isOrthographicCamera, 'Unsupported Camera type. Expected PerspectiveCamera or OrthographicCamera');
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
//set up uniforms
|
|
132
|
-
const uniforms = this.material.uniforms;
|
|
133
|
-
|
|
134
|
-
uniforms.uProjectionInverse.value.copy(camera.projectionMatrixInverse);
|
|
135
|
-
uniforms.uViewInverse.value.copy(camera.matrixWorld);
|
|
136
|
-
|
|
137
|
-
renderer.setRenderTarget(target);
|
|
138
|
-
renderer.clearColor();
|
|
139
|
-
|
|
140
|
-
renderer.render(this.scene, this.camera);
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
renderer.setRenderTarget(null);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
1
|
+
import { Mesh, OrthographicCamera, Scene } from "three";
|
|
2
|
+
import { assert } from "../../../../core/assert.js";
|
|
3
|
+
import { isValueBetweenInclusive } from "../../../../core/math/interval/isValueBetweenInclusive.js";
|
|
4
|
+
import { FULL_SCREEN_TRIANGLE_GEOMETRY } from "../../../graphics/geometry/FULL_SCREEN_TRIANGLE_GEOMETRY.js";
|
|
5
|
+
import { buildScreenSpaceFogOfWarShader } from "./screenSpaceFogOfWarShader.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {FogOfWar} fow
|
|
10
|
+
* @param {function(number, number, number, number)} callback
|
|
11
|
+
*/
|
|
12
|
+
export function computeUvTransformFromFogOfWar(fow, callback) {
|
|
13
|
+
|
|
14
|
+
const sampler = fow.sampler;
|
|
15
|
+
|
|
16
|
+
const samplerWidth = sampler.width;
|
|
17
|
+
const samplerHeight = sampler.height;
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
const scaleX = (fow.scale * fow.size.x) * (samplerWidth / (samplerWidth - 3));
|
|
21
|
+
const scaleY = (fow.scale * fow.size.y) * (samplerHeight / (samplerHeight - 3));
|
|
22
|
+
|
|
23
|
+
const offsetX = 1.5 / samplerWidth;
|
|
24
|
+
const offsetY = 1.5 / samplerHeight;
|
|
25
|
+
|
|
26
|
+
callback(offsetX, offsetY, 1 / scaleX, 1 / scaleY);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export class FogOfWarRenderer {
|
|
30
|
+
constructor() {
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @type {ShaderMaterial}
|
|
34
|
+
*/
|
|
35
|
+
this.material = buildScreenSpaceFogOfWarShader();
|
|
36
|
+
|
|
37
|
+
this.quad = new Mesh(FULL_SCREEN_TRIANGLE_GEOMETRY, this.material);
|
|
38
|
+
|
|
39
|
+
this.camera = new OrthographicCamera(-1, 1, 1, -1, 0, 1);
|
|
40
|
+
this.scene = new Scene();
|
|
41
|
+
this.scene.add(this.quad);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @param {FogOfWar} fow
|
|
47
|
+
*/
|
|
48
|
+
setUvTransformFromFog(fow) {
|
|
49
|
+
computeUvTransformFromFogOfWar(fow, (offsetX, offsetY, scaleX, scaleY) => {
|
|
50
|
+
|
|
51
|
+
this.setUvTransform(offsetX, offsetY, scaleX, scaleY);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
* @param {number} offsetX UV u offset, between 0 and 1
|
|
58
|
+
* @param {number} offsetY UV v offset, between 0 and 1
|
|
59
|
+
* @param {number} scaleX Transform scale from world coordinate position to UV u coordinate, minus offsetX
|
|
60
|
+
* @param {number} scaleY Transform scale from world coordinate position to UV v coordinate, minus offsetY
|
|
61
|
+
*/
|
|
62
|
+
setUvTransform(offsetX, offsetY, scaleX, scaleY) {
|
|
63
|
+
assert.isNumber(offsetX, 'offsetX');
|
|
64
|
+
assert.notNaN(offsetX, 'offsetX');
|
|
65
|
+
assert.ok(isValueBetweenInclusive(offsetX, 0, 1), `expected offsetX to be between 0 and 1, instead was '${offsetX}'`);
|
|
66
|
+
|
|
67
|
+
assert.isNumber(offsetY, 'offsetY');
|
|
68
|
+
assert.notNaN(offsetY, 'offsetY');
|
|
69
|
+
assert.ok(isValueBetweenInclusive(offsetY, 0, 1), `expected offsetY to be between 0 and 1, instead was '${offsetY}'`);
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
assert.isNumber(scaleX, 'scaleX');
|
|
73
|
+
assert.notNaN(scaleX, 'scaleX');
|
|
74
|
+
assert.isFinite(scaleX, 'scaleX');
|
|
75
|
+
|
|
76
|
+
assert.isNumber(scaleY, 'scaleY');
|
|
77
|
+
assert.notNaN(scaleY, 'scaleY');
|
|
78
|
+
assert.isFinite(scaleY, 'scaleY');
|
|
79
|
+
|
|
80
|
+
this.material.uniforms.uFogUvTransform.value.set(offsetX, offsetY, scaleX, scaleY);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
*
|
|
85
|
+
* @param {Texture} texture
|
|
86
|
+
*/
|
|
87
|
+
setDepthBuffer(texture) {
|
|
88
|
+
// assert.equal(texture.type, UnsignedShortType, `expected texture type to be UnsignedShort(=${UnsignedShortType}), instead got something else (=${texture.type})`)
|
|
89
|
+
|
|
90
|
+
this.material.uniforms.tDepth.value = texture;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
*
|
|
95
|
+
* @param {Texture} buffer
|
|
96
|
+
*/
|
|
97
|
+
setFogBuffer(buffer) {
|
|
98
|
+
this.material.uniforms.tFog.value = buffer;
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Resolution of the fog texture
|
|
104
|
+
* @param {number} x
|
|
105
|
+
* @param {number} y
|
|
106
|
+
*/
|
|
107
|
+
setResolution(x, y) {
|
|
108
|
+
this.material.uniforms.uResolution.value.set(x, y);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
*
|
|
113
|
+
* @param {Vector4} color
|
|
114
|
+
*/
|
|
115
|
+
setFogColor(color) {
|
|
116
|
+
this.material.uniforms.uColor.value.copy(color);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
*
|
|
121
|
+
* @param {WebGLRenderer} renderer
|
|
122
|
+
* @param {PerspectiveCamera|OrthographicCamera} camera
|
|
123
|
+
* @param {Scene} scene
|
|
124
|
+
* @param {WebGLRenderTarget} target
|
|
125
|
+
*/
|
|
126
|
+
render(renderer, camera, scene, target) {
|
|
127
|
+
assert.ok(camera.isCamera, 'Not a camera');
|
|
128
|
+
assert.ok(camera.isPerspectiveCamera || camera.isOrthographicCamera, 'Unsupported Camera type. Expected PerspectiveCamera or OrthographicCamera');
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
//set up uniforms
|
|
132
|
+
const uniforms = this.material.uniforms;
|
|
133
|
+
|
|
134
|
+
uniforms.uProjectionInverse.value.copy(camera.projectionMatrixInverse);
|
|
135
|
+
uniforms.uViewInverse.value.copy(camera.matrixWorld);
|
|
136
|
+
|
|
137
|
+
renderer.setRenderTarget(target);
|
|
138
|
+
renderer.clearColor();
|
|
139
|
+
|
|
140
|
+
renderer.render(this.scene, this.camera);
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
renderer.setRenderTarget(null);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -217,7 +217,7 @@ function setElementPosition(view, bounds, viewportSize, vp) {
|
|
|
217
217
|
|
|
218
218
|
stickFlag = true;
|
|
219
219
|
} else if (bounds.x1 > stickyBounds.x1) {
|
|
220
|
-
x = stickyBounds.x1 - bounds.
|
|
220
|
+
x = stickyBounds.x1 - bounds.width;
|
|
221
221
|
|
|
222
222
|
stickFlag = true;
|
|
223
223
|
} else {
|
|
@@ -229,7 +229,7 @@ function setElementPosition(view, bounds, viewportSize, vp) {
|
|
|
229
229
|
|
|
230
230
|
stickFlag = true;
|
|
231
231
|
} else if (bounds.y1 > stickyBounds.y1) {
|
|
232
|
-
y = stickyBounds.y1 - bounds.
|
|
232
|
+
y = stickyBounds.y1 - bounds.height;
|
|
233
233
|
|
|
234
234
|
stickFlag = true;
|
|
235
235
|
} else {
|
|
@@ -219,16 +219,6 @@ export class Transform {
|
|
|
219
219
|
* }
|
|
220
220
|
*/
|
|
221
221
|
readonly isTransform: boolean;
|
|
222
|
-
/**
|
|
223
|
-
* @readonly
|
|
224
|
-
* @deprecated use {@link Transform.prototype.toMatrix} instead
|
|
225
|
-
*/
|
|
226
|
-
readonly toMatrix4: (result?: number[] | Float32Array) => number[];
|
|
227
|
-
/**
|
|
228
|
-
* @readonly
|
|
229
|
-
* @deprecated use {@link Transform.prototype.fromMatrix} instead
|
|
230
|
-
*/
|
|
231
|
-
readonly fromMatrix4: (matrix: mat4 | number[] | Float32Array) => this;
|
|
232
222
|
#private;
|
|
233
223
|
}
|
|
234
224
|
export namespace Transform {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transform.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/transform/Transform.js"],"names":[],"mappings":"AAsBA;;;;;;;;;;;GAWG;AACH;IAsRI;;;;OAIG;IACH,4BAFa,SAAS,CAQrB;IAED;;;;OAIG;IACH,uBAHW,MAAM,EAAE,GAAC,YAAY,GACnB,SAAS,CAQrB;IA0FD;;;;;OAKG;IACH,wCAJW,UAAU,gBACV,OAAO,wBAejB;IAxZD;;;OAGG;IACH,mBAHU,OAAO,CAGe;IAEhC;;;;;OAKG;IACH,mBAHU,UAAU,CAGkB;IAEtC;;;OAGG;IACH,gBAHU,OAAO,CAGY;IAE7B;;;;;;;;OAQG;IACH,iBAFU,YAAY,CAEC;IAEvB;;;;OAIG;IACH,OAFU,MAAM,CAEM;IAStB;;;;OAIG;IACH,uBAMC;IAED;;;OAGG;IACH,kBAMC;IAED;;;OAGG;IACH,qBAMC;IAED;;;;OAIG;IACH,kDAIC;IAED;;;;OAIG;IACH,oDAIC;IAYD;;;;OAIG;IACH,cAHW,MAAM,GAAC,cAAc,GACnB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,cAAc,GACnB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,cAAc,SACrB,OAAO,QAQjB;IAED;;;;OAIG;IACH,cAHW,MAAM,GAAC,cAAc,GACnB,OAAO,CAInB;IAED;;;;OAIG;IACH,qBAEC;IAED;;;;OAIG;IACH,eAHW,OAAO,OACP,OAAO,QAqBjB;IAED,0BAwBC;IAED;;;;;;;;;;;;;;;;;MAMC;IAED;;;;;OAKG;IACH,YAFW,SAAS,QAenB;IAED;;;OAGG;IACH,SAFa,SAAS,CAQrB;IAED;;;;OAIG;IACH,cAHW,SAAS,GACP,OAAO,CAMnB;IAED;;;OAGG;IACH,QAFa,MAAM,CAKlB;IA4BD;;;;;;OAMG;IACH,gBAHW,SAAS,GACP,IAAI,CAIhB;IAED;;;;;OAKG;IACH,sBAJW,SAAS,KACT,SAAS,GACP,IAAI,CAWhB;IAED;;;;OAIG;IACH,mBAHW,OAAK,MAAM,EAAE,GAAC,YAAY,GACxB,IAAI,CAmBhB;IAED;;;;OAIG;IACH,kBAHW,MAAM,EAAE,GAAC,YAAY,GACnB,MAAM,EAAE,CAOpB;IAED;;;;;OAKG;IACH,qBAEC;IAED;;;OAGG;IACH,cAFa,OAAO,CAMnB;IAED,mBAEC;IA6BL;;;;;;;;OAQG;IACH,sBANU,OAAO,CAMc
|
|
1
|
+
{"version":3,"file":"Transform.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/transform/Transform.js"],"names":[],"mappings":"AAsBA;;;;;;;;;;;GAWG;AACH;IAsRI;;;;OAIG;IACH,4BAFa,SAAS,CAQrB;IAED;;;;OAIG;IACH,uBAHW,MAAM,EAAE,GAAC,YAAY,GACnB,SAAS,CAQrB;IA0FD;;;;;OAKG;IACH,wCAJW,UAAU,gBACV,OAAO,wBAejB;IAxZD;;;OAGG;IACH,mBAHU,OAAO,CAGe;IAEhC;;;;;OAKG;IACH,mBAHU,UAAU,CAGkB;IAEtC;;;OAGG;IACH,gBAHU,OAAO,CAGY;IAE7B;;;;;;;;OAQG;IACH,iBAFU,YAAY,CAEC;IAEvB;;;;OAIG;IACH,OAFU,MAAM,CAEM;IAStB;;;;OAIG;IACH,uBAMC;IAED;;;OAGG;IACH,kBAMC;IAED;;;OAGG;IACH,qBAMC;IAED;;;;OAIG;IACH,kDAIC;IAED;;;;OAIG;IACH,oDAIC;IAYD;;;;OAIG;IACH,cAHW,MAAM,GAAC,cAAc,GACnB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,cAAc,GACnB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,cAAc,SACrB,OAAO,QAQjB;IAED;;;;OAIG;IACH,cAHW,MAAM,GAAC,cAAc,GACnB,OAAO,CAInB;IAED;;;;OAIG;IACH,qBAEC;IAED;;;;OAIG;IACH,eAHW,OAAO,OACP,OAAO,QAqBjB;IAED,0BAwBC;IAED;;;;;;;;;;;;;;;;;MAMC;IAED;;;;;OAKG;IACH,YAFW,SAAS,QAenB;IAED;;;OAGG;IACH,SAFa,SAAS,CAQrB;IAED;;;;OAIG;IACH,cAHW,SAAS,GACP,OAAO,CAMnB;IAED;;;OAGG;IACH,QAFa,MAAM,CAKlB;IA4BD;;;;;;OAMG;IACH,gBAHW,SAAS,GACP,IAAI,CAIhB;IAED;;;;;OAKG;IACH,sBAJW,SAAS,KACT,SAAS,GACP,IAAI,CAWhB;IAED;;;;OAIG;IACH,mBAHW,OAAK,MAAM,EAAE,GAAC,YAAY,GACxB,IAAI,CAmBhB;IAED;;;;OAIG;IACH,kBAHW,MAAM,EAAE,GAAC,YAAY,GACnB,MAAM,EAAE,CAOpB;IAED;;;;;OAKG;IACH,qBAEC;IAED;;;OAGG;IACH,cAFa,OAAO,CAMnB;IAED,mBAEC;IA6BL;;;;;;;;OAQG;IACH,sBANU,OAAO,CAMc;;CAjB9B;;kBAIS,MAAM;;oBA1bI,+BAA+B;uBAD5B,kCAAkC;+BAE1B,qBAAqB"}
|
|
@@ -462,17 +462,5 @@ Transform.typeName = "Transform";
|
|
|
462
462
|
*/
|
|
463
463
|
Transform.prototype.isTransform = true;
|
|
464
464
|
|
|
465
|
-
/**
|
|
466
|
-
* @readonly
|
|
467
|
-
* @deprecated use {@link Transform.prototype.toMatrix} instead
|
|
468
|
-
*/
|
|
469
|
-
Transform.prototype.toMatrix4 = Transform.prototype.toMatrix
|
|
470
|
-
|
|
471
|
-
/**
|
|
472
|
-
* @readonly
|
|
473
|
-
* @deprecated use {@link Transform.prototype.fromMatrix} instead
|
|
474
|
-
*/
|
|
475
|
-
Transform.prototype.fromMatrix4 = Transform.prototype.fromMatrix
|
|
476
|
-
|
|
477
465
|
|
|
478
466
|
|