@woosh/meep-engine 2.33.60 → 2.33.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/geom/3d/SurfacePoint3.js +44 -5
- package/core/geom/Vector2.d.ts +2 -0
- package/core/geom/packing/MaxRectangles.js +13 -4
- package/core/math/hash/murmur3_32.js +3 -3
- package/engine/asset/loaders/material/computeTextureHash.js +7 -13
- package/engine/ecs/attachment/AttachmentSystem.js +18 -17
- package/engine/ecs/grid/HeightMap2NormalMap.js +1 -1
- package/engine/ecs/grid/NormalMap2AOMap.js +1 -1
- package/engine/ecs/gui/position/ViewportPositionSystem.js +5 -5
- package/engine/ecs/parent/EntityNode.d.ts +20 -0
- package/engine/ecs/parent/EntityNode.js +284 -0
- package/engine/ecs/parent/FaceEditor.js +137 -0
- package/engine/ecs/parent/testCompositionEntityNode.js +153 -0
- package/engine/ecs/parent/testHuDPerf.js +123 -0
- package/engine/ecs/terrain/ecs/Terrain.js +14 -5
- package/engine/graphics/GraphicsEngine.js +1 -2
- package/engine/graphics/camera/testClippingPlaneComputation.js +0 -4
- package/engine/graphics/ecs/light/LightSystem.js +1 -1
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +29 -0
- package/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +158 -1
- package/engine/graphics/ecs/path/testPathDisplaySystem.js +0 -2
- package/engine/graphics/geometry/buffered/query/GeometrySpatialQueryAccelerator.js +55 -11
- package/engine/graphics/micron/render/v1/MaterialContext.js +1 -0
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepFixedPhysics.js +19 -3
- package/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +0 -2
- package/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +0 -2
- package/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +0 -2
- package/engine/graphics/render/frame_graph/FrameGraphBuilder.js +36 -0
- package/engine/graphics/render/frame_graph/IRenderContext.js +8 -0
- package/engine/graphics/render/frame_graph/RenderPass.js +32 -0
- package/engine/graphics/render/frame_graph/RenderPassFlags.js +6 -0
- package/engine/graphics/render/frame_graph/RenderPassResources.js +15 -0
- package/engine/graphics/render/frame_graph/Resource.js +21 -0
- package/engine/graphics/render/frame_graph/ResourceReference.js +14 -0
- package/engine/graphics/render/frame_graph/TextureDescriptor.js +30 -0
- package/engine/graphics/render/frame_graph/UsageModeType.js +5 -0
- package/engine/graphics/render/frame_graph/sample/deferred/GBufferDrawPass.js +27 -0
- package/engine/graphics/render/frame_graph/sample/deferred/PresentPass.js +17 -0
- package/engine/graphics/render/visibility/hiz/prototypeHiZ.js +0 -2
- package/engine/graphics/render/webgpu/sample/_main.ts +650 -0
- package/engine/graphics/render/webgpu/sample/fragmentDeferredRendering.wgsl +67 -0
- package/engine/graphics/render/webgpu/sample/fragmentGBuffersDebugView.wgsl +38 -0
- package/engine/graphics/render/webgpu/sample/fragmentWriteGBuffers.wgsl +21 -0
- package/engine/graphics/render/webgpu/sample/lightUpdate.wgsl +34 -0
- package/engine/graphics/render/webgpu/sample/main.js +566 -0
- package/engine/graphics/render/webgpu/sample/vertexTextureQuad.wgsl +9 -0
- package/engine/graphics/render/webgpu/sample/vertexWriteGBuffers.wgsl +28 -0
- package/engine/graphics/shadows/testShadowMapRendering.js +0 -2
- package/engine/{ecs/grid → graphics/texture/sampler}/sampler2DToFloat32Texture.js +1 -1
- package/package.json +1 -1
- package/samples/terrain/main.js +117 -0
- package/engine/ecs/sockets/AttachmentSocketsSystem.js +0 -10
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { SimpleStateMachineDescription } from "../../../core/fsm/simple/SimpleStateMachineDescription.js";
|
|
2
|
+
import { SimpleStateMachine } from "../../../core/fsm/simple/SimpleStateMachine.js";
|
|
3
|
+
import Vector3 from "../../../core/geom/Vector3.js";
|
|
4
|
+
import { SurfacePoint3 } from "../../../core/geom/3d/SurfacePoint3.js";
|
|
5
|
+
|
|
6
|
+
const smd = new SimpleStateMachineDescription();
|
|
7
|
+
|
|
8
|
+
export const STATE_INITIAL = smd.createState();
|
|
9
|
+
export const STATE_HOVER = smd.createState();
|
|
10
|
+
export const STATE_EDIT = smd.createState();
|
|
11
|
+
|
|
12
|
+
smd.createEdge(STATE_INITIAL, STATE_HOVER);
|
|
13
|
+
smd.createEdge(STATE_HOVER, STATE_EDIT);
|
|
14
|
+
smd.createEdge(STATE_HOVER, STATE_INITIAL);
|
|
15
|
+
smd.createEdge(STATE_EDIT, STATE_HOVER);
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export class FaceEditor {
|
|
19
|
+
constructor() {
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @type {ShadedGeometry|null}
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
25
|
+
this.__mesh = null;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @type {EntityComponentDataset|null}
|
|
30
|
+
* @private
|
|
31
|
+
*/
|
|
32
|
+
this.__ecd = null;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @type {number}
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
39
|
+
this.__entity = -1;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @type {Vector3}
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
this.__edit_anchor_point = new Vector3();
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* @type {Vector3}
|
|
50
|
+
* @private
|
|
51
|
+
*/
|
|
52
|
+
this.__edit_target_point = new Vector3();
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
* @type {SurfacePoint3}
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
this.__hover_contact = new SurfacePoint3();
|
|
60
|
+
|
|
61
|
+
this.__sm = new SimpleStateMachine(smd);
|
|
62
|
+
this.__sm.setState(STATE_INITIAL);
|
|
63
|
+
|
|
64
|
+
this.__sm.addEventHandlerStateEntry(STATE_HOVER, () => {
|
|
65
|
+
console.log('+hovering');
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
this.__sm.addEventHandlerStateExit(STATE_HOVER, () => {
|
|
69
|
+
console.log('-hovering');
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
get state() {
|
|
74
|
+
return this.__sm.getState();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
set state(v) {
|
|
78
|
+
this.__sm.navigateTo(v);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @param {ShadedGeometry} v
|
|
83
|
+
*/
|
|
84
|
+
set mesh(v) {
|
|
85
|
+
this.__mesh = v;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
get mesh() {
|
|
89
|
+
return this.__mesh;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @param {EntityComponentDataset} v
|
|
94
|
+
*/
|
|
95
|
+
set ecd(v) {
|
|
96
|
+
this.__ecd = v;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @param {number} v
|
|
101
|
+
*/
|
|
102
|
+
set entity(v) {
|
|
103
|
+
this.__entity = v;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
*
|
|
108
|
+
* @param {Vector3} v
|
|
109
|
+
*/
|
|
110
|
+
set edit_anchor_point(v) {
|
|
111
|
+
this.__edit_anchor_point.copy(v);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
*
|
|
116
|
+
* @param {Vector3} v
|
|
117
|
+
*/
|
|
118
|
+
set edit_target_point(v) {
|
|
119
|
+
this.__edit_target_point.copy(v);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
set contact(v) {
|
|
123
|
+
this.__hover_contact.copy(v);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
get contact() {
|
|
127
|
+
return this.__hover_contact;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
attach() {
|
|
131
|
+
this.__sm.navigateTo(STATE_INITIAL);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
detach() {
|
|
135
|
+
this.__sm.navigateTo(STATE_INITIAL);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { EngineHarness } from "../../EngineHarness.js";
|
|
2
|
+
import { ShadedGeometrySystem } from "../../graphics/ecs/mesh-v2/ShadedGeometrySystem.js";
|
|
3
|
+
import { Transform } from "../transform/Transform.js";
|
|
4
|
+
import { ShadedGeometry } from "../../graphics/ecs/mesh-v2/ShadedGeometry.js";
|
|
5
|
+
import { BoxBufferGeometry, MeshLambertMaterial } from "three";
|
|
6
|
+
import { EngineConfiguration } from "../../EngineConfiguration.js";
|
|
7
|
+
import { EntityNode } from "./EntityNode.js";
|
|
8
|
+
import { AttachmentSystem } from "../attachment/AttachmentSystem.js";
|
|
9
|
+
import { SurfacePoint3 } from "../../../core/geom/3d/SurfacePoint3.js";
|
|
10
|
+
import Vector3 from "../../../core/geom/Vector3.js";
|
|
11
|
+
import Vector2 from "../../../core/geom/Vector2.js";
|
|
12
|
+
import { FaceEditor, STATE_EDIT, STATE_HOVER } from "./FaceEditor.js";
|
|
13
|
+
|
|
14
|
+
const eh = new EngineHarness();
|
|
15
|
+
|
|
16
|
+
function makeConfig(engine) {
|
|
17
|
+
const r = new EngineConfiguration();
|
|
18
|
+
|
|
19
|
+
r.addSystem(new ShadedGeometrySystem(engine));
|
|
20
|
+
r.addSystem(new AttachmentSystem())
|
|
21
|
+
|
|
22
|
+
return r;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @param {Engine} engine
|
|
28
|
+
*/
|
|
29
|
+
async function main(engine) {
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
EngineHarness.buildBasics({ engine, enableWater: false })
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
const ecd = engine.entityManager.dataset;
|
|
36
|
+
|
|
37
|
+
const block_a = EntityNode.fromComponents(
|
|
38
|
+
ShadedGeometry.from(new BoxBufferGeometry(), new MeshLambertMaterial({
|
|
39
|
+
color: 0xFFFFAA
|
|
40
|
+
})),
|
|
41
|
+
new Transform()
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
block_a.transform.position.set(5, 0.5, 5);
|
|
45
|
+
|
|
46
|
+
const block_b = EntityNode.fromComponents(
|
|
47
|
+
ShadedGeometry.from(new BoxBufferGeometry(), new MeshLambertMaterial({
|
|
48
|
+
color: 0xAAFFFF
|
|
49
|
+
})),
|
|
50
|
+
new Transform()
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
block_b.transform.position.set(1, 1, 1);
|
|
54
|
+
block_a.addChild(block_b);
|
|
55
|
+
|
|
56
|
+
block_a.build(ecd);
|
|
57
|
+
|
|
58
|
+
function pick(x, y) {
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* @type {ShadedGeometrySystem|null}
|
|
62
|
+
*/
|
|
63
|
+
const system = engine.entityManager.getSystem(ShadedGeometrySystem);
|
|
64
|
+
|
|
65
|
+
const contact = new SurfacePoint3();
|
|
66
|
+
|
|
67
|
+
const origin = new Vector3();
|
|
68
|
+
const direction = new Vector3();
|
|
69
|
+
|
|
70
|
+
const p = new Vector2(x, y);
|
|
71
|
+
const point_2 = p.clone();
|
|
72
|
+
|
|
73
|
+
engine.graphics.normalizeViewportPoint(p, point_2);
|
|
74
|
+
engine.graphics.viewportProjectionRay(point_2.x, point_2.y, origin, direction);
|
|
75
|
+
|
|
76
|
+
const hit = system.raycastNearest(contact, origin.x, origin.y, origin.z, direction.x, direction.y, direction.z);
|
|
77
|
+
|
|
78
|
+
if (hit === undefined) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return Object.assign({ contact }, hit);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const editor = new FaceEditor();
|
|
86
|
+
|
|
87
|
+
function update_hover_state(x, y) {
|
|
88
|
+
const hit = pick(x, y);
|
|
89
|
+
|
|
90
|
+
if (hit === undefined) {
|
|
91
|
+
editor.detach();
|
|
92
|
+
} else {
|
|
93
|
+
if (editor.mesh !== hit.mesh) {
|
|
94
|
+
editor.detach();
|
|
95
|
+
|
|
96
|
+
editor.contact = hit.contact;
|
|
97
|
+
editor.mesh = hit.mesh;
|
|
98
|
+
editor.entity = hit.entity;
|
|
99
|
+
editor.ecd = ecd;
|
|
100
|
+
|
|
101
|
+
editor.attach();
|
|
102
|
+
editor.state = STATE_HOVER;
|
|
103
|
+
} else {
|
|
104
|
+
// update contact only
|
|
105
|
+
editor.contact = hit.contact;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
engine.devices.pointer.position.onChanged.add((x, y) => {
|
|
113
|
+
if (editor.state !== STATE_EDIT) {
|
|
114
|
+
update_hover_state(x, y);
|
|
115
|
+
|
|
116
|
+
} else {
|
|
117
|
+
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
engine.devices.pointer.on.dragStart.add((p) => {
|
|
123
|
+
if (editor.state === STATE_HOVER) {
|
|
124
|
+
editor.edit_anchor_point = editor.contact.position;
|
|
125
|
+
editor.state = STATE_EDIT;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
engine.devices.pointer.on.drag.add(p => {
|
|
129
|
+
editor.edit_target_point = p;
|
|
130
|
+
});
|
|
131
|
+
engine.devices.pointer.on.dragEnd.add(p => {
|
|
132
|
+
if (editor.state === STATE_EDIT) {
|
|
133
|
+
update_hover_state(p.x, p.y);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
*
|
|
141
|
+
* @param {EngineHarness} harness
|
|
142
|
+
*/
|
|
143
|
+
async function init(harness) {
|
|
144
|
+
const engine = eh.engine;
|
|
145
|
+
|
|
146
|
+
await makeConfig(engine).apply(engine);
|
|
147
|
+
|
|
148
|
+
await eh.initialize();
|
|
149
|
+
|
|
150
|
+
main(engine);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
init(eh);
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { EngineHarness } from "../../EngineHarness.js";
|
|
2
|
+
import { ShadedGeometrySystem } from "../../graphics/ecs/mesh-v2/ShadedGeometrySystem.js";
|
|
3
|
+
import { Transform } from "../transform/Transform.js";
|
|
4
|
+
import { EngineConfiguration } from "../../EngineConfiguration.js";
|
|
5
|
+
import { AttachmentSystem } from "../attachment/AttachmentSystem.js";
|
|
6
|
+
import { GameAssetType } from "../../asset/GameAssetType.js";
|
|
7
|
+
import { Sampler2D } from "../../graphics/texture/sampler/Sampler2D.js";
|
|
8
|
+
import EntityBuilder from "../EntityBuilder.js";
|
|
9
|
+
import HeadsUpDisplay from "../gui/hud/HeadsUpDisplay.js";
|
|
10
|
+
import ViewportPosition from "../gui/position/ViewportPosition.js";
|
|
11
|
+
import GUIElement from "../gui/GUIElement.js";
|
|
12
|
+
import EmptyView from "../../../view/elements/EmptyView.js";
|
|
13
|
+
import HeadsUpDisplaySystem from "../gui/hud/HeadsUpDisplaySystem.js";
|
|
14
|
+
import ViewportPositionSystem from "../gui/position/ViewportPositionSystem.js";
|
|
15
|
+
import GUIElementSystem from "../gui/GUIElementSystem.js";
|
|
16
|
+
import { ImageRGBADataLoader } from "../../asset/loaders/image/ImageRGBADataLoader.js";
|
|
17
|
+
import LightSystem from "../../graphics/ecs/light/LightSystem.js";
|
|
18
|
+
import { CameraSystem } from "../../graphics/ecs/camera/CameraSystem.js";
|
|
19
|
+
|
|
20
|
+
const eh = new EngineHarness();
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param {Engine} engine
|
|
25
|
+
* @return {EngineConfiguration}
|
|
26
|
+
*/
|
|
27
|
+
function makeConfig(engine) {
|
|
28
|
+
const r = new EngineConfiguration();
|
|
29
|
+
|
|
30
|
+
r.addSystem(new ShadedGeometrySystem(engine));
|
|
31
|
+
r.addSystem(new AttachmentSystem());
|
|
32
|
+
r.addSystem(new HeadsUpDisplaySystem(engine.graphics));
|
|
33
|
+
r.addSystem(new ViewportPositionSystem(engine.gameView.size));
|
|
34
|
+
r.addSystem(new GUIElementSystem(engine.gui.view, engine));
|
|
35
|
+
r.addSystem(new LightSystem(engine, {
|
|
36
|
+
shadowResolution: 1024
|
|
37
|
+
}));
|
|
38
|
+
|
|
39
|
+
r.addLoader(GameAssetType.Image, new ImageRGBADataLoader());
|
|
40
|
+
|
|
41
|
+
return r;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @param {Engine} engine
|
|
47
|
+
*/
|
|
48
|
+
async function main(engine) {
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
EngineHarness.buildBasics({ engine, enableWater: false })
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
const ecd = engine.entityManager.dataset;
|
|
55
|
+
|
|
56
|
+
const active_camera = CameraSystem.getFirstActiveCamera(ecd);
|
|
57
|
+
const camera_component = active_camera.component;
|
|
58
|
+
|
|
59
|
+
camera_component.autoClip = false;
|
|
60
|
+
camera_component.object.far = 100;
|
|
61
|
+
|
|
62
|
+
const asset = await engine.assetManager.promise('data/textures/icons/Sci-Fi Ability Icons 1/134.PNG', GameAssetType.Image);
|
|
63
|
+
|
|
64
|
+
const sampler = asset.create();
|
|
65
|
+
|
|
66
|
+
const sampler2D = new Sampler2D(sampler.data, sampler.itemSize, sampler.width, sampler.height);
|
|
67
|
+
|
|
68
|
+
const sample = [];
|
|
69
|
+
const res = 128;
|
|
70
|
+
|
|
71
|
+
const texel_size = 5;
|
|
72
|
+
const grid_size = 18;
|
|
73
|
+
|
|
74
|
+
for (let i = 0; i < res; i++) {
|
|
75
|
+
const u = i / (res - 1);
|
|
76
|
+
for (let j = 0; j < res; j++) {
|
|
77
|
+
const v = j / (res - 1);
|
|
78
|
+
|
|
79
|
+
sampler2D.sampleBicubicUV(u, v, sample);
|
|
80
|
+
|
|
81
|
+
const view = new EmptyView({
|
|
82
|
+
css: {
|
|
83
|
+
background: `rgb(${sample[0]}, ${sample[1]}, ${sample[2]})`,
|
|
84
|
+
height: texel_size + 'px',
|
|
85
|
+
width: texel_size + 'px',
|
|
86
|
+
willChange: 'transform'
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const transform = new Transform();
|
|
91
|
+
|
|
92
|
+
transform.position.set(
|
|
93
|
+
u * grid_size + 1,
|
|
94
|
+
1,
|
|
95
|
+
v * grid_size + 1
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
new EntityBuilder()
|
|
99
|
+
.add(transform)
|
|
100
|
+
.add(new HeadsUpDisplay())
|
|
101
|
+
.add(new ViewportPosition())
|
|
102
|
+
.add(GUIElement.fromView(view))
|
|
103
|
+
.build(ecd);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
*
|
|
111
|
+
* @param {EngineHarness} harness
|
|
112
|
+
*/
|
|
113
|
+
async function init(harness) {
|
|
114
|
+
const engine = eh.engine;
|
|
115
|
+
|
|
116
|
+
await makeConfig(engine).apply(engine);
|
|
117
|
+
|
|
118
|
+
await eh.initialize();
|
|
119
|
+
|
|
120
|
+
main(engine);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
init(eh);
|
|
@@ -909,7 +909,7 @@ class Terrain {
|
|
|
909
909
|
|
|
910
910
|
worker.setHeightSampler(s.data, s.itemSize, s.width, s.height);
|
|
911
911
|
|
|
912
|
-
|
|
912
|
+
return worker.computeHeightRange()
|
|
913
913
|
.then(({ min, max }) => {
|
|
914
914
|
this.tiles.setHeightRange(min, max);
|
|
915
915
|
});
|
|
@@ -1038,13 +1038,22 @@ class Terrain {
|
|
|
1038
1038
|
heightSampler: this.samplerHeight
|
|
1039
1039
|
});
|
|
1040
1040
|
|
|
1041
|
+
|
|
1041
1042
|
const result = promise.then(() => {
|
|
1042
1043
|
|
|
1043
|
-
|
|
1044
|
-
|
|
1044
|
+
const ref = this.__material_reference;
|
|
1045
|
+
|
|
1046
|
+
let mat = this.material;
|
|
1047
|
+
|
|
1048
|
+
if (ref !== null && ref.getValue() !== null) {
|
|
1049
|
+
mat = ref.getValue();
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
mat.aoMap = true;
|
|
1053
|
+
mat.needsUpdate = true;
|
|
1045
1054
|
|
|
1046
|
-
|
|
1047
|
-
|
|
1055
|
+
mat.uniforms.aoMap.value = texture;
|
|
1056
|
+
mat.uniforms.aoMapIntensity.value = 0.7;
|
|
1048
1057
|
|
|
1049
1058
|
return texture;
|
|
1050
1059
|
});
|
|
@@ -585,6 +585,7 @@ GraphicsEngine.prototype.renderOpaque = function () {
|
|
|
585
585
|
GraphicsEngine.prototype.renderTransparent = function () {
|
|
586
586
|
const scene = this.scene;
|
|
587
587
|
|
|
588
|
+
// clear background, as transparent pass is drawn on top, the background should already be composited
|
|
588
589
|
const _background = scene.background;
|
|
589
590
|
scene.background = null;
|
|
590
591
|
|
|
@@ -596,8 +597,6 @@ GraphicsEngine.prototype.renderTransparent = function () {
|
|
|
596
597
|
|
|
597
598
|
// restore background
|
|
598
599
|
scene.background = _background;
|
|
599
|
-
|
|
600
|
-
// TODO render transparent objects into a buffer, to be able to apply post-fx
|
|
601
600
|
};
|
|
602
601
|
|
|
603
602
|
/**
|
|
@@ -8,8 +8,6 @@ import PathFollowingSystem from "../../navigation/ecs/path_following/PathFollowi
|
|
|
8
8
|
import SteeringSystem from "../../ecs/systems/SteeringSystem.js";
|
|
9
9
|
import MotionSystem from "../../ecs/systems/MotionSystem.js";
|
|
10
10
|
import TagSystem from "../../ecs/systems/TagSystem.js";
|
|
11
|
-
import { AttachmentSocketsSystem } from "../../ecs/sockets/AttachmentSocketsSystem.js";
|
|
12
|
-
import { AttachmentSystem } from "../../ecs/attachment/AttachmentSystem.js";
|
|
13
11
|
import { SoundEmitterSystem } from "../../sound/ecs/emitter/SoundEmitterSystem.js";
|
|
14
12
|
import SoundControllerSystem from "../../sound/ecs/SoundControllerSystem.js";
|
|
15
13
|
import SoundListenerSystem from "../../sound/ecs/SoundListenerSystem.js";
|
|
@@ -84,8 +82,6 @@ function makeConfig(engine) {
|
|
|
84
82
|
new SteeringSystem(),
|
|
85
83
|
new MotionSystem(),
|
|
86
84
|
new TagSystem(),
|
|
87
|
-
new AttachmentSocketsSystem(),
|
|
88
|
-
new AttachmentSystem(),
|
|
89
85
|
new SoundEmitterSystem(assetManager, sound.destination, sound.context),
|
|
90
86
|
new SoundControllerSystem(),
|
|
91
87
|
new SoundListenerSystem(sound.context),
|
|
@@ -39,6 +39,35 @@ export class ShadedGeometry {
|
|
|
39
39
|
* @private
|
|
40
40
|
*/
|
|
41
41
|
this.__bvh_leaf = new LeafNode(this, 0, 0, 0, 0, 0, 0);
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Transient, assigned in the system
|
|
45
|
+
* @type {number}
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
this.__entity = -1;
|
|
49
|
+
/**
|
|
50
|
+
* Transform matrix
|
|
51
|
+
* Transient, assigned in the system
|
|
52
|
+
* @type {number[]|null}
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
this.__transform = null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Global transform matrix
|
|
60
|
+
* 4x4 matrix
|
|
61
|
+
* @return {null|number[]}
|
|
62
|
+
*/
|
|
63
|
+
get transform() {
|
|
64
|
+
if (this.__transform !== null) {
|
|
65
|
+
return this.__transform;
|
|
66
|
+
} else if (this.__cached_object !== null) {
|
|
67
|
+
return this.__cached_object.matrix.elements;
|
|
68
|
+
} else {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
42
71
|
}
|
|
43
72
|
|
|
44
73
|
__build_object() {
|