@woosh/meep-engine 2.36.18 → 2.36.19
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/engine/ecs/components/Renderable.js +3 -0
- package/engine/ecs/systems/RenderSystem.js +10 -7
- package/engine/graphics/ecs/highlight/renderer/OutlineRenderer.js +39 -34
- package/engine/graphics/ecs/highlight/system/ShadedGeometryHighlightSystem.js +4 -8
- package/engine/graphics/ecs/mesh-v2/render/SGThreeObjectCache.js +38 -0
- package/engine/graphics/ecs/mesh-v2/render/adapters/GenericRendererAdapter.js +4 -14
- package/engine/graphics/micron/plugin/GLTFAssetTransformer.js +2 -0
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Created by Alex on 01/04/2014.
|
|
3
3
|
*/
|
|
4
|
-
import {System} from '../System.js';
|
|
4
|
+
import { System } from '../System.js';
|
|
5
5
|
import Renderable from '../components/Renderable.js';
|
|
6
|
-
import {Transform} from '../transform/Transform.js';
|
|
7
|
-
import {SignalBinding} from "../../../core/events/signal/SignalBinding.js";
|
|
8
|
-
import {Box3} from "three";
|
|
9
|
-
import {RenderableFlags} from "../components/RenderableFlags.js";
|
|
10
|
-
import {rootObject3DFastMatrixUpdate} from "../../graphics/ecs/mesh/rootObject3DFastMatrixUpdate.js";
|
|
11
|
-
import {updateNodeByTransformAndBBB} from "../../graphics/ecs/mesh/updateNodeByTransformAndBBB.js";
|
|
6
|
+
import { Transform } from '../transform/Transform.js';
|
|
7
|
+
import { SignalBinding } from "../../../core/events/signal/SignalBinding.js";
|
|
8
|
+
import { Box3 } from "three";
|
|
9
|
+
import { RenderableFlags } from "../components/RenderableFlags.js";
|
|
10
|
+
import { rootObject3DFastMatrixUpdate } from "../../graphics/ecs/mesh/rootObject3DFastMatrixUpdate.js";
|
|
11
|
+
import { updateNodeByTransformAndBBB } from "../../graphics/ecs/mesh/updateNodeByTransformAndBBB.js";
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -43,6 +43,9 @@ export function three_computeObjectBoundingBox(object, result) {
|
|
|
43
43
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* @deprecated use {@link ShadedGeometry} instead
|
|
48
|
+
*/
|
|
46
49
|
class RenderSystem extends System {
|
|
47
50
|
/**
|
|
48
51
|
*
|
|
@@ -35,18 +35,49 @@ void main(){
|
|
|
35
35
|
}
|
|
36
36
|
`;
|
|
37
37
|
|
|
38
|
+
const material_id_vertex_shader_skinned = `
|
|
39
|
+
#include <common>
|
|
40
|
+
#include <uv_pars_vertex>
|
|
41
|
+
#include <displacementmap_pars_vertex>
|
|
42
|
+
#include <morphtarget_pars_vertex>
|
|
43
|
+
#include <skinning_pars_vertex>
|
|
44
|
+
#include <logdepthbuf_pars_vertex>
|
|
45
|
+
#include <clipping_planes_pars_vertex>
|
|
46
|
+
|
|
47
|
+
void main()
|
|
48
|
+
{
|
|
49
|
+
#include <uv_vertex>
|
|
50
|
+
#include <skinbase_vertex>
|
|
51
|
+
#ifdef USE_DISPLACEMENTMAP
|
|
52
|
+
#include <beginnormal_vertex>
|
|
53
|
+
#include <morphnormal_vertex>
|
|
54
|
+
#include <skinnormal_vertex>
|
|
55
|
+
#endif
|
|
56
|
+
#include <begin_vertex>
|
|
57
|
+
#include <morphtarget_vertex>
|
|
58
|
+
#include <skinning_vertex>
|
|
59
|
+
#include <displacementmap_vertex>
|
|
60
|
+
#include <project_vertex>
|
|
61
|
+
#include <logdepthbuf_vertex>
|
|
62
|
+
#include <clipping_planes_vertex>
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
const material_id_vertex_shader_static = `
|
|
68
|
+
void main()
|
|
69
|
+
{
|
|
70
|
+
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
|
|
71
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
|
|
38
75
|
function makeIdMaterialStatic() {
|
|
39
76
|
return new ShaderMaterial({
|
|
40
77
|
uniforms: {
|
|
41
78
|
id: { value: 0 }
|
|
42
79
|
},
|
|
43
|
-
vertexShader:
|
|
44
|
-
void main()
|
|
45
|
-
{
|
|
46
|
-
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
|
|
47
|
-
gl_Position = projectionMatrix * mvPosition;
|
|
48
|
-
}
|
|
49
|
-
`,
|
|
80
|
+
vertexShader: material_id_vertex_shader_static,
|
|
50
81
|
fragmentShader: material_id_fragment_shader
|
|
51
82
|
});
|
|
52
83
|
}
|
|
@@ -59,33 +90,7 @@ function makeIdMaterialSkinned() {
|
|
|
59
90
|
uniforms: {
|
|
60
91
|
id: { value: 0 }
|
|
61
92
|
},
|
|
62
|
-
vertexShader:
|
|
63
|
-
#include <common>
|
|
64
|
-
#include <uv_pars_vertex>
|
|
65
|
-
#include <displacementmap_pars_vertex>
|
|
66
|
-
#include <morphtarget_pars_vertex>
|
|
67
|
-
#include <skinning_pars_vertex>
|
|
68
|
-
#include <logdepthbuf_pars_vertex>
|
|
69
|
-
#include <clipping_planes_pars_vertex>
|
|
70
|
-
|
|
71
|
-
void main()
|
|
72
|
-
{
|
|
73
|
-
#include <uv_vertex>
|
|
74
|
-
#include <skinbase_vertex>
|
|
75
|
-
#ifdef USE_DISPLACEMENTMAP
|
|
76
|
-
#include <beginnormal_vertex>
|
|
77
|
-
#include <morphnormal_vertex>
|
|
78
|
-
#include <skinnormal_vertex>
|
|
79
|
-
#endif
|
|
80
|
-
#include <begin_vertex>
|
|
81
|
-
#include <morphtarget_vertex>
|
|
82
|
-
#include <skinning_vertex>
|
|
83
|
-
#include <displacementmap_vertex>
|
|
84
|
-
#include <project_vertex>
|
|
85
|
-
#include <logdepthbuf_vertex>
|
|
86
|
-
#include <clipping_planes_vertex>
|
|
87
|
-
}
|
|
88
|
-
`,
|
|
93
|
+
vertexShader: material_id_vertex_shader_skinned,
|
|
89
94
|
fragmentShader: material_id_fragment_shader
|
|
90
95
|
});
|
|
91
96
|
}
|
|
@@ -3,7 +3,7 @@ import { HighlightRenderElementSource } from "../plugin/HighlightRenderElementSo
|
|
|
3
3
|
import Highlight from "../Highlight.js";
|
|
4
4
|
import { OutlineRenderPlugin } from "../plugin/OutlineRenderPlugin.js";
|
|
5
5
|
import { ShadedGeometry } from "../../mesh-v2/ShadedGeometry.js";
|
|
6
|
-
import {
|
|
6
|
+
import { SGThreeObjectCache } from "../../mesh-v2/render/SGThreeObjectCache.js";
|
|
7
7
|
|
|
8
8
|
class Supplier extends HighlightRenderElementSource {
|
|
9
9
|
/**
|
|
@@ -35,10 +35,10 @@ class Supplier extends HighlightRenderElementSource {
|
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
*
|
|
38
|
-
* @type {
|
|
38
|
+
* @type {SGThreeObjectCache}
|
|
39
39
|
* @private
|
|
40
40
|
*/
|
|
41
|
-
this.__object_cache =
|
|
41
|
+
this.__object_cache = SGThreeObjectCache.INSTANCE;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
collect(pool, group) {
|
|
@@ -85,11 +85,7 @@ class Supplier extends HighlightRenderElementSource {
|
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if(object === undefined){
|
|
91
|
-
object = build_three_object(sg);
|
|
92
|
-
}
|
|
88
|
+
const object = this.__object_cache.get(sg);
|
|
93
89
|
|
|
94
90
|
object.matrixWorld.elements = sg.transform;
|
|
95
91
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { build_three_object } from "../build_three_object.js";
|
|
2
|
+
|
|
3
|
+
export class SGThreeObjectCache {
|
|
4
|
+
constructor() {
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @type {WeakMap<ShadedGeometry, THREE.Object3D>}
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
this.__object_cache = new WeakMap();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param {ShadedGeometry} sg
|
|
16
|
+
* @returns {THREE.Object3D}
|
|
17
|
+
*/
|
|
18
|
+
get(sg) {
|
|
19
|
+
|
|
20
|
+
const existing_object = this.__object_cache.get(sg);
|
|
21
|
+
|
|
22
|
+
if (existing_object !== undefined) {
|
|
23
|
+
return existing_object;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const new_object = build_three_object(sg);
|
|
27
|
+
|
|
28
|
+
this.__object_cache.set(sg, new_object);
|
|
29
|
+
|
|
30
|
+
return new_object;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @readonly
|
|
36
|
+
* @type {SGThreeObjectCache}
|
|
37
|
+
*/
|
|
38
|
+
SGThreeObjectCache.INSTANCE = new SGThreeObjectCache();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractRenderAdapter } from "./AbstractRenderAdapter.js";
|
|
2
2
|
import { array_copy } from "../../../../../../core/collection/array/copyArray.js";
|
|
3
|
-
import {
|
|
3
|
+
import { SGThreeObjectCache } from "../SGThreeObjectCache.js";
|
|
4
4
|
|
|
5
5
|
export class GenericRendererAdapter extends AbstractRenderAdapter {
|
|
6
6
|
constructor() {
|
|
@@ -8,10 +8,10 @@ export class GenericRendererAdapter extends AbstractRenderAdapter {
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
11
|
-
* @type {
|
|
11
|
+
* @type {SGThreeObjectCache}
|
|
12
12
|
* @private
|
|
13
13
|
*/
|
|
14
|
-
this.__cache =
|
|
14
|
+
this.__cache = SGThreeObjectCache.INSTANCE;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
|
|
@@ -29,21 +29,11 @@ export class GenericRendererAdapter extends AbstractRenderAdapter {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
add(sg) {
|
|
32
|
-
const cache = this.__cache;
|
|
33
|
-
|
|
34
32
|
/**
|
|
35
33
|
*
|
|
36
34
|
* @type {THREE.Object3D}
|
|
37
35
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (object === undefined) {
|
|
41
|
-
|
|
42
|
-
object = build_three_object(sg);
|
|
43
|
-
|
|
44
|
-
cache.set(sg, object);
|
|
45
|
-
|
|
46
|
-
}
|
|
36
|
+
const object = this.__cache.get(sg);
|
|
47
37
|
|
|
48
38
|
array_copy(sg.__transform, 0, object.matrixWorld.elements, 0, 16);
|
|
49
39
|
|
|
@@ -203,6 +203,8 @@ export class GLTFAssetTransformer extends AssetTransformer {
|
|
|
203
203
|
return source;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
+
this.__load_mesh_micron_data(source.gltf,asset_description);
|
|
207
|
+
|
|
206
208
|
// attempt to load existing micron geometries
|
|
207
209
|
await async_traverse_three_object(root, this.__visitObjectToLoadMicron, this, {
|
|
208
210
|
asset: asset_description
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"productName": "Meep",
|
|
6
6
|
"description": "production-ready JavaScript game engine based on Entity Component System Architecture",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.36.
|
|
8
|
+
"version": "2.36.19",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"gl-matrix": "3.4.3",
|
|
11
11
|
"fast-levenshtein": "2.0.6",
|