@woosh/meep-engine 2.120.4 → 2.121.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -9
- package/editor/view/node-graph/NodeGraphEditorView.d.ts.map +1 -1
- package/editor/view/node-graph/NodeGraphView.d.ts.map +1 -1
- package/editor/view/node-graph/NodeView.d.ts.map +1 -1
- package/editor/view/node-graph/PortView.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/codegen/LineBuilder.d.ts +2 -2
- package/src/core/codegen/LineBuilder.d.ts.map +1 -1
- package/src/core/codegen/LineBuilder.js +14 -9
- package/src/core/collection/array/array_set_diff_sorting.d.ts +1 -1
- package/src/core/collection/array/array_set_diff_sorting.js +1 -1
- package/src/core/color/oklab/find_cusp.d.ts.map +1 -1
- package/src/core/color/oklab/find_cusp.js +4 -1
- package/src/core/color/oklab/oklab_to_linear_srgb.d.ts.map +1 -1
- package/src/core/color/oklab/oklab_to_linear_srgb.js +1 -0
- package/src/core/color/operations/color_lighten.d.ts +1 -1
- package/src/core/color/operations/color_lighten.d.ts.map +1 -1
- package/src/core/color/operations/color_lighten.js +6 -1
- package/src/core/geom/Vector1.d.ts.map +1 -1
- package/src/core/geom/Vector1.js +15 -2
- package/src/core/process/action/AsynchronousDelayAction.js +1 -1
- package/src/engine/EntityCreator.js +1 -1
- package/src/engine/achievements/AchievementManager.js +1 -1
- package/src/engine/animation/AnimationUtils.js +1 -1
- package/src/engine/animation/async/prototypeAsyncAnimation.js +2 -2
- package/src/engine/animation/behavior/animateProperty.js +1 -1
- package/src/engine/animation/playTrackRealTime.js +1 -1
- package/src/engine/ecs/Entity.d.ts.map +1 -1
- package/src/engine/ecs/Entity.js +18 -7
- package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
- package/src/engine/ecs/EntityComponentDataset.js +14 -7
- package/src/engine/ecs/EntityReference.d.ts +4 -4
- package/src/engine/ecs/EntityReference.js +4 -4
- package/src/engine/ecs/dynamic_actions/DynamicActorSystem.js +1 -1
- package/src/engine/ecs/speaker/VoiceSystem.d.ts +8 -2
- package/src/engine/ecs/speaker/VoiceSystem.d.ts.map +1 -1
- package/src/engine/ecs/speaker/VoiceSystem.js +1 -1
- package/src/engine/ecs/util/hideEntityGracefully.js +3 -3
- package/src/engine/graphics/ecs/camera/filter/setup_filtered_camera_controller.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/filter/setup_filtered_camera_controller.js +6 -6
- package/src/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +1 -1
- package/src/engine/graphics/ecs/mesh-v2/aggregate/prototypeSGMesh.js +1 -1
- package/src/engine/graphics/ecs/mesh-v2/sample/prototypeShadedGeometry.js +2 -2
- package/src/engine/graphics/ecs/mesh-v2/sample/prototype_sg_raycast.js +1 -1
- package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +1 -1
- package/src/engine/graphics/ecs/trail2d/prototypeTrail2D.js +1 -1
- package/src/engine/graphics/impostors/octahedral/prototypeBaker.js +1 -1
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +2 -2
- package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +4 -4
- package/src/engine/graphics/sh3/path_tracer/make_one_vector3.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/make_sky_rtiw.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/make_zero_vector3.d.ts.map +1 -1
- package/src/engine/input/devices/PointerDevice.js +1 -1
- package/src/engine/intelligence/behavior/ecs/BehaviorComponent.d.ts +79 -3
- package/src/engine/intelligence/behavior/ecs/BehaviorComponent.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/ecs/BehaviorComponent.js +24 -8
- package/src/engine/intelligence/behavior/ecs/BehaviorComponentSerializationAdapter.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/ecs/BehaviorComponentSerializationAdapter.js +2 -2
- package/src/engine/intelligence/behavior/ecs/BehaviorSystem.d.ts +33 -7
- package/src/engine/intelligence/behavior/primitive/ActionBehavior.d.ts +3 -2
- package/src/engine/intelligence/behavior/primitive/ActionBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/primitive/ActionBehavior.js +7 -5
- package/src/engine/intelligence/behavior/primitive/SucceedingBehavior.d.ts +10 -9
- package/src/engine/intelligence/behavior/primitive/SucceedingBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/primitive/SucceedingBehavior.js +19 -20
- package/src/engine/physics/fluid/prototype.js +1 -1
- package/src/engine/physics/inverse_kinematics/fabrik/prototype.js +1 -1
package/README.md
CHANGED
|
@@ -20,20 +20,49 @@ Most of the test code is significantly larger than the code that is being tested
|
|
|
20
20
|
|
|
21
21
|
## Features
|
|
22
22
|
|
|
23
|
+
---
|
|
24
|
+
## Input
|
|
25
|
+
* Touch / Mouse / Keyboard device support
|
|
26
|
+
* Unified abstraction of input, offering both query and event-driven APIs
|
|
27
|
+
* Input binding implementation via `InputController` component
|
|
28
|
+
|
|
29
|
+
## Rendering & Lighting
|
|
23
30
|
### Automatic instancing
|
|
24
31
|
This will minimize the number of draw calls and improve performance.
|
|
25
|
-
### Decals
|
|
26
|
-
Decals in meep are done on the GPU, and as a result you can have a lot of them in your scene. The most I tested in a single scene is 1,000,000 which works quite well. Decals are useful for bullet holes, blood splatter and various scene decorations such as signs and scuff marks.
|
|
27
32
|
### Clustered lighting, aka Forward+
|
|
28
33
|
Meep implements clustered lighting technique which allows you to have a pretty much an unlimited number of point lights in your scene. All the other light types are supported as well, but only point lights are clustered for now. Point lights are useful for various effects, like muzzle flashes, grenade explosions, torches, etc.
|
|
34
|
+
### Terrain
|
|
35
|
+
The terrain engine is chunk-based, which means that terrain is split into rectangular pieces internally, and they are built on-the-fly inside a web-worker based on camera position. Terrain is automatically culled based on camera position, so you're only drawing the chunks that are in view. Terrain supports layers just like Unity, but unlike Unity - Meep supports up to 256 layers of terrain instead of 4.
|
|
36
|
+
### Path tracer
|
|
37
|
+
Pure JS implementation of a path tracer, using engine's BVH (See Physics section)
|
|
38
|
+
|
|
39
|
+
## Visual Effects
|
|
40
|
+
### Decals
|
|
41
|
+
Decals in meep are done on the GPU, and as a result you can have a lot of them in your scene. The most I tested in a single scene is 1,000,000 which works quite well. Decals are useful for bullet holes, blood splatter and various scene decorations such as signs and scuff marks.
|
|
29
42
|
### Particles
|
|
30
43
|
Meep's particle engine ("Particular") is optimized for game development needs, this means supporting complex effects and being able to spawn/destroy many particle systems every frame. There are a lot of particle engines out there, but they tend to have costly spawning routines, take up a lot of draw calls and not manage memory well, which leads to pretty poor performance in games. My particle engine supports full particle lighting as well, and soft particles. On top of that - all particles are automatically atlassed in the background and are compiled with just 4 shaders. This means that no matter how many particle effects you have - there will be no shader switching and no texture switching, and there will be no delays associated with shader compilation. Particles are culled, so particle systems that are off-screen are not rendered and simulation for them can be paused to save CPU resources (this is automatic behavior)
|
|
31
44
|
### Trails
|
|
32
45
|
Meep implements a fairly complex trail system, where a trail can be attached to an entity, and it will create a trail behind.
|
|
33
|
-
|
|
34
|
-
|
|
46
|
+
|
|
47
|
+
## Audio
|
|
35
48
|
### Sound engine
|
|
36
49
|
Meep has a custom sound engine which is culled and has custom attenuation, this allows scenes to have 1000s of positional audio sources without any extra cost in terms of performance
|
|
50
|
+
|
|
51
|
+
## Physics
|
|
52
|
+
### High performance spatial index
|
|
53
|
+
Meep features a BVH (bounding volume hierarchy) implementation optimized for speed and memory usage that provides a wide variety of spatial queries, such as:
|
|
54
|
+
* Ray
|
|
55
|
+
* Box
|
|
56
|
+
* Sphere
|
|
57
|
+
* Planar
|
|
58
|
+
* Frustum
|
|
59
|
+
* Point intersection
|
|
60
|
+
* Point distance
|
|
61
|
+
### Inverse kinematics
|
|
62
|
+
* Meep has 2 very useful IK solvers to fix foot position for characters on uneven terrain or stairs, aligning both the position and orientation of character feet. This works for hands as well if you want and is not limited to bipeds, the system works just as well for, say, spiders.
|
|
63
|
+
* Highly optimized FABRIK inverse kinematics solver for more complex IK use cases
|
|
64
|
+
|
|
65
|
+
## Other
|
|
37
66
|
### Asset streaming
|
|
38
67
|
Meep in general is a web-first engine, all assets are streamed, meaning that the engine is up and running even before any models/texture are loaded, and you're free to decide when to let the player see your level, wait until everything is loaded or drop them in as soon as you can. There is a pre-loader module in case you want to load some assets in bulk before starting the game.
|
|
39
68
|
### AI tools
|
|
@@ -44,11 +73,9 @@ including, but not limited to:
|
|
|
44
73
|
* state optimization (useful for decision-making)
|
|
45
74
|
* grid-based path finding (optimized for 10,000s of queries per second)
|
|
46
75
|
* resource allocation solver (useful for planning, given certain resources such as bullets/grenades/money/health - plan what actions to take to optimize your chances of winning)
|
|
47
|
-
* and a number of other useful tools to complement AI
|
|
48
|
-
### Inverse kinematics
|
|
49
|
-
Meep has 2 very useful IK solvers to fix foot position for characters on uneven terrain or stairs, aligning both the position and orientation of character feet. This works for hands as well if you want and is not limited to bipeds, the system works just as well for, say, spiders.
|
|
76
|
+
* and a number of other useful tools to complement development of game AI and other intelligent behavior use cases.
|
|
50
77
|
### High-performance serialization
|
|
51
|
-
Extremely compact serialization system. You can save/load your scenes from files. This serialization system supports format changes, so as you develop your game - old saves will be supported and the system will automatically upgrade them to the most recent version, so the player doesn't have to lose any data.
|
|
78
|
+
Extremely compact binary serialization system. You can save/load your scenes from files. This serialization system supports format changes, so as you develop your game - old saves will be supported and the system will automatically upgrade them to the most recent version, so the player doesn't have to lose any data.
|
|
52
79
|
### Achievements
|
|
53
80
|
Achievements work with Blackboard components and are very easy to define. There is an abstraction system that helps connect your achievements to various platforms such as Steam or XBox (you'd have to implement that binding yourself though), by default it comes with a browser backend, storing data in IndexedDB. I also have bindings for Steam and NewGrounds that I can share.
|
|
54
81
|
### UI system
|
|
@@ -58,4 +85,4 @@ You're free to use it or not, the engine works just fine without it. The system
|
|
|
58
85
|
For more information, please refer to the documentation
|
|
59
86
|
|
|
60
87
|
---
|
|
61
|
-
Copyright ©
|
|
88
|
+
Copyright © 2025 Company Named Limited, All Rights Reserved
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeGraphEditorView.d.ts","sourceRoot":"","sources":["NodeGraphEditorView.js"],"names":[],"mappings":"AAUA;IACI;;;;;;;OAOG;IACH,
|
|
1
|
+
{"version":3,"file":"NodeGraphEditorView.d.ts","sourceRoot":"","sources":["NodeGraphEditorView.js"],"names":[],"mappings":"AAUA;IACI;;;;;;;OAOG;IACH,8DANW,SAAS,EAqFnB;IA5EG;;;OAGG;IACH,QAFU,eAAe,CAEL;IACpB;;;OAGG;IACH,QAFU,mBAAmB,CAET;IAEpB;;;OAGG;IACH,OAFU,SAAS,CAED;IAElB,mBAAuC;IA6D3C,eAEC;IAED,yBAgEC;CACJ;iBAxKgB,2BAA2B;gCACG,oBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeGraphView.d.ts","sourceRoot":"","sources":["NodeGraphView.js"],"names":[],"mappings":"AAeA;IAEQ,kBAA6B;IAC7B;;;OAGG;IACH,OAFU,OAAO,CAEU;CAElC;AAOD;IACI;;;;;;OAMG;IACH,
|
|
1
|
+
{"version":3,"file":"NodeGraphView.d.ts","sourceRoot":"","sources":["NodeGraphView.js"],"names":[],"mappings":"AAeA;IAEQ,kBAA6B;IAC7B;;;OAGG;IACH,OAFU,OAAO,CAEU;CAElC;AAOD;IACI;;;;;;OAMG;IACH,2DALW,SAAS,EAsOnB;IA9NG;;;OAGG;IACH,QAFU,eAAe,CAEL;IAEpB;;;OAGG;IACH,OAFU,SAAS,CAED;IAElB;;;OAGG;IACH,QAFU,mBAAmB,CAET;IAEpB;;;OAGG;IACH,WAFU,IAAI,CAAC,MAAM,CAAC,CAEK;IAE3B,mBAAuC;IAwM3C,qCA8DC;IAGD;;;;;;;OAOG;IACH,wDAFa,OAAO,CAcnB;IAED;;;;;;OAMG;IACH,oBALW,wBAAwB,UACxB,OAAO,UACP,OAAO,YACP,cAAc,QAyCxB;IAED;;;;OAIG;IACH,mCAHW,yBAAyB,UACzB,OAAO,QAiBjB;IAED;;;;OAIG;IACH,kCAHW,OAAO,UACP,OAAO,QAUjB;IAED;;;;OAIG;IACH,kCAHW,OAAO,UACP,OAAO,QAUjB;CACJ;oBA9bmB,mCAAmC;oBACnC,mCAAmC;iBAHtC,2BAA2B;iBAM3B,2CAA2C;0CAGlB,sEAAsE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeView.d.ts","sourceRoot":"","sources":["NodeView.js"],"names":[],"mappings":"AAWA;IACI;;;;;;;OAOG;IACH,
|
|
1
|
+
{"version":3,"file":"NodeView.d.ts","sourceRoot":"","sources":["NodeView.js"],"names":[],"mappings":"AAWA;IACI;;;;;;;OAOG;IACH,4EANW,YAAY,EAkHtB;IAzGG;;;OAGG;IACH,MAFU,YAAY,CAEN;IAChB;;;OAGG;IACH,QAFU,cAAc,CAEJ;IAEpB,mBAAuC;IAgG3C,eAGC;CACJ;iBA/HgB,2BAA2B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PortView.d.ts","sourceRoot":"","sources":["PortView.js"],"names":[],"mappings":"AAUA;IACI;;;;;OAKG;IACH,
|
|
1
|
+
{"version":3,"file":"PortView.d.ts","sourceRoot":"","sources":["PortView.js"],"names":[],"mappings":"AAUA;IACI;;;;;OAKG;IACH,0CAJW,IAAI,EAkDd;IA3CG;;;OAGG;IACH,MAFU,IAAI,CAEE;IAChB;;;OAGG;IACH,QAFU,cAAc,CAEJ;IAEpB,mBAAuC;IAkC3C,eAEC;CACJ;iBApEgB,2BAA2B"}
|
package/package.json
CHANGED
|
@@ -37,7 +37,7 @@ declare class LineBuilder {
|
|
|
37
37
|
*/
|
|
38
38
|
indent(): LineBuilder;
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* NOTE: clamps indentation to 0 (can't go negative)
|
|
41
41
|
* @returns {LineBuilder}
|
|
42
42
|
*/
|
|
43
43
|
dedent(): LineBuilder;
|
|
@@ -54,7 +54,7 @@ declare class LineBuilder {
|
|
|
54
54
|
addLines(lines: LineBuilder): void;
|
|
55
55
|
clear(): void;
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* Renders out an indented string of lines
|
|
58
58
|
* @returns {string}
|
|
59
59
|
*/
|
|
60
60
|
build(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/codegen/LineBuilder.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"LineBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/codegen/LineBuilder.js"],"names":[],"mappings":";AAgCA;;GAEG;AACH;IAuJI;;;;OAIG;IACH,sBAJW,MAAM,mBACN,MAAM,GACJ,WAAW,CAuBvB;IAnKD;;;;OAIG;IACH,mBAFY,MAAM,CAIjB;IAED;;;OAGG;IACH,cAFU,MAAM,CAEqB;IAErC;;;OAGG;IACH,aAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,wBAFW,MAAM,GADL,OAAO,CAoBlB;IAED;;;OAGG;IACH,UAFa,WAAW,CAKvB;IAED;;;OAGG;IACH,UAFa,WAAW,CAQvB;IAED;;;;OAIG;IACH,eAHW,MAAM,GACJ,WAAW,CASvB;IAED;;;OAGG;IACH,gBAFW,WAAW,QAiBrB;IAED,cAGC;IAED;;;OAGG;IACH,SAFa,MAAM,CAyBlB;IA8BD,mBAEC;;CACJ"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { assert } from "../assert.js";
|
|
2
|
+
import { string_repeat } from "../primitives/strings/string_repeat.js";
|
|
2
3
|
|
|
3
4
|
class Line {
|
|
4
5
|
/**
|
|
@@ -103,13 +104,14 @@ class LineBuilder {
|
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
/**
|
|
106
|
-
*
|
|
107
|
+
* NOTE: clamps indentation to 0 (can't go negative)
|
|
107
108
|
* @returns {LineBuilder}
|
|
108
109
|
*/
|
|
109
110
|
dedent() {
|
|
110
|
-
assert.greaterThan(this.#indentation, 0, 'indentation is already at 0');
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
// clamp to 0
|
|
113
|
+
this.#indentation = Math.max(0, this.#indentation - 1);
|
|
114
|
+
|
|
113
115
|
return this;
|
|
114
116
|
}
|
|
115
117
|
|
|
@@ -154,23 +156,26 @@ class LineBuilder {
|
|
|
154
156
|
}
|
|
155
157
|
|
|
156
158
|
/**
|
|
157
|
-
*
|
|
159
|
+
* Renders out an indented string of lines
|
|
158
160
|
* @returns {string}
|
|
159
161
|
*/
|
|
160
162
|
build() {
|
|
161
163
|
const result = [];
|
|
162
164
|
|
|
163
|
-
let i, j, l;
|
|
164
|
-
|
|
165
165
|
const lines = this.#lines;
|
|
166
|
+
const line_count = lines.length;
|
|
167
|
+
|
|
168
|
+
const indent_string = string_repeat(' ', this.indentSpaces);
|
|
166
169
|
|
|
167
|
-
for (i = 0
|
|
170
|
+
for (let i = 0; i < line_count; i++) {
|
|
168
171
|
const line = lines[i];
|
|
169
172
|
|
|
170
173
|
let indentString = '';
|
|
171
174
|
|
|
172
|
-
|
|
173
|
-
|
|
175
|
+
const indent_count = line.indentation;
|
|
176
|
+
|
|
177
|
+
for (let j = 0; j < indent_count; j++) {
|
|
178
|
+
indentString += indent_string;
|
|
174
179
|
}
|
|
175
180
|
|
|
176
181
|
result.push(indentString + line.text);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @template T
|
|
4
4
|
* @param {T[]} a
|
|
5
5
|
* @param {T[]} b
|
|
6
|
-
* @param {function(a:T,b:T):number}
|
|
6
|
+
* @param {function(a:T,b:T):number} compare
|
|
7
7
|
* @returns {{uniqueA:T[], uniqueB:T[], common:T[]}}
|
|
8
8
|
*/
|
|
9
9
|
export function array_set_diff_sorting<T>(a: T[], b: T[], compare: any): {
|
|
@@ -7,7 +7,7 @@ import { assert } from "../../assert.js";
|
|
|
7
7
|
* @template T
|
|
8
8
|
* @param {T[]} a
|
|
9
9
|
* @param {T[]} b
|
|
10
|
-
* @param {function(a:T,b:T):number}
|
|
10
|
+
* @param {function(a:T,b:T):number} compare
|
|
11
11
|
* @returns {{uniqueA:T[], uniqueB:T[], common:T[]}}
|
|
12
12
|
*/
|
|
13
13
|
export function array_set_diff_sorting(a, b, compare) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find_cusp.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/oklab/find_cusp.js"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,kCAJW,MAAM,EAAE,KACR,MAAM,KACN,MAAM,
|
|
1
|
+
{"version":3,"file":"find_cusp.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/oklab/find_cusp.js"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,kCAJW,MAAM,EAAE,KACR,MAAM,KACN,MAAM,QAgBhB"}
|
|
@@ -19,7 +19,10 @@ export function find_cusp(output, a, b) {
|
|
|
19
19
|
|
|
20
20
|
// Convert to linear sRGB to find the first point where at least one of r,g or b >= 1:
|
|
21
21
|
oklab_to_linear_srgb(rgb_at_max, 1, S_cusp * a, S_cusp * b);
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
const max_component = max3(rgb_at_max[0], rgb_at_max[1], rgb_at_max[2]);
|
|
24
|
+
|
|
25
|
+
const L_cusp = Math.cbrt(1. / max_component);
|
|
23
26
|
const C_cusp = L_cusp * S_cusp;
|
|
24
27
|
|
|
25
28
|
output[0] = L_cusp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oklab_to_linear_srgb.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/oklab/oklab_to_linear_srgb.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,6CALW,MAAM,EAAE,KACR,MAAM,KACN,MAAM,KACN,MAAM,
|
|
1
|
+
{"version":3,"file":"oklab_to_linear_srgb.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/oklab/oklab_to_linear_srgb.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,6CALW,MAAM,EAAE,KACR,MAAM,KACN,MAAM,KACN,MAAM,QAehB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color_lighten.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/operations/color_lighten.js"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,qCAJW,KAAK,WACL,MAAM,GACJ,KAAK,
|
|
1
|
+
{"version":3,"file":"color_lighten.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/operations/color_lighten.js"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,qCAJW,KAAK,WACL,MAAM,GACJ,KAAK,CAoBjB;sBA9BqB,aAAa"}
|
|
@@ -9,13 +9,18 @@ const hsv = [0, 0, 0];
|
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
11
11
|
* @param {Color} input
|
|
12
|
-
* @param {number} amount
|
|
12
|
+
* @param {number} [amount]
|
|
13
13
|
* @returns {Color}
|
|
14
14
|
*/
|
|
15
15
|
export function color_lighten(input, amount = 1) {
|
|
16
16
|
assert.isNumber(amount, 'amount');
|
|
17
17
|
assert.greaterThanOrEqual(amount, 0, 'amount');
|
|
18
18
|
|
|
19
|
+
if (amount === 0) {
|
|
20
|
+
// skip allocation, no change
|
|
21
|
+
return input;
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
const r = new Color();
|
|
20
25
|
|
|
21
26
|
linear_srgb_to_okhsv(hsv, input.r, input.g, input.b);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Vector1.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector1.js"],"names":[],"mappings":";AAWA;
|
|
1
|
+
{"version":3,"file":"Vector1.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Vector1.js"],"names":[],"mappings":";AAWA;IA4QI;;;;;OAKG;IACH,kBAJW,OAAO,KACP,OAAO,G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C;IAaL;;;OAGG;IACH,oBAFU,OAAO,CAEU;IAXvB,sDAIC;CACJ;;;cAaS,OAAO;aAOP,OAAO;;mBA9TE,4BAA4B"}
|
package/src/core/geom/Vector1.js
CHANGED
|
@@ -45,7 +45,7 @@ class Vector1 extends Number {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* Currently held value
|
|
49
49
|
* @returns {number}
|
|
50
50
|
*/
|
|
51
51
|
getValue() {
|
|
@@ -53,7 +53,7 @@ class Vector1 extends Number {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
56
|
+
* Useful for sorting
|
|
57
57
|
* @param {Vector1} other
|
|
58
58
|
* @returns {number}
|
|
59
59
|
*/
|
|
@@ -101,10 +101,18 @@ class Vector1 extends Number {
|
|
|
101
101
|
return this.x === 0;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Increase value by 1.
|
|
106
|
+
* `value++`
|
|
107
|
+
*/
|
|
104
108
|
increment() {
|
|
105
109
|
this._add(1);
|
|
106
110
|
}
|
|
107
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Decrease value by 1.
|
|
114
|
+
* `value--`
|
|
115
|
+
*/
|
|
108
116
|
decrement() {
|
|
109
117
|
this._add(-1);
|
|
110
118
|
}
|
|
@@ -123,6 +131,7 @@ class Vector1 extends Number {
|
|
|
123
131
|
* @param {Vector1|Vector2|Vector3|Vector4} other
|
|
124
132
|
*/
|
|
125
133
|
add(other) {
|
|
134
|
+
assert.isObject(other,"other");
|
|
126
135
|
return this._add(other.x);
|
|
127
136
|
}
|
|
128
137
|
|
|
@@ -278,6 +287,8 @@ class Vector1 extends Number {
|
|
|
278
287
|
return a.x - b.x;
|
|
279
288
|
}
|
|
280
289
|
|
|
290
|
+
// pretending to be an array
|
|
291
|
+
|
|
281
292
|
get 0() {
|
|
282
293
|
return this.x;
|
|
283
294
|
}
|
|
@@ -302,12 +313,14 @@ Vector1.prototype.isVector1 = true;
|
|
|
302
313
|
Vector1.typeName = "Vector1";
|
|
303
314
|
|
|
304
315
|
/**
|
|
316
|
+
* Utility singleton
|
|
305
317
|
* @readonly
|
|
306
318
|
* @type {Vector1}
|
|
307
319
|
*/
|
|
308
320
|
Vector1.zero = Object.freeze(new Vector1(0));
|
|
309
321
|
|
|
310
322
|
/**
|
|
323
|
+
* Utility singleton
|
|
311
324
|
* @readonly
|
|
312
325
|
* @type {Vector1}
|
|
313
326
|
*/
|
|
@@ -25,7 +25,7 @@ export class AsynchronousDelayAction extends AsynchronousAction {
|
|
|
25
25
|
|
|
26
26
|
this.__entity = new Entity();
|
|
27
27
|
|
|
28
|
-
this.__entity.add(BehaviorComponent.
|
|
28
|
+
this.__entity.add(BehaviorComponent.from(
|
|
29
29
|
SequenceBehavior.from([
|
|
30
30
|
DelayBehavior.from(time),
|
|
31
31
|
new ActionBehavior(() => {
|
|
@@ -61,7 +61,7 @@ export function createSound(
|
|
|
61
61
|
|
|
62
62
|
builder
|
|
63
63
|
.add(SerializationMetadata.Transient) //make sound transient
|
|
64
|
-
.add(BehaviorComponent.
|
|
64
|
+
.add(BehaviorComponent.from(SequenceBehavior.from([
|
|
65
65
|
DelayBehavior.from(timeout),
|
|
66
66
|
DieBehavior.create()
|
|
67
67
|
])))
|
|
@@ -317,7 +317,7 @@ export class AchievementManager extends EnginePlugin {
|
|
|
317
317
|
DieBehavior.create()
|
|
318
318
|
]);
|
|
319
319
|
|
|
320
|
-
const cBehavior = BehaviorComponent.
|
|
320
|
+
const cBehavior = BehaviorComponent.from(sequenceBehavior);
|
|
321
321
|
|
|
322
322
|
//use system clock for behavior
|
|
323
323
|
cBehavior.clock = ClockChannelType.Simulation;
|
|
@@ -43,7 +43,7 @@ export function stopTrailAndNotifyOnceFinished(entity, ecd) {
|
|
|
43
43
|
trail.clearFlag(Trail2DFlags.Spawning);
|
|
44
44
|
|
|
45
45
|
new Entity()
|
|
46
|
-
.add(BehaviorComponent.
|
|
46
|
+
.add(BehaviorComponent.from(SequenceBehavior.from([
|
|
47
47
|
DelayBehavior.fromJSON({ value: trail.maxAge }),
|
|
48
48
|
new ActionBehavior(resolve)
|
|
49
49
|
])))
|
|
@@ -179,7 +179,7 @@ async function main(engine) {
|
|
|
179
179
|
// simulate data arriving from the network
|
|
180
180
|
const sample_delay = RandomDelayBehavior.from(0.5, 1);
|
|
181
181
|
new Entity()
|
|
182
|
-
.add(BehaviorComponent.
|
|
182
|
+
.add(BehaviorComponent.from(RepeatBehavior.from(
|
|
183
183
|
SequenceBehavior.from([
|
|
184
184
|
sample_delay,
|
|
185
185
|
new ActionBehavior(addSample)
|
|
@@ -219,7 +219,7 @@ async function main(engine) {
|
|
|
219
219
|
width: 0.2
|
|
220
220
|
}))
|
|
221
221
|
.add(ShadedGeometry.from(new OctahedronBufferGeometry(1, 5), new MeshStandardMaterial()))
|
|
222
|
-
.add(BehaviorComponent.
|
|
222
|
+
.add(BehaviorComponent.from(RepeatBehavior.from(
|
|
223
223
|
new ActionBehavior((delta) => {
|
|
224
224
|
if (sim_parameters.playing) {
|
|
225
225
|
sim_parameters.play_time += delta;
|
|
@@ -25,7 +25,7 @@ export async function animateProperty(ecd, entity, component, property, target,
|
|
|
25
25
|
|
|
26
26
|
const builder = new Entity()
|
|
27
27
|
.add(SerializationMetadata.Transient)
|
|
28
|
-
.add(BehaviorComponent.
|
|
28
|
+
.add(BehaviorComponent.from(SequenceBehavior.from([
|
|
29
29
|
TransitionPropertyVectorXBehavior.from({
|
|
30
30
|
component,
|
|
31
31
|
path: property,
|
|
@@ -15,7 +15,7 @@ export function playTrackRealTime(track, ecd) {
|
|
|
15
15
|
|
|
16
16
|
const entity = new Entity();
|
|
17
17
|
|
|
18
|
-
const behaviorComponent = BehaviorComponent.
|
|
18
|
+
const behaviorComponent = BehaviorComponent.from(new AnimationBehavior(track));
|
|
19
19
|
|
|
20
20
|
behaviorComponent.clock = ClockChannelType.System;
|
|
21
21
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Entity.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/Entity.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Entity.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/Entity.js"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH;IA2aI;;;;;OAKG;IACH,+BAJW,MAAM,WACN,sBAAsB,GACpB,MAAM,CAgBlB;IA7bD;;;OAGG;IACH,oBAFU,eAAe,CAES;IAWlC;;;OAGG;IACH,UAFW,MAAM,EAIhB;IAdD;;;OAGG;IACH,UAFa,MAAM,CAIlB;IAmBD;;;OAGG;IACH,kBAFW,MAAM,EAIhB;IAfD;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IAWD;;;;OAIG;IACH,2BAAgB;IAQhB;;;;OAIG;IACH,SAFU,sBAAsB,CAEjB;IAEf;;;OAGG;IACH,OAFU,WAAW,GAAC,MAAM,CAEN;IAEtB;;;;OAIG;IACH,yBAAgB;IAEhB;;OAEG;IACH;QACI;;WAEG;;MAEL;IAUF;;;OAGG;IACH,eAFW,MAAM,GAAC,WAAW,QAI5B;IAED;;;;OAIG;IACH,cAHW,MAAM,GAAC,WAAW,GAChB,OAAO,CAMnB;IAED;;;OAGG;IACH,gBAFW,MAAM,GAAC,WAAW,QAI5B;IAED;;;OAGG;IACH,eAFa,OAAO,CAInB;IAED;;OAEG;IACH,4BAQC;IAED;;;OAGG;IACH,aAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,IAJa,CAAC,qBACH,CAAC,GACC,MAAM,CAuBlB;IAED;;;;OAIG;IACH,aAJa,CAAC,SACH,CAAC,GACC,OAAO,CAInB;IAED;;;;OAIG;IACH,aAJa,CAAC,SACH,KAAK,CAAC,CAAC,CAAC,GACN,CAAC,GAAC,IAAI,CAclB;IAED;;;;;OAKG;IACH,iBAJa,CAAC,SACH,KAAK,CAAC,CAAC,CAAC,GACN,CAAC,CAUb;IAED;;;;OAIG;IACH,kCAFa,GAAC,GAAC,IAAI,CA0BlB;IAED;;;;OAIG;IACH,qBAHW,MAAM,UACN,GAAC,QAQX;IAED;;;OAGG;IACH,wBAFW,MAAM,gBAiBhB;IAED;;;;;;OAMG;IACH,4BALW,MAAM,gCAEN,GAAC,GACC,MAAM,CAalB;IAED;;;;;;OAMG;IACH,+BALW,MAAM,gCAEN,GAAC,GACC,MAAM,CAyBlB;IAED;;;OAGG;IACH,WAFa,OAAO,CAwBnB;IAED;;;;OAIG;IACH,eAFW,sBAAsB,GADpB,MAAM,CAyDlB;IAyBL;;;;OAIG;IACH,mBAFU,OAAO,CAEQ;;CAPxB;;gCAxf+B,sBAAsB;4BAD1B,kBAAkB;mBAF3B,oCAAoC"}
|
package/src/engine/ecs/Entity.js
CHANGED
|
@@ -58,7 +58,7 @@ const DEFAULT_FLAGS =
|
|
|
58
58
|
* entity.destroy();
|
|
59
59
|
*
|
|
60
60
|
*/
|
|
61
|
-
class Entity {
|
|
61
|
+
export class Entity {
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
64
|
* @readonly
|
|
@@ -80,7 +80,7 @@ class Entity {
|
|
|
80
80
|
* @param {number} v
|
|
81
81
|
*/
|
|
82
82
|
set id(v) {
|
|
83
|
-
|
|
83
|
+
throw new Error(`Deprecated, use .reference or static construction method`);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
/**
|
|
@@ -97,11 +97,11 @@ class Entity {
|
|
|
97
97
|
* @param {number} v
|
|
98
98
|
*/
|
|
99
99
|
set generation(v) {
|
|
100
|
-
|
|
100
|
+
throw new Error(`Deprecated, use .reference or static construction method`);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
|
-
* Components associated with the entity
|
|
104
|
+
* Components associated with the entity. Do not modify directly
|
|
105
105
|
* @readonly
|
|
106
106
|
* @type {Array}
|
|
107
107
|
*/
|
|
@@ -114,7 +114,8 @@ class Entity {
|
|
|
114
114
|
#deferredListeners = [];
|
|
115
115
|
|
|
116
116
|
/**
|
|
117
|
-
*
|
|
117
|
+
* Dataset in which this entity exists, if built. If not built - null.
|
|
118
|
+
* Do not modify directly
|
|
118
119
|
* @type {EntityComponentDataset}
|
|
119
120
|
*/
|
|
120
121
|
dataset = null;
|
|
@@ -127,6 +128,7 @@ class Entity {
|
|
|
127
128
|
|
|
128
129
|
/**
|
|
129
130
|
* Arbitrary metadata, add anything you want here
|
|
131
|
+
* @readonly
|
|
130
132
|
* @type {Object}
|
|
131
133
|
*/
|
|
132
134
|
properties = {};
|
|
@@ -135,6 +137,9 @@ class Entity {
|
|
|
135
137
|
* @readonly
|
|
136
138
|
*/
|
|
137
139
|
on = {
|
|
140
|
+
/**
|
|
141
|
+
* Fired when {@link build} is called
|
|
142
|
+
*/
|
|
138
143
|
built: new Signal()
|
|
139
144
|
};
|
|
140
145
|
|
|
@@ -217,7 +222,13 @@ class Entity {
|
|
|
217
222
|
this.components.push(componentInstance);
|
|
218
223
|
|
|
219
224
|
if (this.getFlag(EntityFlags.Built)) {
|
|
225
|
+
|
|
220
226
|
//already built, add component to entity
|
|
227
|
+
|
|
228
|
+
if (this.getFlag(EntityFlags.RegisterComponents)) {
|
|
229
|
+
this.dataset.registerComponentType(componentInstance.constructor)
|
|
230
|
+
}
|
|
231
|
+
|
|
221
232
|
this.dataset.addComponentToEntity(this.id, componentInstance);
|
|
222
233
|
}
|
|
223
234
|
|
|
@@ -424,10 +435,10 @@ class Entity {
|
|
|
424
435
|
|
|
425
436
|
if (
|
|
426
437
|
this.getFlag(EntityFlags.Built)
|
|
427
|
-
&& checkExistingComponents(this.id, this.components, dataset)
|
|
438
|
+
&& checkExistingComponents(this.reference.id, this.components, dataset)
|
|
428
439
|
) {
|
|
429
440
|
//already built
|
|
430
|
-
return this.id;
|
|
441
|
+
return this.reference.id;
|
|
431
442
|
}
|
|
432
443
|
|
|
433
444
|
const entity = dataset.createEntity();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityComponentDataset.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityComponentDataset.js"],"names":[],"mappings":"AA4GA;;;;;;;;;;;;;;;;;GAiBG;AACH;IAEI;;;OAGG;IACH,wBAA+B;IAE/B;;;;;OAKG;IACH,yBAAsC;IAEtC;;;OAGG;IACH,2BAAkC;IAElC;;;OAGG;IACH,yBAAsB;IAEtB;;;;OAIG;IACH,4BAAgC;IAEhC;;;;OAIG;IACH,2BAAuB;IAEvB;;;OAGG;IACH,mBAAgB;IAEhB;;;;OAIG;IACH,oBAAgB;IAEhB;;;;;;;OAOG;IACH,mBAAe;IAEf;;;OAGG;IACH,0BAFU,MAAM,CAAC,MAAM,CAAC,CAEO;IAE/B;;;OAGG;IACH,0BAFU,MAAM,CAEe;IAG/B;;;;OAIG;IACH,+BAA4B;IAE5B;;;;OAIG;IACH,kCAA+B;IAE/B;;;OAGG;IACH,kBAAe;IAGf;;;;;;OAMG;IACH,iBALa,CAAC,EAAE,CAAC,UACN,GAAG,iBACH,CAAC,GACC,OAAO,CAAC,CAAC,CAAC,CAoCtB;IAED;;;;;OAKG;IACH,sBAJW,cAAc,cACd,OAAO,GACL,OAAO,CAqDnB;IAED;;;;;OAKG;IACH,yBAJW,cAAc,cACd,OAAO,GACL,OAAO,CAuDnB;IAED;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,yBAFa,MAAM,CAIlB;IAED;;;;;OAKG;IACH,sBAJW,MAAM,kCAoChB;IAED;;;;OAIG;IACH,4BAHW,MAAM,GACJ,EAAE,CAyBd;IAED;;;;OAIG;IACH,yBAHW,KAAK,EAAE,QAwLjB;IAED;;;;OAIG;IACH,mCAHW,KAAK,EAAE,GACL,OAAO,CAYnB;IAED
|
|
1
|
+
{"version":3,"file":"EntityComponentDataset.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityComponentDataset.js"],"names":[],"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;IACH,8CAFW,GAAC,QAgBX;IAGL;;;OAGG;IACH,mCAFU,OAAO,CAEwC;CANxD;mBAx2DkB,oCAAoC"}
|
|
@@ -678,6 +678,8 @@ export class EntityComponentDataset {
|
|
|
678
678
|
}
|
|
679
679
|
|
|
680
680
|
/**
|
|
681
|
+
* Does this dataset have a given component registered?
|
|
682
|
+
* Use {@link registerComponentType}/{@link unregisterComponentType} to alter registered set
|
|
681
683
|
* @param {Class|Function} type
|
|
682
684
|
* @return {boolean}
|
|
683
685
|
*/
|
|
@@ -719,11 +721,11 @@ export class EntityComponentDataset {
|
|
|
719
721
|
/**
|
|
720
722
|
* Attempt to add a component class to dataset registry
|
|
721
723
|
* @param {Class|Function} type
|
|
722
|
-
* @returns {boolean} true if component successfully added, false
|
|
724
|
+
* @returns {boolean} true if component successfully added, false if component is already registered
|
|
723
725
|
*/
|
|
724
726
|
registerComponentType(type) {
|
|
725
727
|
if (this.isComponentTypeRegistered(type)) {
|
|
726
|
-
//already registered
|
|
728
|
+
// already registered
|
|
727
729
|
return false;
|
|
728
730
|
}
|
|
729
731
|
|
|
@@ -737,11 +739,11 @@ export class EntityComponentDataset {
|
|
|
737
739
|
/**
|
|
738
740
|
* Attempt to remove a component class from the registry
|
|
739
741
|
* @param {Class} type
|
|
740
|
-
* @returns {boolean}
|
|
742
|
+
* @returns {boolean} true iff component is removed, false if it was not registered
|
|
741
743
|
*/
|
|
742
744
|
unregisterComponentType(type) {
|
|
743
745
|
if (this.isComponentTypeRegistered(type)) {
|
|
744
|
-
//not registered
|
|
746
|
+
// not registered
|
|
745
747
|
return false;
|
|
746
748
|
}
|
|
747
749
|
|
|
@@ -771,6 +773,7 @@ export class EntityComponentDataset {
|
|
|
771
773
|
|
|
772
774
|
const new_generation_table = new Uint32Array(new_size);
|
|
773
775
|
|
|
776
|
+
// copy over old data
|
|
774
777
|
new_generation_table.set(this.entityGeneration);
|
|
775
778
|
|
|
776
779
|
this.entityGeneration = new_generation_table
|
|
@@ -783,6 +786,7 @@ export class EntityComponentDataset {
|
|
|
783
786
|
*/
|
|
784
787
|
getEntityGeneration(entity_id) {
|
|
785
788
|
assert.isNonNegativeInteger(entity_id, 'entity_id');
|
|
789
|
+
assert.ok(this.entityExists(entity_id),`Entity ${entity_id} does not exist`);
|
|
786
790
|
|
|
787
791
|
return this.entityGeneration[entity_id];
|
|
788
792
|
}
|
|
@@ -863,6 +867,8 @@ export class EntityComponentDataset {
|
|
|
863
867
|
* @returns {boolean} true if entity was removed, false if it doesn't exist
|
|
864
868
|
*/
|
|
865
869
|
removeEntity(entity_id) {
|
|
870
|
+
assert.isNonNegativeInteger(entity_id, 'entity_id');
|
|
871
|
+
|
|
866
872
|
if (!this.entityExists(entity_id)) {
|
|
867
873
|
// entity doesn't exist
|
|
868
874
|
return false;
|
|
@@ -902,6 +908,7 @@ export class EntityComponentDataset {
|
|
|
902
908
|
|
|
903
909
|
/**
|
|
904
910
|
* Convenience method for removal of multiple entities
|
|
911
|
+
* Works the same as {@link removeEntity} but for multiple elements
|
|
905
912
|
* @param {number[]} entityIndices
|
|
906
913
|
*/
|
|
907
914
|
removeEntities(entityIndices) {
|
|
@@ -1030,10 +1037,10 @@ export class EntityComponentDataset {
|
|
|
1030
1037
|
*
|
|
1031
1038
|
* Associate a component with a particular entity
|
|
1032
1039
|
* @template C
|
|
1033
|
-
* @param {number}
|
|
1040
|
+
* @param {number} entity_id
|
|
1034
1041
|
* @param {C} componentInstance
|
|
1035
1042
|
*/
|
|
1036
|
-
addComponentToEntity(
|
|
1043
|
+
addComponentToEntity(entity_id, componentInstance) {
|
|
1037
1044
|
|
|
1038
1045
|
assert.notNull(componentInstance, "componentInstance");
|
|
1039
1046
|
|
|
@@ -1053,7 +1060,7 @@ export class EntityComponentDataset {
|
|
|
1053
1060
|
throw new Error(`Component class not found in this dataset for componentInstance ${stringifyComponent(componentInstance)}`);
|
|
1054
1061
|
}
|
|
1055
1062
|
|
|
1056
|
-
this.addComponentToEntityByIndex(
|
|
1063
|
+
this.addComponentToEntityByIndex(entity_id, componentTypeIndex, componentInstance);
|
|
1057
1064
|
}
|
|
1058
1065
|
|
|
1059
1066
|
/**
|