simulationjsv2 0.7.3 → 0.8.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/dist/geometry.js CHANGED
@@ -1,37 +1,22 @@
1
1
  import { mat4, vec2, vec3 } from 'wgpu-matrix';
2
- import { cloneBuf, interpolateColors, matrix4, vector2, vector2FromVector3, vector3, vector3FromVector2, vertex } from './utils.js';
2
+ import { cloneBuf, matrix4, vector2, vector2FromVector3, vector3, vector3FromVector2 } from './utils.js';
3
3
  import { CubicBezierCurve2d } from './graphics.js';
4
- import { BUF_LEN } from './constants.js';
5
- import { bufferGenerator, lossyTriangulate, lossyTriangulateStrip, triangulateWireFrameOrder } from './internalUtils.js';
4
+ import { createIndexArray, lossyTriangulate, lossyTriangulateStrip, triangulateWireFrameOrder } from './internalUtils.js';
6
5
  export class Geometry {
7
6
  vertices;
8
- geometryType;
7
+ topology;
9
8
  constructor(vertices = [], geometryType = 'list') {
10
9
  this.vertices = vertices;
11
- this.geometryType = geometryType;
10
+ this.topology = geometryType;
12
11
  }
13
- getType() {
14
- return this.geometryType;
12
+ getTopology() {
13
+ return this.topology;
15
14
  }
16
- getTriangleVertexCount() {
17
- return this.triangleOrder.length;
15
+ getIndexes(wireframe) {
16
+ return wireframe ? this.wireframeOrder : this.triangleOrder;
18
17
  }
19
- getWireframeVertexCount() {
20
- return this.wireframeOrder.length;
21
- }
22
- bufferFromOrder(order, color, vertexParamGenerator) {
23
- return order
24
- .map((vertexIndex) => {
25
- const pos = this.vertices[vertexIndex];
26
- return bufferGenerator.generate(pos[0], pos[1], pos[2], color, vector2(), vertexParamGenerator);
27
- })
28
- .flat();
29
- }
30
- getWireframeBuffer(color, vertexParamGenerator) {
31
- return this.bufferFromOrder(this.wireframeOrder, color, vertexParamGenerator);
32
- }
33
- getTriangleBuffer(color, vertexParamGenerator) {
34
- return this.bufferFromOrder(this.triangleOrder, color, vertexParamGenerator);
18
+ getVertices() {
19
+ return this.vertices;
35
20
  }
36
21
  }
37
22
  export class PlaneGeometry extends Geometry {
@@ -40,7 +25,7 @@ export class PlaneGeometry extends Geometry {
40
25
  triangleOrder;
41
26
  rawVertices;
42
27
  constructor(vertices) {
43
- super();
28
+ super([], 'strip');
44
29
  this.wireframeOrder = [];
45
30
  this.triangleOrder = [];
46
31
  this.rawVertices = vertices;
@@ -51,18 +36,7 @@ export class PlaneGeometry extends Geometry {
51
36
  this.rawVertices = vertices;
52
37
  this.vertices = vertices.map((vertex) => vertex.getPos());
53
38
  this.wireframeOrder = triangulateWireFrameOrder(this.vertices.length);
54
- this.triangleOrder = lossyTriangulate(Array(this.rawVertices.length)
55
- .fill(0)
56
- .map((_, index) => index)).flat();
57
- }
58
- getTriangleBuffer(color, vertexParamGenerator) {
59
- return this.triangleOrder
60
- .map((index) => {
61
- const vertex = this.rawVertices[index];
62
- const pos = vertex.getPos();
63
- return bufferGenerator.generate(pos[0], pos[1], pos[2], vertex.getColor() || color, vector2(), vertexParamGenerator);
64
- })
65
- .flat();
39
+ this.triangleOrder = lossyTriangulateStrip(createIndexArray(this.rawVertices.length));
66
40
  }
67
41
  }
68
42
  export class CubeGeometry extends Geometry {
@@ -70,15 +44,15 @@ export class CubeGeometry extends Geometry {
70
44
  wireframeOrder = [0, 1, 2, 3, 0, 2, 6, 5, 1, 6, 7, 4, 5, 7, 3, 4, 0, 5, 6, 3];
71
45
  // prettier-ignore
72
46
  triangleOrder = [
73
- 0, 1, 2, 0, 2, 3,
74
- 4, 5, 6, 4, 6, 7,
75
- 0, 3, 7, 0, 7, 4,
76
- 0, 4, 5, 0, 5, 1,
77
- 1, 2, 6, 1, 5, 6,
78
- 2, 3, 7, 2, 6, 7
47
+ 0, 1, 3, 2,
48
+ 4, 7, 5, 6,
49
+ 0, 3, 4, 7,
50
+ 0, 4, 1, 5,
51
+ 1, 5, 2, 6,
52
+ 2, 6, 3, 7
79
53
  ];
80
54
  constructor(width, height, depth) {
81
- super();
55
+ super([], 'strip');
82
56
  this.params = {
83
57
  width,
84
58
  height,
@@ -118,27 +92,16 @@ export class CubeGeometry extends Geometry {
118
92
  }
119
93
  export class SquareGeometry extends Geometry {
120
94
  wireframeOrder = [0, 1, 2, 3, 0, 2];
121
- triangleOrder = [0, 1, 3, 2];
95
+ triangleOrder = [0, 3, 1, 2];
122
96
  params;
123
- constructor(width, height, centerOffset) {
97
+ constructor(width, height) {
124
98
  super([], 'strip');
125
99
  this.params = {
126
100
  width,
127
- height,
128
- colorMap: {},
129
- centerOffset: centerOffset || vector2(0, 0)
101
+ height
130
102
  };
131
103
  this.recompute();
132
104
  }
133
- setOffset(offset) {
134
- this.params.centerOffset = offset;
135
- }
136
- getOffset() {
137
- return this.params.centerOffset;
138
- }
139
- setVertexColorMap(colorMap) {
140
- this.params.colorMap = colorMap;
141
- }
142
105
  setWidth(width) {
143
106
  this.params.width = width;
144
107
  }
@@ -146,22 +109,13 @@ export class SquareGeometry extends Geometry {
146
109
  this.params.height = height;
147
110
  }
148
111
  recompute() {
149
- const centerOffset = this.params.centerOffset;
150
112
  this.vertices = [
151
- vector3(-this.params.width * centerOffset[0], this.params.height * centerOffset[1]),
152
- vector3(this.params.width * (1 - centerOffset[0]), this.params.height * centerOffset[1]),
153
- vector3(this.params.width * (1 - centerOffset[0]), -this.params.height * (1 - centerOffset[1])),
154
- vector3(-this.params.width * centerOffset[0], -this.params.height * (1 - centerOffset[1]))
113
+ vector3(-this.params.width, this.params.height),
114
+ vector3(this.params.width, this.params.height),
115
+ vector3(this.params.width, -this.params.height),
116
+ vector3(-this.params.width, -this.params.height)
155
117
  ];
156
118
  }
157
- getTriangleBuffer(color, vertexParamGenerator) {
158
- return this.triangleOrder
159
- .map((vertexIndex) => {
160
- const pos = this.vertices[vertexIndex];
161
- return bufferGenerator.generate(pos[0], pos[1], pos[2], this.params.colorMap[vertexIndex] || color, vector2(), vertexParamGenerator);
162
- })
163
- .flat();
164
- }
165
119
  }
166
120
  export class BlankGeometry extends Geometry {
167
121
  wireframeOrder = [];
@@ -186,14 +140,6 @@ export class CircleGeometry extends Geometry {
186
140
  setRadius(radius) {
187
141
  this.params.radius = radius;
188
142
  }
189
- updateWireframeOrder() {
190
- this.wireframeOrder = triangulateWireFrameOrder(this.vertices.length);
191
- }
192
- updateTriangleOrder() {
193
- this.triangleOrder = lossyTriangulate(Array(this.vertices.length)
194
- .fill(0)
195
- .map((_, index) => index)).flat();
196
- }
197
143
  recompute() {
198
144
  const vertices = [];
199
145
  const rotationInc = (Math.PI * 2) / this.params.detail;
@@ -205,16 +151,16 @@ export class CircleGeometry extends Geometry {
205
151
  vertices.push(vector3(vec[0], vec[1], vec[2]));
206
152
  }
207
153
  this.vertices = vertices;
208
- this.updateTriangleOrder();
209
- this.updateWireframeOrder();
154
+ this.triangleOrder = lossyTriangulate(createIndexArray(this.vertices.length)).flat();
155
+ this.wireframeOrder = triangulateWireFrameOrder(this.vertices.length);
210
156
  }
211
157
  }
212
158
  export class Spline2dGeometry extends Geometry {
213
159
  wireframeOrder;
214
160
  triangleOrder;
215
161
  params;
216
- constructor(points, color, thickness, detail) {
217
- super();
162
+ constructor(points, thickness, detail) {
163
+ super([], 'strip');
218
164
  this.wireframeOrder = [];
219
165
  this.triangleOrder = [];
220
166
  this.params = {
@@ -225,8 +171,8 @@ export class Spline2dGeometry extends Geometry {
225
171
  interpolateStart: 0,
226
172
  interpolateLimit: 1,
227
173
  thickness: thickness,
228
- color: color,
229
- vertexColors: []
174
+ vertexInterpolations: [],
175
+ curveVertexIndices: []
230
176
  };
231
177
  this.computeCurves();
232
178
  this.recompute();
@@ -237,6 +183,15 @@ export class Spline2dGeometry extends Geometry {
237
183
  updateInterpolationLimit(limit) {
238
184
  this.params.interpolateLimit = Math.min(1, Math.max(0, limit));
239
185
  }
186
+ getInterpolationStart() {
187
+ return this.params.interpolateStart;
188
+ }
189
+ getInterpolationLimit() {
190
+ return this.params.interpolateLimit;
191
+ }
192
+ getDistance() {
193
+ return this.params.distance;
194
+ }
240
195
  updatePoint(pointIndex, newPoint) {
241
196
  if (pointIndex < 0 && pointIndex >= this.params.points.length)
242
197
  return;
@@ -254,18 +209,15 @@ export class Spline2dGeometry extends Geometry {
254
209
  updateThickness(thickness) {
255
210
  this.params.thickness = thickness;
256
211
  }
257
- getVertexCount() {
258
- return this.triangleOrder.length * BUF_LEN;
259
- }
260
- getWireframeVertexCount() {
261
- return this.getVertexCount();
262
- }
263
- getTriangleVertexCount() {
264
- return this.getVertexCount();
265
- }
266
212
  getCurves() {
267
213
  return this.params.curves;
268
214
  }
215
+ getVertexInterpolations() {
216
+ return this.params.vertexInterpolations;
217
+ }
218
+ getCurveVertexIndices() {
219
+ return this.params.curveVertexIndices;
220
+ }
269
221
  computeCurves() {
270
222
  this.params.curves = [];
271
223
  this.params.distance = 0;
@@ -277,7 +229,7 @@ export class Spline2dGeometry extends Geometry {
277
229
  vec2.negate(prevControl, prevControl);
278
230
  const prevColors = this.params.points[i - 1].getColors();
279
231
  if (prevColors.at(-1)) {
280
- prevColor = prevColors.at(-1) || null;
232
+ prevColor = prevColors.at(-1) ?? null;
281
233
  }
282
234
  }
283
235
  const bezierPoints = this.params.points[i].getVectorArray(i > 0 ? vector2FromVector3(this.params.points[i - 1].getEnd().getPos()) : null, prevControl);
@@ -286,18 +238,16 @@ export class Spline2dGeometry extends Geometry {
286
238
  this.params.curves.push(curve);
287
239
  }
288
240
  }
289
- updateWireframeOrder() {
290
- this.wireframeOrder = triangulateWireFrameOrder(this.vertices.length);
291
- }
292
241
  recompute() {
293
- this.params.vertexColors = [];
294
242
  this.vertices = [];
295
- let verticesTop = [];
243
+ this.params.vertexInterpolations = [];
244
+ this.params.curveVertexIndices = [];
245
+ const verticesTop = [];
296
246
  const verticesBottom = [];
297
247
  let currentDistance = 0;
298
248
  let interpolationStarted = false;
299
249
  outer: for (let i = 0; i < this.params.curves.length; i++) {
300
- const detail = this.params.curves[i].getDetail() || this.params.detail;
250
+ const detail = this.params.curves[i].getDetail() ?? this.params.detail;
301
251
  const step = 1 / detail;
302
252
  const distanceRatio = currentDistance / this.params.distance;
303
253
  if (distanceRatio > this.params.interpolateLimit)
@@ -305,6 +255,7 @@ export class Spline2dGeometry extends Geometry {
305
255
  const curveLength = this.params.curves[i].getLength();
306
256
  currentDistance += curveLength;
307
257
  const sectionRatio = curveLength / this.params.distance;
258
+ let curveVertexIndexSet = i === 0;
308
259
  for (let j = 0; j < detail + 1; j++) {
309
260
  let currentInterpolation = step * j;
310
261
  let atLimit = false;
@@ -320,79 +271,42 @@ export class Spline2dGeometry extends Geometry {
320
271
  currentInterpolation = (this.params.interpolateStart - distanceRatio) / sectionRatio;
321
272
  j--;
322
273
  }
274
+ if (!curveVertexIndexSet) {
275
+ this.params.curveVertexIndices.push(verticesTop.length);
276
+ curveVertexIndexSet = true;
277
+ }
323
278
  const [point2d, slope] = this.params.curves[i].interpolateSlope(currentInterpolation);
324
279
  const point = vector3FromVector2(point2d);
325
280
  const normal = vector2(-slope[1], slope[0]);
326
281
  vec2.normalize(normal, normal);
327
282
  vec2.scale(normal, this.params.thickness / 2, normal);
328
- const colors = this.params.curves[i].getColors().map((c) => (c ? c : this.params.color));
329
- const vertexColor = interpolateColors(colors, currentInterpolation);
330
- this.params.vertexColors.push(vertexColor);
331
- const vertTop = vertex(point[0] + normal[0], point[1] + normal[1], 0, vertexColor);
283
+ this.params.vertexInterpolations.push(currentInterpolation);
284
+ const vertTop = vector3(point[0] + normal[0], point[1] + normal[1]);
332
285
  verticesTop.push(vertTop);
333
- const vertBottom = vertex(point[0] - normal[0], point[1] - normal[1], 0, vertexColor);
286
+ const vertBottom = vector3(point[0] - normal[0], point[1] - normal[1]);
334
287
  verticesBottom.unshift(vertBottom);
335
288
  if (atLimit) {
336
289
  break outer;
337
290
  }
338
291
  }
339
292
  }
340
- verticesTop = verticesTop.concat(verticesBottom);
341
- const tempColors = [...this.params.vertexColors];
342
- tempColors.reverse();
343
- this.params.vertexColors = this.params.vertexColors.concat(tempColors);
344
- this.vertices = verticesTop.map((vertex) => vertex.getPos());
345
- this.triangleOrder = lossyTriangulate(Array(verticesTop.length)
346
- .fill(0)
347
- .map((_, index) => index)).flat();
348
- this.updateWireframeOrder();
349
- }
350
- getWireframeBuffer(color, vertexParamGenerator) {
351
- return this.wireframeOrder
352
- .map((vertexIndex) => {
353
- const vertex = this.vertices[vertexIndex];
354
- return bufferGenerator.generate(vertex[0], vertex[1], vertex[2], color, vector2(), vertexParamGenerator);
355
- })
356
- .flat();
357
- }
358
- getTriangleBuffer(_, vertexParamGenerator) {
359
- return this.triangleOrder
360
- .map((vertexIndex) => {
361
- const vertex = this.vertices[vertexIndex];
362
- return bufferGenerator.generate(vertex[0], vertex[1], vertex[2], this.params.vertexColors[vertexIndex], vector2(), vertexParamGenerator);
363
- })
364
- .flat();
293
+ this.vertices = verticesTop.concat(verticesBottom);
294
+ this.triangleOrder = lossyTriangulateStrip(createIndexArray(this.vertices.length));
295
+ this.wireframeOrder = triangulateWireFrameOrder(this.vertices.length);
365
296
  }
366
297
  }
367
298
  export class Line2dGeometry extends Geometry {
368
299
  wireframeOrder = [0, 1, 2, 3, 0, 2];
369
- triangleOrder = [0, 1, 3, 2];
300
+ triangleOrder = [0, 3, 1, 2];
370
301
  params;
371
- constructor(pos, to, thickness, fromColor, toColor) {
302
+ constructor(pos, to, thickness) {
372
303
  super([], 'strip');
373
304
  this.params = {
374
305
  pos,
375
306
  to,
376
- thickness,
377
- fromColor: fromColor || null,
378
- toColor: toColor || null
307
+ thickness
379
308
  };
380
309
  }
381
- generateBuffer(order, color, vertexParamGenerator) {
382
- return order
383
- .map((vertexIndex) => {
384
- const pos = this.vertices[vertexIndex];
385
- const vertexColor = (vertexIndex > 1 ? this.params.toColor : this.params.fromColor) || color;
386
- return bufferGenerator.generate(pos[0], pos[1], pos[2], vertexColor, vector2(), vertexParamGenerator);
387
- })
388
- .flat();
389
- }
390
- getTriangleBuffer(color, vertexParamGenerator) {
391
- return this.generateBuffer(this.triangleOrder, color, vertexParamGenerator);
392
- }
393
- getWireframeBuffer(color, vertexParamGenerator) {
394
- return this.generateBuffer(this.wireframeOrder, color, vertexParamGenerator);
395
- }
396
310
  recompute() {
397
311
  const normal = vector2(-this.params.to[1], this.params.to[0]);
398
312
  vec2.normalize(normal, normal);
@@ -407,33 +321,16 @@ export class Line2dGeometry extends Geometry {
407
321
  }
408
322
  export class Line3dGeometry extends Geometry {
409
323
  wireframeOrder = [0, 1, 2, 3, 0, 2];
410
- triangleOrder = [0, 1, 2, 3, 0];
324
+ triangleOrder = [0, 3, 1, 2];
411
325
  params;
412
- constructor(pos, to, thickness, fromColor, toColor) {
326
+ constructor(pos, to, thickness) {
413
327
  super([], 'strip');
414
328
  this.params = {
415
329
  pos,
416
330
  to,
417
- thickness,
418
- fromColor: fromColor || null,
419
- toColor: toColor || null
331
+ thickness
420
332
  };
421
333
  }
422
- generateBuffer(order, color, vertexParamGenerator) {
423
- return order
424
- .map((vertexIndex) => {
425
- const pos = this.vertices[vertexIndex];
426
- const vertexColor = (vertexIndex > 1 ? this.params.toColor : this.params.fromColor) || color;
427
- return bufferGenerator.generate(pos[0], pos[1], pos[2], vertexColor, vector2(), vertexParamGenerator);
428
- })
429
- .flat();
430
- }
431
- getTriangleBuffer(color, vertexParamGenerator) {
432
- return this.generateBuffer(this.triangleOrder, color, vertexParamGenerator);
433
- }
434
- getWireframeBuffer(color, vertexParamGenerator) {
435
- return this.generateBuffer(this.wireframeOrder, color, vertexParamGenerator);
436
- }
437
334
  recompute() {
438
335
  const normal = vector2(-this.params.to[1], this.params.to[0]);
439
336
  vec2.normalize(normal, normal);
@@ -449,31 +346,18 @@ export class Line3dGeometry extends Geometry {
449
346
  export class PolygonGeometry extends Geometry {
450
347
  wireframeOrder;
451
348
  triangleOrder;
452
- params;
453
- constructor(points) {
349
+ params = {};
350
+ constructor(vertices) {
454
351
  super([], 'strip');
455
352
  this.wireframeOrder = [];
456
353
  this.triangleOrder = [];
457
- this.params = {
458
- points
459
- };
354
+ this.vertices = vertices;
460
355
  this.recompute();
461
356
  }
462
357
  recompute() {
463
- this.vertices = this.params.points.map((point) => point.getPos());
464
- this.triangleOrder = lossyTriangulateStrip(Array(this.vertices.length)
465
- .fill(0)
466
- .map((_, index) => index));
358
+ this.triangleOrder = lossyTriangulateStrip(createIndexArray(this.vertices.length));
467
359
  this.wireframeOrder = triangulateWireFrameOrder(this.vertices.length);
468
360
  }
469
- getTriangleBuffer(color) {
470
- return this.triangleOrder
471
- .map((vertexIndex) => {
472
- const vertex = this.vertices[vertexIndex];
473
- return bufferGenerator.generate(vertex[0], vertex[1], 0, this.params.points[vertexIndex].getColor() || color);
474
- })
475
- .flat();
476
- }
477
361
  }
478
362
  export class TraceLines2dGeometry extends Geometry {
479
363
  wireframeOrder = [];
@@ -482,27 +366,24 @@ export class TraceLines2dGeometry extends Geometry {
482
366
  constructor(maxLen) {
483
367
  super([], 'strip');
484
368
  this.params = {
485
- vertices: [],
486
- maxLength: maxLen || null
369
+ maxLength: maxLen ?? null
487
370
  };
488
- this.wireframeOrder = [];
489
371
  }
490
372
  recompute() { }
491
- getWireframeBuffer(color, vertexParamGenerator) {
492
- return this.params.vertices
493
- .map((item) => {
494
- const pos = item.getPos();
495
- return bufferGenerator.generate(pos[0], pos[1], pos[2], item.getColor() || color, vector2(), vertexParamGenerator);
496
- })
497
- .flat();
373
+ getVertexCount() {
374
+ return this.vertices.length;
498
375
  }
499
- getWireframeVertexCount() {
500
- return this.params.vertices.length;
376
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
377
+ getOrder(_) {
378
+ return [this.vertices, this.wireframeOrder];
501
379
  }
502
380
  addVertex(vert) {
503
- this.params.vertices.push(vert);
504
- if (this.params.maxLength && this.params.vertices.length > this.params.maxLength) {
505
- this.params.vertices.shift();
381
+ this.vertices.push(vert);
382
+ if (this.params.maxLength && this.vertices.length > this.params.maxLength) {
383
+ this.vertices.shift();
384
+ }
385
+ else {
386
+ this.wireframeOrder.push(this.wireframeOrder.length);
506
387
  }
507
388
  }
508
389
  }
@@ -0,0 +1,26 @@
1
+ /// <reference types="@webgpu/types" />
2
+ import { Shader } from './shaders.js';
3
+ declare class Logger {
4
+ constructor();
5
+ private fmt;
6
+ log(msg: string): void;
7
+ error(msg: string): Error;
8
+ warn(msg: string): void;
9
+ log_error(msg: string): void;
10
+ }
11
+ export declare const logger: Logger;
12
+ export declare class GlobalInfo {
13
+ private device;
14
+ constructor();
15
+ setDevice(device: GPUDevice): void;
16
+ errorGetDevice(): GPUDevice;
17
+ getDevice(): GPUDevice | null;
18
+ }
19
+ export declare const globalInfo: GlobalInfo;
20
+ export declare class PipelineCache {
21
+ private pipelines;
22
+ constructor();
23
+ getPipeline(device: GPUDevice, info: string, shader: Shader): GPURenderPipeline;
24
+ }
25
+ export declare const pipelineCache: PipelineCache;
26
+ export {};
@@ -0,0 +1,51 @@
1
+ import { createPipeline } from './internalUtils.js';
2
+ class Logger {
3
+ constructor() { }
4
+ fmt(msg) {
5
+ return `SimJS: ${msg}`;
6
+ }
7
+ log(msg) {
8
+ console.log(this.fmt(msg));
9
+ }
10
+ error(msg) {
11
+ return new Error(this.fmt(msg));
12
+ }
13
+ warn(msg) {
14
+ console.warn(this.fmt(msg));
15
+ }
16
+ log_error(msg) {
17
+ console.error(this.fmt(msg));
18
+ }
19
+ }
20
+ export const logger = new Logger();
21
+ export class GlobalInfo {
22
+ device;
23
+ constructor() {
24
+ this.device = null;
25
+ }
26
+ setDevice(device) {
27
+ this.device = device;
28
+ }
29
+ errorGetDevice() {
30
+ if (!this.device)
31
+ throw logger.error('GPUDevice is null');
32
+ return this.device;
33
+ }
34
+ getDevice() {
35
+ return this.device;
36
+ }
37
+ }
38
+ export const globalInfo = new GlobalInfo();
39
+ export class PipelineCache {
40
+ pipelines;
41
+ constructor() {
42
+ this.pipelines = new Map();
43
+ }
44
+ getPipeline(device, info, shader) {
45
+ const res = this.pipelines.get(info);
46
+ if (!res)
47
+ return createPipeline(device, info, shader);
48
+ return res;
49
+ }
50
+ }
51
+ export const pipelineCache = new PipelineCache();