@woosh/meep-engine 2.33.24 → 2.33.28
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/binary/BitSet.js +151 -167
- package/core/binary/BitSet.spec.js +99 -1
- package/core/binary/ValidatingBitSetWrapper.js +81 -0
- package/core/bvh2/aabb3/AABB3.js +3 -10
- package/core/bvh2/binary/IndexedBinaryBVH.js +1 -1
- package/core/bvh2/traversal/ThreeClippingPlaneComputingBVHVisitor.js +5 -1
- package/core/bvh2/traversal/__detailed_box_volume_intersection.js +22 -5
- package/core/cache/Cache.d.ts +4 -2
- package/core/cache/Cache.js +5 -2
- package/core/collection/HashMap.d.ts +9 -2
- package/core/collection/HashSet.d.ts +7 -2
- package/core/collection/HashSet.js +7 -2
- package/core/collection/array/binarySearchHighIndex.js +1 -1
- package/core/collection/array/copyArray.js +2 -2
- package/core/collection/array/typed/typed_array_copy.js +1 -1
- package/core/geom/3d/frustum/array_setFromProjectionMatrix.js +3 -3
- package/core/geom/3d/normal/hemioct/unit_hemioct.spec.js +1 -1
- package/core/geom/3d/shape/AbstractShape3D.js +37 -1
- package/core/geom/3d/shape/TransformedShape3D.js +121 -10
- package/core/geom/3d/shape/TransformedShape3D.spec.js +33 -0
- package/core/geom/3d/shape/UnionShape3D.js +255 -0
- package/core/geom/3d/shape/UnitCubeShape3D.js +88 -0
- package/core/geom/3d/shape/UnitCubeShape3D.spec.js +42 -0
- package/core/geom/3d/shape/UnitSphereShape3D.js +39 -0
- package/core/geom/3d/shape/util/compute_signed_distance_gradient_by_sampling.js +48 -0
- package/core/geom/3d/shape/util/shape_to_visual_entity.js +159 -0
- package/core/geom/random/randomPointInSphere.js +3 -2
- package/core/json/resolvePathByArray.js +2 -2
- package/core/model/ObservedBoolean.d.ts +2 -0
- package/core/parser/simple/Token.d.ts +13 -0
- package/core/parser/simple/Token.js +61 -27
- package/{engine/graphics/render/forward_plus/materials → core/primitives/strings}/insert_after.js +3 -0
- package/core/primitives/strings/insert_after_or_replace.js +27 -0
- package/editor/process/symbolic/makeHelperBoxGeometry.js +44 -0
- package/editor/tools/FoliagePaintTool.js +4 -4
- package/editor/view/ecs/EntityEditor.js +2 -2
- package/editor/view/ecs/components/particles/ParticleEmitterController.js +2 -2
- package/engine/EngineHarness.js +1 -0
- package/engine/animation/AnimationUtils.js +5 -5
- package/engine/asset/loaders/GLTFAssetLoader.js +52 -1
- package/engine/asset/loaders/image/ImageDecoderWorker.js +4 -3
- package/engine/asset/loaders/image/ImageRGBADataAsset.js +3 -2
- package/engine/asset/loaders/image/ImageRGBADataLoader.js +3 -3
- package/engine/asset/loaders/image/codec/NativeImageDecoder.js +2 -1
- package/engine/asset/loaders/image/png/PNG.js +113 -6
- package/engine/asset/loaders/image/png/PNGReader.js +5 -0
- package/engine/asset/loaders/material/bitmap2sampler_gl.js +1 -1
- package/engine/asset/loaders/material/computeImageBitmapEquality.js +6 -1
- package/engine/asset/loaders/material/computeTextureEquality.js +40 -49
- package/engine/ecs/EntityBuilder.js +25 -5
- package/engine/ecs/EntityComponentDataset.js +1 -1
- package/engine/ecs/attachment/AttachmentBinding.js +8 -0
- package/engine/ecs/attachment/AttachmentSystem.js +4 -0
- package/engine/ecs/attachment/TransformAttachmentBinding.js +14 -44
- package/engine/ecs/components/Tag.js +27 -6
- package/engine/ecs/foliage/InstancedFoliage.js +277 -266
- package/engine/ecs/foliage/ecs/Foliage2System.js +7 -7
- package/engine/ecs/foliage/ecs/InstancedMeshComponent.js +37 -0
- package/engine/ecs/foliage/ecs/{Foliage2.js → InstancedMeshLayer.js} +3 -45
- package/engine/ecs/foliage/ecs/InstancedMeshSerializationAdapter.js +6 -5
- package/engine/ecs/foliage/ecs/InstancedMeshUtils.js +7 -6
- package/engine/ecs/fow/FogOfWar.js +4 -0
- package/engine/ecs/fow/FogOfWarSystem.js +2 -0
- package/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +2 -0
- package/engine/ecs/storage/binary/BinarySerializationRegistry.js +1 -1
- package/engine/ecs/system/AbstractContextSystem.js +1 -1
- package/engine/ecs/systems/TagSystem.js +17 -0
- package/engine/ecs/terrain/ecs/layers/TerrainLayer.js +12 -16
- package/engine/ecs/transform/Transform.js +19 -6
- package/engine/graphics/GraphicsEngine.js +11 -6
- package/engine/graphics/composit/CompositLayer.js +17 -4
- package/engine/graphics/composit/CompositingStages.js +8 -0
- package/engine/graphics/composit/LayerCompositer.js +35 -6
- package/engine/graphics/ecs/highlight/plugin/OutlineRenderPlugin.js +11 -7
- package/engine/graphics/ecs/light/Light.js +2 -0
- package/engine/graphics/ecs/light/binding/three/ThreeLightBinding.js +5 -1
- package/engine/graphics/ecs/mesh-v2/DrawMode.js +5 -0
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +32 -18
- package/engine/graphics/geometry/instancing/InstancedMeshGroup.js +14 -72
- package/engine/graphics/geometry/instancing/rewriteMaterial.js +70 -0
- package/engine/graphics/material/manager/MaterialManager.js +2 -1
- package/engine/graphics/micron/render/instanced/AttributeDataTexture.js +6 -4
- package/engine/graphics/micron/render/instanced/ThreeInstancedAdapter.js +0 -2
- package/engine/graphics/particles/ParticleEmitterLibrary.js +3 -0
- package/engine/graphics/particles/ecs/{ParticleEmitterSystem2.js → ParticleEmitterSystem.js} +17 -9
- package/engine/graphics/particles/particular/engine/ParticularEngine.js +8 -2
- package/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +14 -25
- package/engine/graphics/particles/particular/engine/emitter/ParticleEmitterFlag.js +5 -0
- package/engine/graphics/particles/particular/engine/emitter/ParticlePool.js +90 -2
- package/engine/graphics/particles/particular/engine/emitter/ParticlePool.spec.js +7 -7
- package/engine/graphics/particles/particular/engine/renderers/billboard/BILLBOARD_PARTICLE_SPECIFICATION.js +15 -12
- package/engine/graphics/particles/particular/engine/renderers/billboard/ParticleBillboardMaterial.js +262 -51
- package/engine/graphics/particles/particular/engine/shader/ShaderManager.js +81 -48
- package/engine/graphics/particles/particular/engine/shader/debugAtlas.js +14 -0
- package/engine/graphics/particles/particular/engine/utils/volume/AttributeValue.js +141 -0
- package/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.js +148 -54
- package/engine/graphics/particles/particular/engine/utils/volume/lut_to_sampler.js +27 -0
- package/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +544 -164
- package/engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js +15 -10
- package/engine/graphics/render/forward_plus/materials/FP_INJECTION_POINT_ACCUMULATION.js +1 -0
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_ACCUMULATION.js +32 -0
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_DECODE_PARS.js +51 -0
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_PREAMBLE.js +25 -0
- package/engine/graphics/render/forward_plus/materials/FPlusDebugMaterial.js +3 -3
- package/engine/graphics/render/forward_plus/materials/ForwardPlusThreeMaterial.js +1 -1
- package/engine/graphics/render/forward_plus/materials/fp_build_fragment_shader.js +31 -120
- package/engine/graphics/render/forward_plus/materials/fp_build_vertex_lighting_shared.js +35 -0
- package/engine/graphics/render/forward_plus/materials/fp_build_vertex_shader.js +4 -5
- package/engine/graphics/render/forward_plus/plugin/MaterialTransformer.js +10 -3
- package/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +588 -53
- package/engine/graphics/render/forward_plus/prototypeLightManager.js +31 -6
- package/engine/graphics/render/forward_plus/query/point_light_inside_volume.js +10 -9
- package/engine/graphics/shaders/TerrainShader.js +4 -5
- package/engine/graphics/shadows/ShadowMapRenderer.js +8 -2
- package/engine/graphics/texture/atlas/ManagedTextureAtlas.js +12 -1
- package/engine/graphics/texture/sampler/Sampler2D.js +3 -1
- package/engine/graphics/texture/sampler/convertTexture2Sampler2D.js +1 -1
- package/engine/graphics/texture/sampler/copy_Sampler2D_channel_data.js +66 -0
- package/engine/graphics/util/composeMatrix4.js +33 -23
- package/engine/graphics/util/decompose_matrix_4_array.js +61 -0
- package/engine/intelligence/behavior/ecs/BehaviorComponent.js +30 -14
- package/engine/knowledge/database/StaticKnowledgeDataTable.js +6 -1
- package/engine/navigation/ecs/components/Path.js +0 -5
- package/package.json +1 -1
- package/view/minimap/gl/MinimapWorldGL.js +12 -5
- package/core/geom/3d/shape/CompositeShape.js +0 -60
|
@@ -40,7 +40,7 @@ function obtainSampler(bitmap, ctx) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* Ref holding webgl context, being weak-ref, allows context to be removed when not in use
|
|
44
44
|
* @type {WeakRef<WebGL2RenderingContext>|null}
|
|
45
45
|
*/
|
|
46
46
|
let ctx_ref = null;
|
|
@@ -97,8 +97,13 @@ export function sampler_from_bitmap(bitmap) {
|
|
|
97
97
|
* @returns {boolean}
|
|
98
98
|
*/
|
|
99
99
|
export function computeImageBitmapEquality(a, b) {
|
|
100
|
+
if (a === b) {
|
|
101
|
+
// strict equality check, special case
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
100
104
|
|
|
101
105
|
if (a.width !== b.width || a.height !== b.height) {
|
|
106
|
+
// check dimensions
|
|
102
107
|
return false;
|
|
103
108
|
}
|
|
104
109
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { computeImageBitmapEquality } from "./computeImageBitmapEquality.js";
|
|
2
|
+
import { isArrayEqualStrict } from "../../../../core/collection/array/isArrayEqualStrict.js";
|
|
2
3
|
|
|
3
4
|
//
|
|
4
5
|
|
|
@@ -50,20 +51,10 @@ export function computeTextureEquality(a, b) {
|
|
|
50
51
|
const aMipmaps = a.mipmaps;
|
|
51
52
|
const bMipmaps = b.mipmaps;
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (n !== bMipmaps.length) {
|
|
54
|
+
if (!textureMipChainEqual(aMipmaps, bMipmaps)) {
|
|
56
55
|
return false;
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
for (let i = 0; i < n; i++) {
|
|
60
|
-
const aMipmap = aMipmaps[i];
|
|
61
|
-
const bMipmap = bMipmaps[i];
|
|
62
|
-
|
|
63
|
-
if (!textureMipmapEqual(aMipmap, bMipmap)) {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
58
|
}
|
|
68
59
|
|
|
69
60
|
//TODO implement support for other texture types
|
|
@@ -119,47 +110,52 @@ export function textureImagesEqual(a, b) {
|
|
|
119
110
|
const bMipmaps = bi.mipmaps;
|
|
120
111
|
|
|
121
112
|
//TODO should we ignore mipmaps if they are absent?
|
|
122
|
-
if (aMipmaps
|
|
123
|
-
if (bMipmaps === undefined) {
|
|
124
|
-
continue;
|
|
125
|
-
} else {
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
} else if (bMipmaps === undefined) {
|
|
113
|
+
if (!textureMipChainEqual(aMipmaps, bMipmaps)) {
|
|
129
114
|
return false;
|
|
130
115
|
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
}
|
|
131
119
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
120
|
+
// assume equivalent
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
*
|
|
126
|
+
* @param {[]} a
|
|
127
|
+
* @param {[]} b
|
|
128
|
+
* @returns {boolean}
|
|
129
|
+
*/
|
|
130
|
+
function textureMipChainEqual(a, b) {
|
|
131
|
+
if (a === undefined) {
|
|
132
|
+
if (b === undefined) {
|
|
133
|
+
return true;
|
|
134
|
+
} else {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
} else if (b === undefined) {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
135
140
|
|
|
136
|
-
|
|
137
|
-
* @type {Uint8Array}
|
|
138
|
-
*/
|
|
139
|
-
const aData = aMipmap.data;
|
|
141
|
+
const a_length = a.length;
|
|
140
142
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
if (a_length !== b.length) {
|
|
144
|
+
// different mip chain length
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
145
147
|
|
|
146
|
-
|
|
147
|
-
if (dataLength !== bData.length) {
|
|
148
|
-
return false;
|
|
149
|
-
}
|
|
148
|
+
for (let j = a_length - 1; j >= 0; j--) { //traverse chain top to bottom, starting from smallest mip for faster rejection
|
|
150
149
|
|
|
150
|
+
const aMipmap = a[j];
|
|
151
|
+
const bMipmap = b[j];
|
|
151
152
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return false;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
153
|
+
if (!textureMipmapEqual(aMipmap, bMipmap)) {
|
|
154
|
+
return false;
|
|
158
155
|
}
|
|
159
156
|
|
|
160
157
|
}
|
|
161
158
|
|
|
162
|
-
// assume equivalent
|
|
163
159
|
return true;
|
|
164
160
|
}
|
|
165
161
|
|
|
@@ -182,16 +178,11 @@ function textureMipmapEqual(a, b) {
|
|
|
182
178
|
const aData = a.data;
|
|
183
179
|
const bData = b.data;
|
|
184
180
|
|
|
185
|
-
const n = aData.length;
|
|
186
|
-
if (bData.length !== n) {
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
181
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
182
|
+
if (aData === bData) {
|
|
183
|
+
// special case
|
|
184
|
+
return true;
|
|
194
185
|
}
|
|
195
186
|
|
|
196
|
-
return
|
|
187
|
+
return isArrayEqualStrict(aData, bData);
|
|
197
188
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Signal from "../../core/events/signal/Signal.js";
|
|
2
2
|
import { assert } from "../../core/assert.js";
|
|
3
3
|
import { EventType } from "./EntityManager.js";
|
|
4
|
+
import { isDefined } from "../../core/process/matcher/Matchers.js";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
*
|
|
@@ -63,7 +64,6 @@ class EntityBuilder {
|
|
|
63
64
|
this.on = {
|
|
64
65
|
built: new Signal()
|
|
65
66
|
};
|
|
66
|
-
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/**
|
|
@@ -238,10 +238,10 @@ class EntityBuilder {
|
|
|
238
238
|
this.dataset.addEntityEventListener(this.entity, eventName, listener, context);
|
|
239
239
|
} else {
|
|
240
240
|
this.deferredListeners.push({
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
241
|
+
name: eventName,
|
|
242
|
+
listener: listener,
|
|
243
|
+
context
|
|
244
|
+
});
|
|
245
245
|
}
|
|
246
246
|
return this;
|
|
247
247
|
}
|
|
@@ -356,6 +356,26 @@ class EntityBuilder {
|
|
|
356
356
|
this.on.built.send2(entity, dataset);
|
|
357
357
|
return entity;
|
|
358
358
|
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
*
|
|
362
|
+
* @param {number} entity
|
|
363
|
+
* @param {EntityComponentDataset} dataset
|
|
364
|
+
* @returns {EntityBuilder}
|
|
365
|
+
*/
|
|
366
|
+
static readFromDataset(entity, dataset) {
|
|
367
|
+
const r = new EntityBuilder();
|
|
368
|
+
|
|
369
|
+
dataset.getAllComponents(entity)
|
|
370
|
+
.filter(isDefined)
|
|
371
|
+
.forEach(r.add, r);
|
|
372
|
+
|
|
373
|
+
r.setFlag(EntityBuilderFlags.Built);
|
|
374
|
+
r.entity = entity;
|
|
375
|
+
r.dataset = dataset;
|
|
376
|
+
|
|
377
|
+
return r;
|
|
378
|
+
}
|
|
359
379
|
}
|
|
360
380
|
|
|
361
381
|
/**
|
|
@@ -1212,7 +1212,7 @@ export class EntityComponentDataset {
|
|
|
1212
1212
|
|
|
1213
1213
|
if (!ENV_PRODUCTION) {
|
|
1214
1214
|
assert.isNumber(componentTypeIndex, "componentTypeIndex");
|
|
1215
|
-
assert.
|
|
1215
|
+
assert.isFunction(visitor, "visitor");
|
|
1216
1216
|
}
|
|
1217
1217
|
|
|
1218
1218
|
|
|
@@ -265,6 +265,8 @@ export class AttachmentSystem extends System {
|
|
|
265
265
|
//update iterator
|
|
266
266
|
this.waiting.splice(i, 1);
|
|
267
267
|
|
|
268
|
+
binding.link();
|
|
269
|
+
|
|
268
270
|
i--;
|
|
269
271
|
numRecords--;
|
|
270
272
|
}
|
|
@@ -305,6 +307,8 @@ export class AttachmentSystem extends System {
|
|
|
305
307
|
parentBindings.splice(i, 1);
|
|
306
308
|
}
|
|
307
309
|
|
|
310
|
+
attachmentBinding.unlink();
|
|
311
|
+
|
|
308
312
|
break;
|
|
309
313
|
}
|
|
310
314
|
}
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import Vector3 from "../../../core/geom/Vector3.js";
|
|
2
|
-
import { Matrix4, Quaternion as ThreeQuaternion } from "three";
|
|
3
1
|
import { AttachmentBinding } from "./AttachmentBinding.js";
|
|
4
|
-
import
|
|
2
|
+
import { mat4 } from "gl-matrix";
|
|
5
3
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const pScale = new Vector3();
|
|
11
|
-
const pPosition = new Vector3();
|
|
12
|
-
|
|
13
|
-
const attachmentM4 = new Matrix4();
|
|
14
|
-
|
|
15
|
-
const parentM4 = new Matrix4();
|
|
4
|
+
const scratch_m4_0 = new Float32Array(16);
|
|
5
|
+
const scratch_m4_1 = new Float32Array(16);
|
|
6
|
+
const scratch_m4_2 = new Float32Array(16);
|
|
16
7
|
|
|
17
8
|
export class TransformAttachmentBinding extends AttachmentBinding {
|
|
18
9
|
constructor() {
|
|
@@ -24,40 +15,19 @@ export class TransformAttachmentBinding extends AttachmentBinding {
|
|
|
24
15
|
* TODO make use of Transform.multiplyTransforms for better readability and performance
|
|
25
16
|
*/
|
|
26
17
|
update() {
|
|
27
|
-
const socketTransform = this.socket.transform;
|
|
28
|
-
|
|
29
|
-
threeQuaternion.copy(socketTransform.rotation);
|
|
30
|
-
|
|
31
|
-
socketM4.compose(socketTransform.position, threeQuaternion, socketTransform.scale);
|
|
32
|
-
|
|
33
|
-
const parentTransform = this.parentTransform;
|
|
34
|
-
|
|
35
|
-
threeQuaternion.copy(parentTransform.rotation);
|
|
36
|
-
|
|
37
|
-
parentM4.compose(parentTransform.position, threeQuaternion, parentTransform.scale);
|
|
38
|
-
|
|
39
|
-
const attachment = this.attachment;
|
|
40
|
-
const aT = attachment.transform;
|
|
41
|
-
|
|
42
|
-
threeQuaternion.copy(aT.rotation);
|
|
43
|
-
|
|
44
|
-
attachmentM4.compose(aT.position, threeQuaternion, aT.scale);
|
|
45
|
-
|
|
46
|
-
socketM4.multiplyMatrices(parentM4, socketM4);
|
|
47
|
-
socketM4.multiply(attachmentM4);
|
|
48
|
-
socketM4.decompose(pPosition, threeQuaternion, pScale);
|
|
49
|
-
|
|
50
|
-
const t = this.attachedTransform;
|
|
51
18
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
t.rotation.copy(threeQuaternion);
|
|
56
|
-
}
|
|
19
|
+
this.socket.transform.toMatrix4(scratch_m4_0);
|
|
20
|
+
this.parentTransform.toMatrix4(scratch_m4_1);
|
|
21
|
+
this.attachment.transform.toMatrix4(scratch_m4_2);
|
|
57
22
|
|
|
58
|
-
|
|
23
|
+
mat4.multiply(
|
|
24
|
+
scratch_m4_0, scratch_m4_1, scratch_m4_0
|
|
25
|
+
);
|
|
26
|
+
mat4.multiply(
|
|
27
|
+
scratch_m4_0, scratch_m4_0, scratch_m4_2
|
|
28
|
+
);
|
|
59
29
|
|
|
60
|
-
|
|
30
|
+
this.attachedTransform.fromMatrix4(scratch_m4_0);
|
|
61
31
|
}
|
|
62
32
|
|
|
63
33
|
link() {
|
|
@@ -81,6 +81,8 @@ export class Tag {
|
|
|
81
81
|
* @returns {boolean}
|
|
82
82
|
*/
|
|
83
83
|
add(value) {
|
|
84
|
+
assert.isString(value, 'value');
|
|
85
|
+
|
|
84
86
|
if (this.contains(value)) {
|
|
85
87
|
return false;
|
|
86
88
|
}
|
|
@@ -117,6 +119,8 @@ export class Tag {
|
|
|
117
119
|
* @returns {boolean}
|
|
118
120
|
*/
|
|
119
121
|
contains(value) {
|
|
122
|
+
assert.isString(value, 'value');
|
|
123
|
+
|
|
120
124
|
return this.values.indexOf(value) !== -1;
|
|
121
125
|
}
|
|
122
126
|
|
|
@@ -125,16 +129,20 @@ export class Tag {
|
|
|
125
129
|
* @param {string[]} values
|
|
126
130
|
*/
|
|
127
131
|
containsAll(values) {
|
|
128
|
-
|
|
132
|
+
assert.isArray(values, 'values');
|
|
133
|
+
|
|
134
|
+
const search_value_count = values.length;
|
|
135
|
+
|
|
136
|
+
const these_values = this.values;
|
|
137
|
+
const these_values_count = these_values.length;
|
|
129
138
|
|
|
130
|
-
|
|
131
|
-
const tagCount = values1.length;
|
|
139
|
+
let i = 0, j = 0;
|
|
132
140
|
|
|
133
|
-
main: for (
|
|
141
|
+
main: for (; i < search_value_count; i++) {
|
|
134
142
|
const v = values[i];
|
|
135
143
|
|
|
136
|
-
for (
|
|
137
|
-
const tag =
|
|
144
|
+
for (j = 0; j < these_values_count; j++) {
|
|
145
|
+
const tag = these_values[j];
|
|
138
146
|
|
|
139
147
|
if (tag === v) {
|
|
140
148
|
continue main;
|
|
@@ -287,6 +295,19 @@ export class Tag {
|
|
|
287
295
|
return result;
|
|
288
296
|
}
|
|
289
297
|
|
|
298
|
+
/**
|
|
299
|
+
*
|
|
300
|
+
* @param {string} tag
|
|
301
|
+
* @returns {Tag}
|
|
302
|
+
*/
|
|
303
|
+
static fromOne(tag) {
|
|
304
|
+
const r = new Tag();
|
|
305
|
+
|
|
306
|
+
r.add(tag);
|
|
307
|
+
|
|
308
|
+
return r;
|
|
309
|
+
}
|
|
310
|
+
|
|
290
311
|
|
|
291
312
|
/**
|
|
292
313
|
*
|