@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,57 @@
|
|
|
1
|
+
import { ImmutableObjectPool } from "../../../../core/model/object/ImmutableObjectPool.js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class RenderTextureManager {
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @type {IRenderContext|null}
|
|
10
|
+
*/
|
|
11
|
+
#ctx = null;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @type {ImmutableObjectPool<TextureDescriptor, RenderTarget>}
|
|
16
|
+
*/
|
|
17
|
+
#cache = new ImmutableObjectPool();
|
|
18
|
+
|
|
19
|
+
attach(ctx) {
|
|
20
|
+
this.#ctx = ctx;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
constructor() {
|
|
24
|
+
this.#cache.onRemoved.add((descriptor, texture) => {
|
|
25
|
+
|
|
26
|
+
this.#ctx.destroyRenderTarget(texture);
|
|
27
|
+
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @param {TextureDescriptor} descriptor
|
|
34
|
+
* @returns {RenderTarget}
|
|
35
|
+
*/
|
|
36
|
+
get(descriptor) {
|
|
37
|
+
const existing = this.#cache.get(descriptor);
|
|
38
|
+
|
|
39
|
+
if (existing !== undefined) {
|
|
40
|
+
return existing;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// nothing in cache, create a new one
|
|
44
|
+
return this.#ctx.createRenderTarget(descriptor);
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @param {RenderTarget} handle
|
|
51
|
+
*/
|
|
52
|
+
release(handle) {
|
|
53
|
+
|
|
54
|
+
this.#cache.add(handle.descriptor, handle);
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TextureDescriptor } from "./TextureDescriptor.js";
|
|
2
1
|
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
import { TextureDescriptor } from "./TextureDescriptor.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @template T
|
|
@@ -39,20 +39,22 @@ export class ResourceEntry {
|
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Creates actual resource
|
|
42
|
+
* @param {RenderTextureManager} resources
|
|
42
43
|
*/
|
|
43
|
-
create() {
|
|
44
|
+
create(resources) {
|
|
44
45
|
assert.ok(this.isTransient(), 'Only transient resources can be allocated');
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
this.resource = resources.get(this.resource_descriptor)
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
/**
|
|
50
51
|
* De-allocated memory for the resource
|
|
52
|
+
* @param {RenderTextureManager} resources
|
|
51
53
|
*/
|
|
52
|
-
destroy() {
|
|
54
|
+
destroy(resources) {
|
|
53
55
|
assert.ok(this.isTransient(), 'Only transient resources can be destroyed, that is resources that are created by the graph itself');
|
|
54
56
|
|
|
55
|
-
|
|
57
|
+
resources.release(this.resource);
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
isImported() {
|
|
@@ -1,48 +1,63 @@
|
|
|
1
1
|
import { BinaryDataType } from "../../../../core/binary/type/BinaryDataType.js";
|
|
2
|
+
import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
|
|
3
|
+
import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
|
|
4
|
+
import { TextureInitialState } from "./TextureInitialState.js";
|
|
5
|
+
|
|
6
|
+
export class TextureDescriptor {
|
|
2
7
|
|
|
3
|
-
export const TextureInitialState = {
|
|
4
8
|
/**
|
|
5
|
-
*
|
|
9
|
+
*
|
|
10
|
+
* @type {number}
|
|
6
11
|
*/
|
|
7
|
-
|
|
12
|
+
height = 0;
|
|
8
13
|
/**
|
|
9
|
-
*
|
|
14
|
+
*
|
|
15
|
+
* @type {number}
|
|
10
16
|
*/
|
|
11
|
-
|
|
12
|
-
};
|
|
17
|
+
width = 0;
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.width = 0;
|
|
19
|
+
/**
|
|
20
|
+
* Render texture type
|
|
21
|
+
* @type {BinaryDataType}
|
|
22
|
+
*/
|
|
23
|
+
format = BinaryDataType.Uint8;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @type {number}
|
|
28
|
+
*/
|
|
29
|
+
channel_count = 1;
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
/**
|
|
32
|
+
* What should the texture be initialized to
|
|
33
|
+
* @type {number}
|
|
34
|
+
*/
|
|
35
|
+
initial_state = TextureInitialState.Clear;
|
|
32
36
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
hash() {
|
|
38
|
+
return computeHashIntegerArray(
|
|
39
|
+
this.width,
|
|
40
|
+
this.height,
|
|
41
|
+
computeStringHash(this.format),
|
|
42
|
+
this.channel_count,
|
|
43
|
+
)
|
|
44
|
+
}
|
|
38
45
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @param {TextureDescriptor} other
|
|
49
|
+
* @returns {boolean}
|
|
50
|
+
*/
|
|
51
|
+
equals(other) {
|
|
52
|
+
return this.width === other.width
|
|
53
|
+
&& this.height === other.height
|
|
54
|
+
&& this.format === other.format
|
|
55
|
+
&& this.channel_count === other.channel_count
|
|
56
|
+
&& this.initial_state === other.initial_state
|
|
57
|
+
;
|
|
44
58
|
}
|
|
45
59
|
|
|
60
|
+
|
|
46
61
|
static from({
|
|
47
62
|
height = 0,
|
|
48
63
|
width = 0,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RenderPass } from "../../RenderPass.js";
|
|
2
|
+
|
|
3
|
+
export class CopyPass extends RenderPass {
|
|
4
|
+
name = "Copy"
|
|
5
|
+
|
|
6
|
+
setup(builder, { input, output }) {
|
|
7
|
+
|
|
8
|
+
builder.read(input);
|
|
9
|
+
|
|
10
|
+
const destination = builder.write(output);
|
|
11
|
+
|
|
12
|
+
return {
|
|
13
|
+
output: destination
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
execute(data, resources, render_context) {
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { GBufferDrawPass } from "./GBufferDrawPass.js";
|
|
2
|
-
import { LightingPass } from "./LightingPass.js";
|
|
3
1
|
import { RenderGraph } from "../../RenderGraph.js";
|
|
4
|
-
import { WebGLRenderContext } from "../../webgl/WebGLRenderContext.js";
|
|
5
2
|
import { TextureDescriptor } from "../../TextureDescriptor.js";
|
|
3
|
+
import { WebGLRenderContext } from "../../webgl/WebGLRenderContext.js";
|
|
4
|
+
import { GBufferDrawPass } from "./GBufferDrawPass.js";
|
|
5
|
+
import { LightingPass } from "./LightingPass.js";
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
const graph = new RenderGraph();
|
|
@@ -23,9 +23,37 @@ const p_p = new LightingPass({
|
|
|
23
23
|
});
|
|
24
24
|
graph.add(p_p);
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
function makeContext() {
|
|
27
|
+
const canvas = document.createElement('canvas');
|
|
27
28
|
|
|
28
|
-
graph.compile();
|
|
29
29
|
|
|
30
|
+
canvas.width = 800;
|
|
31
|
+
canvas.height = 600;
|
|
32
|
+
|
|
33
|
+
document.body.appendChild(canvas);
|
|
34
|
+
|
|
35
|
+
const ctx = canvas.getContext("webgl2");
|
|
36
|
+
|
|
37
|
+
return new WebGLRenderContext(ctx);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const ctx = makeContext();
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
graph.compile();
|
|
30
44
|
console.log(graph.exportToDot());
|
|
31
|
-
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
function render() {
|
|
48
|
+
graph.compile();
|
|
49
|
+
|
|
50
|
+
graph.execute(ctx);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function update() {
|
|
54
|
+
requestAnimationFrame(update);
|
|
55
|
+
|
|
56
|
+
render();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
update();
|
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
import { IRenderContext } from "../IRenderContext.js";
|
|
2
|
+
import { RenderTarget } from "../RenderTarget.js";
|
|
2
3
|
|
|
3
4
|
export class WebGLRenderContext extends IRenderContext {
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @type {WebGL2RenderingContext|null}
|
|
8
|
+
*/
|
|
9
|
+
#gl = null;
|
|
4
10
|
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param {WebGL2RenderingContext} ctx
|
|
14
|
+
*/
|
|
15
|
+
constructor(ctx) {
|
|
16
|
+
super();
|
|
17
|
+
|
|
18
|
+
this.#gl = ctx;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param {TextureDescriptor} descriptor
|
|
24
|
+
*/
|
|
25
|
+
createRenderTarget(descriptor) {
|
|
26
|
+
console.log("createRenderTarget", descriptor)
|
|
27
|
+
|
|
28
|
+
const rt = new RenderTarget();
|
|
29
|
+
|
|
30
|
+
rt.descriptor = descriptor;
|
|
31
|
+
rt.handle = 0;
|
|
32
|
+
|
|
33
|
+
return rt;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
destroyRenderTarget(target) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
5
39
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { mat4 } from "gl-matrix";
|
|
2
2
|
import FacingDirectionSystem from "../../../../../../../model/game/ecs/system/FacingDirectionSystem.js";
|
|
3
|
+
import { initializeEditor } from "../../../../../../../model/game/initializeEditor.js";
|
|
3
4
|
import { makeEngineOptionsModel } from "../../../../../../../model/game/options/makeEngineOptionsModel.js";
|
|
4
5
|
import { enableEditor } from "../../../../../../editor/enableEditor.js";
|
|
5
6
|
import { AABB3 } from "../../../../../core/geom/3d/aabb/AABB3.js";
|
|
@@ -26,12 +27,10 @@ import HeadsUpDisplaySystem from "../../../../ecs/gui/hud/HeadsUpDisplaySystem.j
|
|
|
26
27
|
import ViewportPosition from "../../../../ecs/gui/position/ViewportPosition.js";
|
|
27
28
|
import ViewportPositionSystem from "../../../../ecs/gui/position/ViewportPositionSystem.js";
|
|
28
29
|
import { InverseKinematicsSystem } from "../../../../ecs/ik/InverseKinematicsSystem.js";
|
|
30
|
+
import RenderSystem from "../../../../ecs/renderable/RenderSystem.js";
|
|
29
31
|
import AnimationSystem from "../../../../ecs/systems/AnimationSystem.js";
|
|
30
32
|
import MotionSystem from "../../../../ecs/systems/MotionSystem.js";
|
|
31
|
-
import RenderSystem from "../../../../ecs/systems/RenderSystem.js";
|
|
32
33
|
import ScriptSystem from "../../../../ecs/systems/ScriptSystem.js";
|
|
33
|
-
import SteeringSystem from "../../../../ecs/systems/SteeringSystem.js";
|
|
34
|
-
import TagSystem from "../../../../ecs/systems/TagSystem.js";
|
|
35
34
|
import TimerSystem from "../../../../ecs/systems/TimerSystem.js";
|
|
36
35
|
import ClingToTerrainSystem from "../../../../ecs/terrain/ecs/cling/ClingToTerrainSystem.js";
|
|
37
36
|
import TerrainSystem from "../../../../ecs/terrain/ecs/TerrainSystem.js";
|
|
@@ -89,9 +88,7 @@ function makeConfig(engine) {
|
|
|
89
88
|
new ScriptSystem(),
|
|
90
89
|
new FacingDirectionSystem(),
|
|
91
90
|
new PathFollowingSystem(),
|
|
92
|
-
new SteeringSystem(),
|
|
93
91
|
new MotionSystem(),
|
|
94
|
-
new TagSystem(),
|
|
95
92
|
new AttachmentSystem(),
|
|
96
93
|
new SoundEmitterSystem(assetManager, sound.destination, sound.context),
|
|
97
94
|
new SoundControllerSystem(),
|
|
@@ -151,7 +148,7 @@ async function init(harness) {
|
|
|
151
148
|
|
|
152
149
|
await makeConfig(engine).apply(engine);
|
|
153
150
|
|
|
154
|
-
enableEditor(engine);
|
|
151
|
+
enableEditor(engine, initializeEditor);
|
|
155
152
|
|
|
156
153
|
await load_and_set_cubemap_v0(engine.graphics, 'data/textures/cubemaps/hip_miramar/32/', '.png');
|
|
157
154
|
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { make_justified_point_grid } from "../../../../core/geom/3d/util/make_justified_point_grid.js";
|
|
2
|
+
import Vector2 from "../../../../core/geom/Vector2.js";
|
|
3
|
+
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
4
|
+
import { GameAssetType } from "../../../asset/GameAssetType.js";
|
|
5
|
+
import { GLTFAssetLoader } from "../../../asset/loaders/GLTFAssetLoader.js";
|
|
6
|
+
import { TextureAssetLoader } from "../../../asset/loaders/texture/TextureAssetLoader.js";
|
|
7
|
+
import Entity from "../../../ecs/Entity.js";
|
|
8
|
+
import { TransformAttachmentSystem } from "../../../ecs/transform-attachment/TransformAttachmentSystem.js";
|
|
9
|
+
import { Transform } from "../../../ecs/transform/Transform.js";
|
|
10
|
+
import { EngineHarness } from "../../../EngineHarness.js";
|
|
11
|
+
import { BehaviorSystem } from "../../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
12
|
+
import { SGMesh } from "../../ecs/mesh-v2/aggregate/SGMesh.js";
|
|
13
|
+
import { SGMeshSystem } from "../../ecs/mesh-v2/aggregate/SGMeshSystem.js";
|
|
14
|
+
import { ShadedGeometry } from "../../ecs/mesh-v2/ShadedGeometry.js";
|
|
15
|
+
import { ShadedGeometrySystem } from "../../ecs/mesh-v2/ShadedGeometrySystem.js";
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param {AABB3} bounds
|
|
21
|
+
* @param {number} [spacing]
|
|
22
|
+
*/
|
|
23
|
+
function buildProbeGrid(bounds, spacing = 1) {
|
|
24
|
+
const positions = [];
|
|
25
|
+
|
|
26
|
+
make_justified_point_grid(bounds, spacing, (x, y, z) => {
|
|
27
|
+
positions.push(x, y, z);
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @param {Engine} engine
|
|
35
|
+
*/
|
|
36
|
+
async function buildGI(engine) {
|
|
37
|
+
|
|
38
|
+
const ecd = engine.entityManager.dataset;
|
|
39
|
+
|
|
40
|
+
ecd.traverseEntities([ShadedGeometry, Transform], (sg, transform, entity) => {
|
|
41
|
+
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
new Entity()
|
|
45
|
+
.add(SGMesh.fromURL("moicon/gnutti_not_optimized/model.gltf"))
|
|
46
|
+
.add(Transform.fromJSON({
|
|
47
|
+
position: { x: 10, y: 3, z: 10 },
|
|
48
|
+
scale: 1.5
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
function init() {
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
* @param {Engine} engine
|
|
59
|
+
*/
|
|
60
|
+
async function main(engine) {
|
|
61
|
+
|
|
62
|
+
await EngineHarness.buildBasics({
|
|
63
|
+
engine,
|
|
64
|
+
focus: new Vector3(128, 0, 128),
|
|
65
|
+
distance: 30,
|
|
66
|
+
terrainResolution: 1,
|
|
67
|
+
terrainSize: new Vector2(128, 128),
|
|
68
|
+
enableWater: false,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
new EngineHarness().initialize({
|
|
74
|
+
configuration(config, engine) {
|
|
75
|
+
config.addLoader(GameAssetType.Texture, new TextureAssetLoader());
|
|
76
|
+
|
|
77
|
+
const gltfAssetLoader = new GLTFAssetLoader();
|
|
78
|
+
|
|
79
|
+
config.addLoader(GameAssetType.ModelGLTF_JSON, gltfAssetLoader);
|
|
80
|
+
config.addLoader(GameAssetType.ModelGLTF, gltfAssetLoader);
|
|
81
|
+
|
|
82
|
+
config.addSystem(new BehaviorSystem(engine))
|
|
83
|
+
config.addSystem(new SGMeshSystem(engine));
|
|
84
|
+
config.addSystem(new ShadedGeometrySystem(engine));
|
|
85
|
+
config.addSystem(new TransformAttachmentSystem(engine));
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
.then(main);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
init();
|
|
@@ -14,7 +14,6 @@ import HeadsUpDisplaySystem from "../../ecs/gui/hud/HeadsUpDisplaySystem.js";
|
|
|
14
14
|
import ViewportPosition from "../../ecs/gui/position/ViewportPosition.js";
|
|
15
15
|
import ViewportPositionSystem from "../../ecs/gui/position/ViewportPositionSystem.js";
|
|
16
16
|
import AnimationSystem from "../../ecs/systems/AnimationSystem.js";
|
|
17
|
-
import TagSystem from "../../ecs/systems/TagSystem.js";
|
|
18
17
|
import ClingToTerrainSystem from "../../ecs/terrain/ecs/cling/ClingToTerrainSystem.js";
|
|
19
18
|
import TerrainSystem from "../../ecs/terrain/ecs/TerrainSystem.js";
|
|
20
19
|
import { EngineConfiguration } from "../../EngineConfiguration.js";
|
|
@@ -69,7 +68,6 @@ function makeConfig(engine) {
|
|
|
69
68
|
initializeGameBinarySerializationRegistry(engine.binarySerializationRegistry);
|
|
70
69
|
|
|
71
70
|
config.addManySystems(
|
|
72
|
-
new TagSystem(),
|
|
73
71
|
new AttachmentSystem(),
|
|
74
72
|
new SoundEmitterSystem(assetManager, sound.destination, sound.context),
|
|
75
73
|
new SoundControllerSystem(),
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { MaxRectanglesPacker } from "../../../../core/geom/packing/max-rect/MaxRectangles.js";
|
|
2
|
-
import { max2 } from "../../../../core/math/max2.js";
|
|
3
|
-
import { Sampler2D } from "../sampler/Sampler2D.js";
|
|
4
|
-
import IdPool from "../../../../core/IdPool.js";
|
|
5
|
-
import Vector2 from "../../../../core/geom/Vector2.js";
|
|
6
|
-
import { AtlasPatch } from "./AtlasPatch.js";
|
|
7
|
-
import { AtlasPatchFlag } from "./AtlasPatchFlag.js";
|
|
8
|
-
import Signal from "../../../../core/events/signal/Signal.js";
|
|
9
1
|
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
import { ceilPowerOfTwo } from "../../../../core/binary/operations/ceilPowerOfTwo.js";
|
|
10
3
|
import { BinaryDataType } from "../../../../core/binary/type/BinaryDataType.js";
|
|
11
4
|
import {
|
|
12
5
|
DataType2TypedArrayConstructorMapping
|
|
13
6
|
} from "../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
|
|
14
|
-
import
|
|
7
|
+
import Signal from "../../../../core/events/signal/Signal.js";
|
|
8
|
+
import { MaxRectanglesPacker } from "../../../../core/geom/packing/max-rect/MaxRectangles.js";
|
|
9
|
+
import Vector2 from "../../../../core/geom/Vector2.js";
|
|
10
|
+
import IdPool from "../../../../core/IdPool.js";
|
|
11
|
+
import { max2 } from "../../../../core/math/max2.js";
|
|
15
12
|
import { invokeObjectClone } from "../../../../core/model/object/invokeObjectClone.js";
|
|
16
|
-
import {
|
|
13
|
+
import { Sampler2D } from "../sampler/Sampler2D.js";
|
|
14
|
+
import { sampler2d_sub_copy_same_item_size } from "../sampler/sampler2d_sub_copy_same_item_size.js";
|
|
15
|
+
import { AbstractTextureAtlas } from "./AbstractTextureAtlas.js";
|
|
16
|
+
import { AtlasPatch } from "./AtlasPatch.js";
|
|
17
|
+
import { AtlasPatchFlag } from "./AtlasPatchFlag.js";
|
|
17
18
|
|
|
18
19
|
export class TextureAtlas extends AbstractTextureAtlas {
|
|
19
20
|
/**
|
|
@@ -213,7 +214,8 @@ export class TextureAtlas extends AbstractTextureAtlas {
|
|
|
213
214
|
const patch_position = patch.position;
|
|
214
215
|
const patch_size = patch.size;
|
|
215
216
|
|
|
216
|
-
|
|
217
|
+
sampler2d_sub_copy_same_item_size(
|
|
218
|
+
target,
|
|
217
219
|
source,
|
|
218
220
|
0, 0,
|
|
219
221
|
patch_position.x, patch_position.y, patch_size.x, patch_size.y
|