@woosh/meep-engine 2.75.7 → 2.75.9
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 +1052 -1234
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +1052 -1234
- package/editor/actions/concrete/ModifyPatchSampler2DAction.js +6 -3
- package/editor/actions/concrete/PatchTerrainTextureAction.js +6 -3
- package/editor/ecs/component/createObjectEditor.js +2 -2
- package/editor/process/EditorProcess.js +12 -16
- package/editor/process/ProcessEngine.js +9 -10
- package/package.json +1 -1
- package/src/core/binary/dec2hex.js +1 -1
- package/src/{engine/ecs/ik/IKMath.js → core/geom/vec3/v3_computeOffsetVector.js} +1 -1
- package/src/core/math/newton_solver_1d.js +13 -4
- package/src/core/math/solveQuadratic.js +5 -3
- package/src/core/math/spline/catmull_rom_compute_T.js +19 -0
- package/src/{engine/navigation/ecs/components → core/math/spline}/computeCatmullRomSpline.js +3 -3
- package/src/{engine/navigation/ecs/components → core/math/spline}/computeCatmullRomSplineUniformDistance.js +3 -3
- package/src/core/math/spline/computeNonuniformCatmullRomSplineSample.js +109 -0
- package/src/core/math/spline/interpolate_bicubic.js +12 -0
- package/src/core/math/spline/spline_catmullrom_1d.js +120 -0
- package/src/core/model/object/ImmutableObjectPool.js +14 -5
- package/src/engine/control/ControlContext.js +25 -27
- package/src/engine/ecs/EntityManager.js +12 -9
- package/src/engine/ecs/EntityObserver.js +26 -22
- package/src/engine/ecs/binding/ComponentPropertyPath.js +12 -12
- package/src/engine/ecs/components/Motion.js +5 -7
- package/src/engine/ecs/components/SerializationMetadata.js +5 -3
- package/src/engine/ecs/dynamic_actions/actions/definition/AbstractActionDescription.js +0 -2
- package/src/engine/ecs/dynamic_actions/actions/definition/ActionSequenceDescription.js +7 -9
- package/src/engine/ecs/dynamic_actions/actions/definition/DelayActionDescription.js +3 -5
- package/src/engine/ecs/dynamic_actions/actions/definition/SendRequestActionDescription.js +6 -8
- package/src/engine/ecs/dynamic_actions/actions/definition/SpeakLineActionDescription.js +14 -17
- package/src/engine/ecs/dynamic_actions/actions/definition/WeightedRandomActionDescription.js +8 -11
- package/src/engine/ecs/dynamic_actions/actions/definition/WriteToBlackboardActionDescription.js +15 -18
- package/src/engine/ecs/ik/OneBoneSurfaceAlignmentSolver.js +7 -7
- package/src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.js +6 -6
- package/src/engine/ecs/parent/EntityNode.js +39 -37
- package/src/engine/ecs/speaker/VoiceSystem.js +36 -39
- package/src/engine/ecs/storage/BinaryBufferDeSerializer.js +7 -9
- package/src/engine/ecs/storage/BinaryBufferSerializer.js +15 -16
- package/src/engine/ecs/storage/binary/BinaryClassUpgrader.js +10 -59
- package/src/engine/ecs/storage/binary/BinarySerializationRegistry.js +14 -15
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionDeSerializer.js +3 -3
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js +60 -62
- package/src/engine/ecs/storage/binary/executeBinaryClassUpgraderChain.js +46 -0
- package/src/engine/ecs/storage/binary/object/BinaryObjectSerializationAdapter.js +2 -2
- package/src/engine/ecs/system/SystemEntityContext.js +25 -23
- package/src/engine/ecs/tag/find_entities_with_tag.js +18 -0
- package/src/engine/ecs/terrain/TerrainClouds.js +23 -24
- package/src/engine/ecs/terrain/ecs/layers/TerrainLayer.js +37 -31
- package/src/engine/ecs/terrain/ecs/layers/TerrainLayers.js +8 -7
- package/src/engine/ecs/terrain/ecs/splat/SplatMapMaterialPatch.js +5 -2
- package/src/engine/ecs/terrain/overlay/TerrainOverlay.js +15 -14
- package/src/engine/ecs/tooltip/TooltipComponent.js +6 -7
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +0 -4
- package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +1 -5
- package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +2 -6
- package/src/engine/graphics/ecs/water2/shader/testWaterShader.js +12 -14
- package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +22 -20
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +3 -4
- package/src/engine/graphics/render/RendererPool.js +36 -40
- package/src/engine/graphics/render/buffer/FrameBuffer.js +25 -24
- package/src/engine/graphics/render/buffer/RenderGraph.js +21 -21
- package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +0 -4
- package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +1 -5
- package/src/engine/graphics/render/frame_graph/IRenderContext.js +31 -1
- package/src/engine/graphics/render/frame_graph/RenderGraph.js +5 -5
- package/src/engine/graphics/render/frame_graph/RenderTarget.js +9 -0
- package/src/engine/graphics/render/frame_graph/RenderTextureManager.js +57 -0
- package/src/engine/graphics/render/frame_graph/ResourceEntry.js +7 -5
- package/src/engine/graphics/render/frame_graph/TextureDescriptor.js +48 -33
- package/src/engine/graphics/render/frame_graph/TextureInitialState.js +14 -0
- package/src/engine/graphics/render/frame_graph/sample/deferred/CopyPass.js +20 -0
- package/src/engine/graphics/render/frame_graph/sample/deferred/LightingPass.js +4 -0
- package/src/engine/graphics/render/frame_graph/sample/deferred/run.js +34 -6
- package/src/engine/graphics/render/frame_graph/webgl/WebGLRenderContext.js +34 -0
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +3 -6
- package/src/engine/graphics/sh3/gi/prototypeSHGI.js +92 -0
- package/src/engine/graphics/shadows/testShadowMapRendering.js +0 -2
- package/src/engine/graphics/texture/atlas/TextureAtlas.js +13 -11
- package/src/engine/graphics/texture/sampler/Sampler2D.js +15 -366
- package/src/engine/graphics/texture/sampler/Sampler2D.spec.js +0 -31
- package/src/engine/graphics/texture/sampler/sampler2d_copy_with_margins.js +166 -0
- package/src/engine/graphics/texture/sampler/sampler2d_copy_with_margins.spec.js +31 -0
- package/src/engine/graphics/texture/sampler/sampler2d_paint.js +81 -0
- package/src/engine/graphics/texture/sampler/sampler2d_sub_copy_same_item_size.js +50 -0
- package/src/engine/graphics/texture/virtual/{v2/VirtualTextureMemoryMapping.js → VirtualTextureMemoryMapping.js} +2 -26
- package/src/engine/graphics/texture/virtual/{v2/VirtualTexturePage.js → VirtualTexturePage.js} +10 -10
- package/src/engine/graphics/texture/virtual/{v2/VirtualTextureTileLoader.js → VirtualTextureTileLoader.js} +7 -7
- package/src/engine/graphics/texture/virtual/{v2/VirtualTextureUsage.js → VirtualTextureUsage.js} +1 -1
- package/src/engine/graphics/texture/virtual/{v2/VirtualTextureUsageUpdater.js → VirtualTextureUsageUpdater.js} +7 -7
- package/src/engine/graphics/texture/virtual/{v2/debug → debug}/ResidencyDebugView.js +4 -4
- package/src/engine/graphics/texture/virtual/{v2/debug → debug}/UsageDebugView.js +2 -2
- package/src/engine/graphics/texture/virtual/{v2/debug → debug}/UsagePyramidDebugView.js +4 -4
- package/src/engine/graphics/texture/virtual/{v2/prototype.js → prototype.js} +7 -7
- package/src/engine/graphics/texture/virtual/{v2/tile → tile}/compose_finger_print.js +1 -1
- package/src/engine/graphics/texture/virtual/{v2/tile → tile}/compose_tile_address.js +2 -2
- package/src/engine/graphics/texture/virtual/{v2/tile → tile}/tile_address_to_finger_print.js +1 -1
- package/src/engine/navigation/ecs/components/Path.js +10 -9
- package/src/engine/physics/computeInterceptPoint.js +44 -0
- package/src/engine/plugin/EnginePlugin.js +1 -2
- package/src/engine/ecs/components/AlignToVelocity.js +0 -9
- package/src/engine/ecs/components/CharacterController.js +0 -31
- package/src/engine/ecs/components/PhysicalBody.js +0 -51
- package/src/engine/ecs/components/Steering.js +0 -111
- package/src/engine/ecs/components/SteeringSerializationAdapter.js +0 -34
- package/src/engine/ecs/storage/json/Blueprint.js +0 -129
- package/src/engine/ecs/storage/json/EntityFactory.js +0 -207
- package/src/engine/ecs/storage/json/JSONDeSerializer.js +0 -148
- package/src/engine/ecs/storage/json/JSONSerializer.js +0 -132
- package/src/engine/ecs/storage/json/README.md +0 -5
- package/src/engine/ecs/systems/AlignToVelocitySystem.js +0 -51
- package/src/engine/ecs/systems/CharacterControlSystem.js +0 -134
- package/src/engine/ecs/systems/PhysicsSystem.js +0 -89
- package/src/engine/ecs/systems/PropertySetSystem.js +0 -18
- package/src/engine/ecs/systems/SteeringSystem.js +0 -171
- package/src/engine/ecs/systems/TagSystem.d.ts +0 -5
- package/src/engine/ecs/systems/TagSystem.js +0 -31
- package/src/engine/graphics/render/webgpu/sample/MeshInstance.js +0 -108
- package/src/engine/graphics/render/webgpu/sample/fragmentDeferredRendering.wgsl +0 -71
- package/src/engine/graphics/render/webgpu/sample/fragmentGBuffersDebugView.wgsl +0 -39
- package/src/engine/graphics/render/webgpu/sample/fragmentWriteGBuffers.wgsl +0 -21
- package/src/engine/graphics/render/webgpu/sample/lightUpdate.wgsl +0 -41
- package/src/engine/graphics/render/webgpu/sample/main.js +0 -605
- package/src/engine/graphics/render/webgpu/sample/vertexTextureQuad.wgsl +0 -9
- package/src/engine/graphics/render/webgpu/sample/vertexWriteGBuffers.wgsl +0 -30
- package/src/engine/graphics/texture/sampler/bicubic.js +0 -59
- package/src/engine/graphics/texture/sampler/bicubic.spec.js +0 -13
- package/src/engine/graphics/texture/virtual/TileOperation.js +0 -13
- package/src/engine/graphics/texture/virtual/TileTree.js +0 -150
- package/src/engine/graphics/texture/virtual/TileTree.spec.js +0 -58
- package/src/engine/graphics/texture/virtual/TileUsage.js +0 -137
- package/src/engine/graphics/texture/virtual/VirtualTexture.js +0 -238
- package/src/engine/graphics/texture/virtual/VirtualTexture.spec.js +0 -39
- package/src/engine/graphics/texture/virtual/page/TilePage.js +0 -148
- package/src/engine/graphics/texture/virtual/page/TilePageSlot.js +0 -36
- package/src/engine/graphics/texture/virtual/tile/Tile.js +0 -44
- package/src/engine/graphics/texture/virtual/tile/Tile.spec.js +0 -11
- package/src/engine/graphics/texture/virtual/tile/TileAddress.js +0 -63
- package/src/engine/graphics/texture/virtual/tile/TileAddress.spec.js +0 -30
- package/src/engine/graphics/texture/virtual/tile/TileLoader.js +0 -178
- package/src/engine/graphics/texture/virtual/tile/TileRequest.js +0 -40
- package/src/engine/graphics/texture/virtual/tile/TileStatus.js +0 -10
- package/src/engine/navigation/ecs/components/computeNonuniformCatmullRomSplineSample.js +0 -242
- /package/src/engine/graphics/texture/virtual/{v2/NOTES.md → NOTES.md} +0 -0
- /package/src/engine/graphics/texture/virtual/{v2/VirtualTextureMaterial.js → VirtualTextureMaterial.js} +0 -0
- /package/src/engine/graphics/texture/virtual/{v2/VirtualTextureUsageShader.js → VirtualTextureUsageShader.js} +0 -0
- /package/src/engine/graphics/texture/virtual/{v2/tile → tile}/VirtualTextureTile.js +0 -0
- /package/src/engine/graphics/texture/virtual/{v2/tile → tile}/decompose_finger_print.js +0 -0
- /package/src/engine/graphics/texture/virtual/{v2/tile → tile}/finger_print_to_tile_address.js +0 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { BlendingType } from "./BlendingType.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {number[]} source
|
|
6
|
+
* @param {number[]} destination
|
|
7
|
+
* @param {Array} result
|
|
8
|
+
*/
|
|
9
|
+
function blendFunctionNormal(source, destination, result) {
|
|
10
|
+
|
|
11
|
+
const a1 = source[3] / 255;
|
|
12
|
+
const a0 = destination[3] / 255;
|
|
13
|
+
|
|
14
|
+
result[0] = source[0] * a1 + destination[0] * (1 - a1);
|
|
15
|
+
result[1] = source[1] * a1 + destination[1] * (1 - a1);
|
|
16
|
+
result[2] = source[2] * a1 + destination[2] * (1 - a1);
|
|
17
|
+
result[3] = (a1 + a0 * (1 - a1)) * 255;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Assumes both samplers are RGBA uint8 with values 0-255
|
|
22
|
+
* @param {Sampler2D} destination
|
|
23
|
+
* @param {Sampler2D} source
|
|
24
|
+
* @param {number} sourceX
|
|
25
|
+
* @param {number} sourceY
|
|
26
|
+
* @param {number} destinationX
|
|
27
|
+
* @param {number} destinationY
|
|
28
|
+
* @param {number} width
|
|
29
|
+
* @param {number} height
|
|
30
|
+
* @param {BlendingType} [blendMode]
|
|
31
|
+
*/
|
|
32
|
+
export function sampler2d_paint(
|
|
33
|
+
destination,
|
|
34
|
+
source,
|
|
35
|
+
sourceX, sourceY,
|
|
36
|
+
destinationX, destinationY,
|
|
37
|
+
width, height,
|
|
38
|
+
blendMode = BlendingType.Normal
|
|
39
|
+
) {
|
|
40
|
+
|
|
41
|
+
let blendFunction;
|
|
42
|
+
if (blendMode === BlendingType.Normal) {
|
|
43
|
+
blendFunction = blendFunctionNormal;
|
|
44
|
+
} else {
|
|
45
|
+
throw new Error(`Unsupported blendType(=${blendMode})`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const _w = Math.min(width, source.width - sourceX, destination.width - destinationX);
|
|
49
|
+
const _h = Math.min(height, source.height - sourceY, destination.height - destinationY);
|
|
50
|
+
|
|
51
|
+
const _x0 = Math.max(0, -destinationX);
|
|
52
|
+
const _y0 = Math.max(0, -destinationY);
|
|
53
|
+
|
|
54
|
+
const c0 = [0, 0, 0, 255];
|
|
55
|
+
const c1 = [0, 0, 0, 255];
|
|
56
|
+
|
|
57
|
+
const c3 = [];
|
|
58
|
+
|
|
59
|
+
let x, y;
|
|
60
|
+
|
|
61
|
+
for (y = _y0; y < _h; y++) {
|
|
62
|
+
for (x = _x0; x < _w; x++) {
|
|
63
|
+
const d_x = Math.round(x + destinationX);
|
|
64
|
+
const d_y = Math.round(y + destinationY);
|
|
65
|
+
|
|
66
|
+
destination.read(d_x, d_y, c0);
|
|
67
|
+
|
|
68
|
+
const s_x = Math.round(x + sourceY);
|
|
69
|
+
const s_y = Math.round(y + sourceY);
|
|
70
|
+
|
|
71
|
+
source.read(s_x, s_y, c1);
|
|
72
|
+
|
|
73
|
+
blendFunction(c1, c0, c3);
|
|
74
|
+
|
|
75
|
+
destination.set(d_x, d_y, c3);
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Copy a patch from another sampler with the same itemSize
|
|
5
|
+
* @param {Sampler2D} destination
|
|
6
|
+
* @param {Sampler2D} source where to copy from
|
|
7
|
+
* @param {Number} sourceX where to start reading from, X coordinate
|
|
8
|
+
* @param {Number} sourceY where to start reading from, X coordinate
|
|
9
|
+
* @param {Number} destinationX where to start writing to, X coordinate
|
|
10
|
+
* @param {Number} destinationY where to start writing to, X coordinate
|
|
11
|
+
* @param {Number} width size of the patch that is to be copied
|
|
12
|
+
* @param {Number} height size of the patch that is to be copied
|
|
13
|
+
*/
|
|
14
|
+
export function sampler2d_sub_copy_same_item_size(destination, source, sourceX, sourceY, destinationX, destinationY, width, height) {
|
|
15
|
+
const itemSize = destination.itemSize;
|
|
16
|
+
const sItemSize = source.itemSize;
|
|
17
|
+
|
|
18
|
+
assert.equal(sItemSize, sItemSize, `source.itemSize(=${sItemSize}) != destination.itemSize(=${itemSize})`);
|
|
19
|
+
|
|
20
|
+
const _w = Math.min(width, source.width - sourceX, destination.width - destinationX);
|
|
21
|
+
const _h = Math.min(height, source.height - sourceY, destination.height - destinationY);
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
const dRowSize = itemSize * destination.width;
|
|
25
|
+
const sRowSize = itemSize * source.width;
|
|
26
|
+
|
|
27
|
+
const sData = source.data;
|
|
28
|
+
const dData = destination.data;
|
|
29
|
+
|
|
30
|
+
const patchRowSize = _w * itemSize;
|
|
31
|
+
|
|
32
|
+
let y, i;
|
|
33
|
+
|
|
34
|
+
for (y = 0; y < _h; y++) {
|
|
35
|
+
const dA = (y + destinationY) * dRowSize;
|
|
36
|
+
const sA = (y + sourceY) * sRowSize;
|
|
37
|
+
|
|
38
|
+
const dOffset = dA + destinationX * itemSize;
|
|
39
|
+
const sOffset = sA + sourceX * itemSize;
|
|
40
|
+
|
|
41
|
+
for (i = 0; i < patchRowSize; i++) {
|
|
42
|
+
|
|
43
|
+
dData[dOffset + i] = sData[sOffset + i];
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// update destination version
|
|
49
|
+
destination.version++;
|
|
50
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClampToEdgeWrapping, DataTexture, NearestFilter, RedIntegerFormat, UnsignedIntType } from "three";
|
|
2
|
-
import { assert } from "
|
|
3
|
-
import { UINT32_MAX } from "
|
|
2
|
+
import { assert } from "../../../../core/assert.js";
|
|
3
|
+
import { UINT32_MAX } from "../../../../core/binary/UINT32_MAX.js";
|
|
4
4
|
import { compose_tile_address } from "./tile/compose_tile_address.js";
|
|
5
5
|
import { decompose_finger_print } from "./tile/decompose_finger_print.js";
|
|
6
6
|
|
|
@@ -51,8 +51,6 @@ export class VirtualTextureMemoryMapping {
|
|
|
51
51
|
|
|
52
52
|
texture.magFilter = NearestFilter;
|
|
53
53
|
texture.minFilter = NearestFilter;
|
|
54
|
-
// texture.minFilter = NearestMipMapNearestFilter;
|
|
55
|
-
// texture.magFilter = NearestMipMapNearestFilter;
|
|
56
54
|
}
|
|
57
55
|
|
|
58
56
|
/**
|
|
@@ -91,28 +89,6 @@ export class VirtualTextureMemoryMapping {
|
|
|
91
89
|
texture.image.width = texture_dimension;
|
|
92
90
|
texture.image.height = texture_dimension;
|
|
93
91
|
|
|
94
|
-
// texture.mipmaps.splice(0, texture.mipmaps.length);
|
|
95
|
-
// let buffer_offset = 0;
|
|
96
|
-
// for (let mip_level = 0; mip_level <= max_mip_level; mip_level++) {
|
|
97
|
-
// const mip_resolution = 1 << mip_level;
|
|
98
|
-
//
|
|
99
|
-
// const texel_count = mip_resolution * mip_resolution;
|
|
100
|
-
// texture.mipmaps[mip_level] = {
|
|
101
|
-
// data: new Uint32Array(arrayBuffer, buffer_offset, texel_count),
|
|
102
|
-
// width: mip_resolution,
|
|
103
|
-
// height: mip_resolution
|
|
104
|
-
// };
|
|
105
|
-
//
|
|
106
|
-
// buffer_offset += texel_count * 4;
|
|
107
|
-
// }
|
|
108
|
-
//
|
|
109
|
-
// texture.mipmaps.reverse();
|
|
110
|
-
//
|
|
111
|
-
// const top_mip = texture.mipmaps[0];
|
|
112
|
-
// texture.image.data = top_mip.data;
|
|
113
|
-
// texture.image.width = top_mip.width;
|
|
114
|
-
// texture.image.height = top_mip.height;
|
|
115
|
-
|
|
116
92
|
texture.needsUpdate = true;
|
|
117
93
|
}
|
|
118
94
|
|
package/src/engine/graphics/texture/virtual/{v2/VirtualTexturePage.js → VirtualTexturePage.js}
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ClampToEdgeWrapping, DataTexture, LinearFilter, NearestFilter, Vector2 } from "three";
|
|
2
|
-
import { assert } from "
|
|
3
|
-
import { BitSet } from "
|
|
4
|
-
import { Cache } from "
|
|
5
|
-
import { array_copy } from "
|
|
6
|
-
import { HashMap } from "
|
|
7
|
-
import { passThrough, strictEquals } from "
|
|
8
|
-
import { max2 } from "
|
|
9
|
-
import { min2 } from "
|
|
10
|
-
import { Sampler2D } from "
|
|
11
|
-
import { writeSample2DDataToDataTexture } from "
|
|
2
|
+
import { assert } from "../../../../core/assert.js";
|
|
3
|
+
import { BitSet } from "../../../../core/binary/BitSet.js";
|
|
4
|
+
import { Cache } from "../../../../core/cache/Cache.js";
|
|
5
|
+
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
6
|
+
import { HashMap } from "../../../../core/collection/map/HashMap.js";
|
|
7
|
+
import { passThrough, strictEquals } from "../../../../core/function/Functions.js";
|
|
8
|
+
import { max2 } from "../../../../core/math/max2.js";
|
|
9
|
+
import { min2 } from "../../../../core/math/min2.js";
|
|
10
|
+
import { Sampler2D } from "../sampler/Sampler2D.js";
|
|
11
|
+
import { writeSample2DDataToDataTexture } from "../sampler/writeSampler2DDataToDataTexture.js";
|
|
12
12
|
import { tile_address_to_finger_print } from "./tile/tile_address_to_finger_print.js";
|
|
13
13
|
import { VirtualTextureTileLoader } from "./VirtualTextureTileLoader.js";
|
|
14
14
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { assert } from "
|
|
2
|
-
import { arrayQuickSort } from "
|
|
3
|
-
import Signal from "
|
|
4
|
-
import { AssetManager } from "
|
|
5
|
-
import { GameAssetType } from "
|
|
6
|
-
import { Sampler2D } from "
|
|
7
|
-
import { sampler2d_to_uint8_RGBA } from "
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
import { arrayQuickSort } from "../../../../core/collection/array/arrayQuickSort.js";
|
|
3
|
+
import Signal from "../../../../core/events/signal/Signal.js";
|
|
4
|
+
import { AssetManager } from "../../../asset/AssetManager.js";
|
|
5
|
+
import { GameAssetType } from "../../../asset/GameAssetType.js";
|
|
6
|
+
import { Sampler2D } from "../sampler/Sampler2D.js";
|
|
7
|
+
import { sampler2d_to_uint8_RGBA } from "../sampler/sampler2d_to_uint8_RGBA.js";
|
|
8
8
|
import { compose_finger_print } from "./tile/compose_finger_print.js";
|
|
9
9
|
import { decompose_finger_print } from "./tile/decompose_finger_print.js";
|
|
10
10
|
import { VirtualTextureTile } from "./tile/VirtualTextureTile.js";
|
package/src/engine/graphics/texture/virtual/{v2/VirtualTextureUsage.js → VirtualTextureUsage.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { array_quick_sort_by_comparator, arrayQuickSort } from "
|
|
1
|
+
import { array_quick_sort_by_comparator, arrayQuickSort } from "../../../../core/collection/array/arrayQuickSort.js";
|
|
2
2
|
import { compose_tile_address } from "./tile/compose_tile_address.js";
|
|
3
3
|
import { decompose_finger_print } from "./tile/decompose_finger_print.js";
|
|
4
4
|
import { finger_print_to_tile_address } from "./tile/finger_print_to_tile_address.js";
|
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
Vector4,
|
|
13
13
|
WebGLRenderTarget
|
|
14
14
|
} from "three";
|
|
15
|
-
import { assert } from "
|
|
16
|
-
import { array_copy } from "
|
|
17
|
-
import { clamp } from "
|
|
18
|
-
import { max2 } from "
|
|
19
|
-
import { generate_halton_jitter } from "
|
|
20
|
-
import { renderScreenSpace } from "
|
|
21
|
-
import { Sampler2D } from "
|
|
15
|
+
import { assert } from "../../../../core/assert.js";
|
|
16
|
+
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
17
|
+
import { clamp } from "../../../../core/math/clamp.js";
|
|
18
|
+
import { max2 } from "../../../../core/math/max2.js";
|
|
19
|
+
import { generate_halton_jitter } from "../../generate_halton_jitter.js";
|
|
20
|
+
import { renderScreenSpace } from "../../render/utils/renderScreenSpace.js";
|
|
21
|
+
import { Sampler2D } from "../sampler/Sampler2D.js";
|
|
22
22
|
import { VirtualTextureUsage } from "./VirtualTextureUsage.js";
|
|
23
23
|
import { fragment, vertex } from "./VirtualTextureUsageShader.js";
|
|
24
24
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CSS_ABSOLUTE_POSITIONING } from "
|
|
2
|
-
import { CanvasView } from "
|
|
3
|
-
import EmptyView from "
|
|
4
|
-
import { sampler2d_write_to_canvas_raw } from "
|
|
1
|
+
import { CSS_ABSOLUTE_POSITIONING } from "../../../../../view/CSS_ABSOLUTE_POSITIONING.js";
|
|
2
|
+
import { CanvasView } from "../../../../../view/elements/CanvasView.js";
|
|
3
|
+
import EmptyView from "../../../../../view/elements/EmptyView.js";
|
|
4
|
+
import { sampler2d_write_to_canvas_raw } from "../../sampler/sampler2d_write_to_canvas_raw.js";
|
|
5
5
|
|
|
6
6
|
export class ResidencyDebugView extends EmptyView {
|
|
7
7
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import LabelView from "
|
|
2
|
-
import EmptyView from "
|
|
1
|
+
import LabelView from "../../../../../view/common/LabelView.js";
|
|
2
|
+
import EmptyView from "../../../../../view/elements/EmptyView.js";
|
|
3
3
|
import { decompose_finger_print } from "../tile/decompose_finger_print.js";
|
|
4
4
|
import { tile_address_to_finger_print } from "../tile/tile_address_to_finger_print.js";
|
|
5
5
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { assert } from "
|
|
2
|
-
import LabelView from "
|
|
3
|
-
import { CSS_ABSOLUTE_POSITIONING } from "
|
|
4
|
-
import EmptyView from "
|
|
1
|
+
import { assert } from "../../../../../core/assert.js";
|
|
2
|
+
import LabelView from "../../../../../view/common/LabelView.js";
|
|
3
|
+
import { CSS_ABSOLUTE_POSITIONING } from "../../../../../view/CSS_ABSOLUTE_POSITIONING.js";
|
|
4
|
+
import EmptyView from "../../../../../view/elements/EmptyView.js";
|
|
5
5
|
import { decompose_finger_print } from "../tile/decompose_finger_print.js";
|
|
6
6
|
import { tile_address_to_finger_print } from "../tile/tile_address_to_finger_print.js";
|
|
7
7
|
|
|
@@ -11,13 +11,13 @@ import {
|
|
|
11
11
|
WebGLRenderer
|
|
12
12
|
} from "three";
|
|
13
13
|
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
|
|
14
|
-
import Signal from "
|
|
15
|
-
import { CSS_ABSOLUTE_POSITIONING } from "
|
|
16
|
-
import EmptyView from "
|
|
17
|
-
import { AssetManager } from "
|
|
18
|
-
import { GameAssetType } from "
|
|
19
|
-
import { ImageRGBADataLoader } from "
|
|
20
|
-
import { buildCanvasViewFromTexture } from "
|
|
14
|
+
import Signal from "../../../../core/events/signal/Signal.js";
|
|
15
|
+
import { CSS_ABSOLUTE_POSITIONING } from "../../../../view/CSS_ABSOLUTE_POSITIONING.js";
|
|
16
|
+
import EmptyView from "../../../../view/elements/EmptyView.js";
|
|
17
|
+
import { AssetManager } from "../../../asset/AssetManager.js";
|
|
18
|
+
import { GameAssetType } from "../../../asset/GameAssetType.js";
|
|
19
|
+
import { ImageRGBADataLoader } from "../../../asset/loaders/image/ImageRGBADataLoader.js";
|
|
20
|
+
import { buildCanvasViewFromTexture } from "../../render/visibility/hiz/buildCanvasViewFromTexture.js";
|
|
21
21
|
import { VirtualTextureMaterial } from "./VirtualTextureMaterial.js";
|
|
22
22
|
import { VirtualTextureMemoryMapping } from "./VirtualTextureMemoryMapping.js";
|
|
23
23
|
import { VirtualTexturePage } from "./VirtualTexturePage.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { assert } from "
|
|
2
|
-
import { split_by_2 } from "
|
|
1
|
+
import { assert } from "../../../../../core/assert.js";
|
|
2
|
+
import { split_by_2 } from "../../../../../core/geom/3d/morton/split_by_2.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
@@ -3,23 +3,24 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
7
|
-
|
|
8
6
|
import { CatmullRomCurve3 } from "three";
|
|
9
|
-
import { clamp } from "../../../../core/math/clamp.js";
|
|
10
7
|
import { assert } from "../../../../core/assert.js";
|
|
11
|
-
import { RowFirstTableSpec } from "../../../../core/collection/table/RowFirstTableSpec.js";
|
|
12
8
|
import { BinaryDataType } from "../../../../core/binary/type/BinaryDataType.js";
|
|
13
9
|
import { RowFirstTable } from "../../../../core/collection/table/RowFirstTable.js";
|
|
14
|
-
import {
|
|
15
|
-
import { computeNonuniformCatmullRomSplineSample } from "./computeNonuniformCatmullRomSplineSample.js";
|
|
16
|
-
import { InterpolationType } from "./InterpolationType.js";
|
|
17
|
-
import { v3_distance } from "../../../../core/geom/vec3/v3_distance.js";
|
|
10
|
+
import { RowFirstTableSpec } from "../../../../core/collection/table/RowFirstTableSpec.js";
|
|
18
11
|
import {
|
|
19
12
|
line3_computeSegmentPointDistance_sqr
|
|
20
13
|
} from "../../../../core/geom/3d/line/line3_computeSegmentPointDistance_sqr.js";
|
|
21
|
-
import {
|
|
14
|
+
import { v3_distance } from "../../../../core/geom/vec3/v3_distance.js";
|
|
15
|
+
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
16
|
+
import { clamp } from "../../../../core/math/clamp.js";
|
|
17
|
+
import { min2 } from "../../../../core/math/min2.js";
|
|
18
|
+
import {
|
|
19
|
+
computeNonuniformCatmullRomSplineSample
|
|
20
|
+
} from "../../../../core/math/spline/computeNonuniformCatmullRomSplineSample.js";
|
|
22
21
|
import { AttributeSpec } from "../../../graphics/geometry/AttributeSpec.js";
|
|
22
|
+
import { VertexDataSpec } from "../../../graphics/geometry/VertexDataSpec.js";
|
|
23
|
+
import { InterpolationType } from "./InterpolationType.js";
|
|
23
24
|
|
|
24
25
|
const v3_a = new Vector3();
|
|
25
26
|
const v3_b = new Vector3();
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { v3_dot } from "../../core/geom/vec3/v3_dot.js";
|
|
2
|
+
import { solveQuadratic } from "../../core/math/solveQuadratic.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {Vector3} result
|
|
7
|
+
* @param {Vector3} source
|
|
8
|
+
* @param {Vector3} target
|
|
9
|
+
* @param {Vector3} targetVelocity
|
|
10
|
+
* @param {number} sourceSpeed
|
|
11
|
+
* @return {boolean}
|
|
12
|
+
*/
|
|
13
|
+
function computeInterceptPoint(result, source, target, targetVelocity, sourceSpeed) {
|
|
14
|
+
const d_ts_x = target.x - source.x;
|
|
15
|
+
const d_ts_y = target.y - source.y;
|
|
16
|
+
const d_ts_z = target.z - source.z;
|
|
17
|
+
|
|
18
|
+
// Get quadratic equation components
|
|
19
|
+
const a = targetVelocity.dot(targetVelocity) - sourceSpeed * sourceSpeed;
|
|
20
|
+
const b = 2 * v3_dot(targetVelocity.x, targetVelocity.y, targetVelocity.z, d_ts_x, d_ts_y, d_ts_z);
|
|
21
|
+
|
|
22
|
+
const c = v3_dot(
|
|
23
|
+
d_ts_x, d_ts_y, d_ts_z,
|
|
24
|
+
d_ts_x, d_ts_y, d_ts_z
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
// Solve quadratic
|
|
28
|
+
const ts = [];
|
|
29
|
+
const root_count = solveQuadratic(ts, 0, a, b, c); // See quad(), below
|
|
30
|
+
|
|
31
|
+
// Find smallest positive solution
|
|
32
|
+
if (root_count > 0) {
|
|
33
|
+
const t0 = ts[0], t1 = ts[1];
|
|
34
|
+
let t = Math.min(t0, t1);
|
|
35
|
+
if (t < 0) t = Math.max(t0, t1);
|
|
36
|
+
|
|
37
|
+
if (t > 0) {
|
|
38
|
+
result.copy(targetVelocity).multiplyScalar(t).add(target);
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseProcess } from "../../core/process/BaseProcess.js";
|
|
2
1
|
import { assert } from "../../core/assert.js";
|
|
2
|
+
import { BaseProcess } from "../../core/process/BaseProcess.js";
|
|
3
3
|
|
|
4
4
|
export class EnginePlugin extends BaseProcess {
|
|
5
5
|
|
|
@@ -16,7 +16,6 @@ export class EnginePlugin extends BaseProcess {
|
|
|
16
16
|
*/
|
|
17
17
|
engine = null;
|
|
18
18
|
|
|
19
|
-
|
|
20
19
|
attach() {
|
|
21
20
|
/**
|
|
22
21
|
* Must be unique for each plugin
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FPS-style character controller
|
|
3
|
-
* @author Alex Goldring
|
|
4
|
-
* @copyright Alex Goldring 7/4/2014
|
|
5
|
-
*/
|
|
6
|
-
class CharacterController {
|
|
7
|
-
height = 4;
|
|
8
|
-
onSolidSurface = false;
|
|
9
|
-
lockedTimeout = 0;
|
|
10
|
-
//
|
|
11
|
-
forward = false;
|
|
12
|
-
back = false;
|
|
13
|
-
left = false;
|
|
14
|
-
right = false;
|
|
15
|
-
sprinting = false;
|
|
16
|
-
attacking = false;
|
|
17
|
-
aim = null;
|
|
18
|
-
//
|
|
19
|
-
movementSpeed = 1;
|
|
20
|
-
sprintingMultiplier = 1;
|
|
21
|
-
|
|
22
|
-
constructor({
|
|
23
|
-
movementSpeed = 1,
|
|
24
|
-
sprintingMultiplier = 1.2
|
|
25
|
-
} = {}) {
|
|
26
|
-
this.movementSpeed = movementSpeed;
|
|
27
|
-
this.sprintingMultiplier = sprintingMultiplier;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default CharacterController;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Alex on 01/04/2014.
|
|
3
|
-
*/
|
|
4
|
-
import Vector3 from "../../../core/geom/Vector3.js";
|
|
5
|
-
|
|
6
|
-
let Shape = function () {
|
|
7
|
-
this.type = void 0;
|
|
8
|
-
};
|
|
9
|
-
const BoxShape = function (options) {
|
|
10
|
-
this.type = "box";
|
|
11
|
-
const s = options.size;
|
|
12
|
-
this.size = new Vector3(s.x, s.y, s.z);
|
|
13
|
-
};
|
|
14
|
-
const SphereShape = function (options) {
|
|
15
|
-
this.type = "sphere";
|
|
16
|
-
this.radius = options.radius;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
function makeShape(desc) {
|
|
20
|
-
switch (desc.type) {
|
|
21
|
-
case "box":
|
|
22
|
-
return new BoxShape(desc);
|
|
23
|
-
case "sphere":
|
|
24
|
-
return new SphereShape(desc);
|
|
25
|
-
default:
|
|
26
|
-
return desc;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function PhysicalBody(options) {
|
|
31
|
-
this.shape = makeShape(options.shape);
|
|
32
|
-
this.velocity = new Vector3();
|
|
33
|
-
this.linearDamping = options.linearDamping !== void 0 ? options.linearDamping : 0;
|
|
34
|
-
this.angularVelocity = new Vector3();
|
|
35
|
-
this.rotationAxis = new Vector3();
|
|
36
|
-
//this.friction = options.friction !== void 0 ? options.friction : 0;
|
|
37
|
-
if (options.rotationAxis !== void 0) {
|
|
38
|
-
this.rotationAxis.copy(options.rotationAxis);
|
|
39
|
-
}
|
|
40
|
-
this.mass = options.mass !== void 0 ? options.mass : 0;
|
|
41
|
-
this.collisionResponse = options.collisionResponse !== void 0 ? options.collisionResponse : true;
|
|
42
|
-
//
|
|
43
|
-
if (options.velocity !== void 0) {
|
|
44
|
-
this.velocity.copy(options.velocity);
|
|
45
|
-
}
|
|
46
|
-
if (options.angularVelocity !== void 0) {
|
|
47
|
-
this.angularVelocity.copy(options.angularVelocity);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default PhysicalBody;
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* User: Alex Goldring
|
|
3
|
-
* Date: 1/6/2014
|
|
4
|
-
* Time: 08:37
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import Vector3 from '../../../core/geom/Vector3.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @readonly
|
|
12
|
-
* @enum {String}
|
|
13
|
-
*/
|
|
14
|
-
export const SteeringEvents = {
|
|
15
|
-
DestinationReached: "steeringDestinationReached"
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @readonly
|
|
20
|
-
* @enum {number}
|
|
21
|
-
*/
|
|
22
|
-
export const SteeringFlags = {
|
|
23
|
-
Active: 1
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
class Steering {
|
|
27
|
-
constructor() {
|
|
28
|
-
this.maxSpeed = 1;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @readonly
|
|
32
|
-
* @type {Vector3}
|
|
33
|
-
*/
|
|
34
|
-
this.destination = new Vector3();
|
|
35
|
-
|
|
36
|
-
this.targetMargin = new Vector3(0.001, 0.001, 0.001);
|
|
37
|
-
|
|
38
|
-
this.rotationSpeed = Math.PI / 2;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
*
|
|
42
|
-
* @type {number}
|
|
43
|
-
*/
|
|
44
|
-
this.flags = 0;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
* @param {number|SteeringFlags} flag
|
|
50
|
-
* @returns {void}
|
|
51
|
-
*/
|
|
52
|
-
setFlag(flag) {
|
|
53
|
-
this.flags |= flag;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
*
|
|
58
|
-
* @param {number|SteeringFlags} flag
|
|
59
|
-
* @returns {void}
|
|
60
|
-
*/
|
|
61
|
-
clearFlag(flag) {
|
|
62
|
-
this.flags &= ~flag;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
*
|
|
67
|
-
* @param {number|SteeringFlags} flag
|
|
68
|
-
* @param {boolean} value
|
|
69
|
-
*/
|
|
70
|
-
writeFlag(flag, value) {
|
|
71
|
-
if (value) {
|
|
72
|
-
this.setFlag(flag);
|
|
73
|
-
} else {
|
|
74
|
-
this.clearFlag(flag);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
*
|
|
80
|
-
* @param {number|SteeringFlags} flag
|
|
81
|
-
* @returns {boolean}
|
|
82
|
-
*/
|
|
83
|
-
getFlag(flag) {
|
|
84
|
-
return (this.flags & flag) === flag;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
fromJSON(json) {
|
|
88
|
-
if (json.maxSpeed !== undefined) {
|
|
89
|
-
this.maxSpeed = json.maxSpeed;
|
|
90
|
-
}
|
|
91
|
-
if (json.rotationSpeed !== undefined) {
|
|
92
|
-
this.rotationSpeed = json.rotationSpeed;
|
|
93
|
-
}
|
|
94
|
-
if (json.targetMargin !== undefined) {
|
|
95
|
-
this.targetMargin.fromJSON(json.targetMargin);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
toJSON() {
|
|
100
|
-
return {
|
|
101
|
-
maxSpeed: this.maxSpeed,
|
|
102
|
-
rotationSpeed: this.rotationSpeed,
|
|
103
|
-
targetMargin: this.targetMargin.toJSON()
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
Steering.typeName = "Steering";
|
|
109
|
-
|
|
110
|
-
export default Steering;
|
|
111
|
-
|