@luma.gl/engine 9.0.0-beta.9 → 9.0.3
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/dist.dev.js +9 -12
- package/dist/dist.min.js +7 -7
- package/dist/index.cjs +9 -12
- package/dist/index.cjs.map +2 -2
- package/dist/model/model.d.ts +6 -4
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +9 -13
- package/package.json +4 -4
- package/src/model/model.ts +17 -20
package/dist/model/model.d.ts
CHANGED
|
@@ -33,8 +33,8 @@ export type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {
|
|
|
33
33
|
attributes?: Record<string, Buffer>;
|
|
34
34
|
/** */
|
|
35
35
|
constantAttributes?: Record<string, TypedArray>;
|
|
36
|
-
/** Some applications intentionally supply unused attributes */
|
|
37
|
-
|
|
36
|
+
/** Some applications intentionally supply unused attributes and bindings, and want to disable warnings */
|
|
37
|
+
disableWarnings?: boolean;
|
|
38
38
|
/** @internal For use with {@link TransformFeedback}, WebGL only. */
|
|
39
39
|
varyings?: string[];
|
|
40
40
|
transformFeedback?: TransformFeedback;
|
|
@@ -171,7 +171,7 @@ export declare class Model {
|
|
|
171
171
|
* @note Overrides any attributes previously set with the same name
|
|
172
172
|
*/
|
|
173
173
|
setAttributes(buffers: Record<string, Buffer>, options?: {
|
|
174
|
-
|
|
174
|
+
disableWarnings?: boolean;
|
|
175
175
|
}): void;
|
|
176
176
|
/**
|
|
177
177
|
* Sets constant attributes
|
|
@@ -181,7 +181,9 @@ export declare class Model {
|
|
|
181
181
|
* is read from the context's global constant value for that attribute location.
|
|
182
182
|
* @param constantAttributes
|
|
183
183
|
*/
|
|
184
|
-
setConstantAttributes(attributes: Record<string, TypedArray
|
|
184
|
+
setConstantAttributes(attributes: Record<string, TypedArray>, options?: {
|
|
185
|
+
disableWarnings?: boolean;
|
|
186
|
+
}): void;
|
|
185
187
|
/**
|
|
186
188
|
* Sets individual uniforms
|
|
187
189
|
* @deprecated WebGL only, use uniform buffers for portability
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/model/model.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,UAAU,EAAE,mBAAmB,EAAE,wBAAwB,EAAC,MAAM,eAAe,CAAC;AAC7F,OAAO,KAAK,EAAC,YAAY,EAAU,WAAW,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AACxF,OAAO,KAAK,EAAC,aAAa,EAAE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAC3F,OAAO,EAAC,MAAM,EAAiB,MAAM,EAAgC,MAAM,eAAe,CAAC;AAC3F,OAAO,EAAC,cAAc,EAAE,UAAU,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAIvE,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAC,eAAe,EAA0B,MAAM,sBAAsB,CAAC;AAE9E,OAAO,KAAK,EAAC,QAAQ,EAAC,gCAA6B;AACnD,OAAO,EAAC,WAAW,EAAkB,oCAAiC;AACtE,OAAO,EAAC,YAAY,EAAC,4BAAyB;AAC9C,OAAO,EAAC,eAAe,EAAC,mCAAgC;AACxD,OAAO,EAAC,aAAa,EAAC,iCAA8B;AAOpD,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,mBAAmB,EAAE,IAAI,GAAG,IAAI,CAAC,GAAG;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAElB,uDAAuD;IACvD,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IAGpD,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AS,CAAC,UAAU,SAAK;IACzB,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAe7C,uBAAuB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IA4BlE,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,EAAE,QAAQ,EAAE,GAAG,GAAG,MAAM;CAMlF;AAkBD,yDAAyD;AACzD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAS5D"}
|
package/dist/model/model.js
CHANGED
|
@@ -45,7 +45,7 @@ export class Model {
|
|
|
45
45
|
transformFeedback: undefined,
|
|
46
46
|
shaderAssembler: ShaderAssembler.getDefaultShaderAssembler(),
|
|
47
47
|
debugShaders: undefined,
|
|
48
|
-
|
|
48
|
+
disableWarnings: undefined
|
|
49
49
|
};
|
|
50
50
|
device;
|
|
51
51
|
id;
|
|
@@ -167,16 +167,12 @@ export class Model {
|
|
|
167
167
|
if (props.instanceCount) {
|
|
168
168
|
this.setInstanceCount(props.instanceCount);
|
|
169
169
|
}
|
|
170
|
-
// @ts-expect-error
|
|
171
|
-
if (props.indices) {
|
|
172
|
-
throw new Error('Model.props.indices removed. Use props.indexBuffer');
|
|
173
|
-
}
|
|
174
170
|
if (props.indexBuffer) {
|
|
175
171
|
this.setIndexBuffer(props.indexBuffer);
|
|
176
172
|
}
|
|
177
173
|
if (props.attributes) {
|
|
178
174
|
this.setAttributes(props.attributes, {
|
|
179
|
-
|
|
175
|
+
disableWarnings: props.disableWarnings
|
|
180
176
|
});
|
|
181
177
|
}
|
|
182
178
|
if (props.constantAttributes) {
|
|
@@ -243,7 +239,7 @@ export class Model {
|
|
|
243
239
|
this.pipeline = this._updatePipeline();
|
|
244
240
|
// Set pipeline state, we may be sharing a pipeline so we need to set all state on every draw
|
|
245
241
|
// Any caching needs to be done inside the pipeline functions
|
|
246
|
-
this.pipeline.setBindings(this.bindings);
|
|
242
|
+
this.pipeline.setBindings(this.bindings, { disableWarnings: this.props.disableWarnings });
|
|
247
243
|
if (!isObjectEmpty(this.uniforms)) {
|
|
248
244
|
this.pipeline.setUniformsWebGL(this.uniforms);
|
|
249
245
|
}
|
|
@@ -412,7 +408,7 @@ export class Model {
|
|
|
412
408
|
set = true;
|
|
413
409
|
}
|
|
414
410
|
}
|
|
415
|
-
if (!set && (options?.
|
|
411
|
+
if (!set && !(options?.disableWarnings || this.props.disableWarnings)) {
|
|
416
412
|
log.warn(`Model(${this.id}): Ignoring buffer "${buffer.id}" for unknown attribute "${bufferName}"`)();
|
|
417
413
|
}
|
|
418
414
|
}
|
|
@@ -426,13 +422,13 @@ export class Model {
|
|
|
426
422
|
* is read from the context's global constant value for that attribute location.
|
|
427
423
|
* @param constantAttributes
|
|
428
424
|
*/
|
|
429
|
-
setConstantAttributes(attributes) {
|
|
425
|
+
setConstantAttributes(attributes, options) {
|
|
430
426
|
for (const [attributeName, value] of Object.entries(attributes)) {
|
|
431
427
|
const attributeInfo = this._attributeInfos[attributeName];
|
|
432
428
|
if (attributeInfo) {
|
|
433
429
|
this.vertexArray.setConstantWebGL(attributeInfo.location, value);
|
|
434
430
|
}
|
|
435
|
-
else {
|
|
431
|
+
else if (!(options?.disableWarnings || this.props.disableWarnings)) {
|
|
436
432
|
log.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${attributeName}"`)();
|
|
437
433
|
}
|
|
438
434
|
}
|
|
@@ -494,9 +490,9 @@ export class Model {
|
|
|
494
490
|
}
|
|
495
491
|
// TODO - delete previous geometry?
|
|
496
492
|
this.vertexCount = gpuGeometry.vertexCount;
|
|
497
|
-
this.setIndexBuffer(gpuGeometry.indices);
|
|
498
|
-
this.setAttributes(gpuGeometry.attributes, {
|
|
499
|
-
this.setAttributes(attributes, {
|
|
493
|
+
this.setIndexBuffer(gpuGeometry.indices || null);
|
|
494
|
+
this.setAttributes(gpuGeometry.attributes, { disableWarnings: true });
|
|
495
|
+
this.setAttributes(attributes, { disableWarnings: this.props.disableWarnings });
|
|
500
496
|
this.setNeedsRedraw('geometry attributes');
|
|
501
497
|
}
|
|
502
498
|
/** Mark pipeline as needing update */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luma.gl/engine",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.3",
|
|
4
4
|
"description": "3D Engine Components for luma.gl",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
"prepublishOnly": "npm run build-minified-bundle && npm run build-dev-bundle"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@luma.gl/core": "^9.0.0
|
|
43
|
+
"@luma.gl/core": "^9.0.0"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@luma.gl/shadertools": "9.0.
|
|
46
|
+
"@luma.gl/shadertools": "9.0.3",
|
|
47
47
|
"@math.gl/core": "^4.0.0",
|
|
48
48
|
"@probe.gl/log": "^4.0.2",
|
|
49
49
|
"@probe.gl/stats": "^4.0.2"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "543e03b2d4bd865ac86cc8927611b91cc3e0393c"
|
|
52
52
|
}
|
package/src/model/model.ts
CHANGED
|
@@ -55,8 +55,9 @@ export type ModelProps = Omit<RenderPipelineProps, 'vs' | 'fs'> & {
|
|
|
55
55
|
attributes?: Record<string, Buffer>;
|
|
56
56
|
/** */
|
|
57
57
|
constantAttributes?: Record<string, TypedArray>;
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
|
|
59
|
+
/** Some applications intentionally supply unused attributes and bindings, and want to disable warnings */
|
|
60
|
+
disableWarnings?: boolean;
|
|
60
61
|
|
|
61
62
|
/** @internal For use with {@link TransformFeedback}, WebGL only. */
|
|
62
63
|
varyings?: string[];
|
|
@@ -109,8 +110,8 @@ export class Model {
|
|
|
109
110
|
transformFeedback: undefined,
|
|
110
111
|
shaderAssembler: ShaderAssembler.getDefaultShaderAssembler(),
|
|
111
112
|
|
|
112
|
-
debugShaders: undefined
|
|
113
|
-
|
|
113
|
+
debugShaders: undefined!,
|
|
114
|
+
disableWarnings: undefined!
|
|
114
115
|
};
|
|
115
116
|
|
|
116
117
|
readonly device: Device;
|
|
@@ -265,16 +266,12 @@ export class Model {
|
|
|
265
266
|
if (props.instanceCount) {
|
|
266
267
|
this.setInstanceCount(props.instanceCount);
|
|
267
268
|
}
|
|
268
|
-
// @ts-expect-error
|
|
269
|
-
if (props.indices) {
|
|
270
|
-
throw new Error('Model.props.indices removed. Use props.indexBuffer');
|
|
271
|
-
}
|
|
272
269
|
if (props.indexBuffer) {
|
|
273
270
|
this.setIndexBuffer(props.indexBuffer);
|
|
274
271
|
}
|
|
275
272
|
if (props.attributes) {
|
|
276
273
|
this.setAttributes(props.attributes, {
|
|
277
|
-
|
|
274
|
+
disableWarnings: props.disableWarnings
|
|
278
275
|
});
|
|
279
276
|
}
|
|
280
277
|
if (props.constantAttributes) {
|
|
@@ -350,7 +347,7 @@ export class Model {
|
|
|
350
347
|
|
|
351
348
|
// Set pipeline state, we may be sharing a pipeline so we need to set all state on every draw
|
|
352
349
|
// Any caching needs to be done inside the pipeline functions
|
|
353
|
-
this.pipeline.setBindings(this.bindings);
|
|
350
|
+
this.pipeline.setBindings(this.bindings, {disableWarnings: this.props.disableWarnings});
|
|
354
351
|
if (!isObjectEmpty(this.uniforms)) {
|
|
355
352
|
this.pipeline.setUniformsWebGL(this.uniforms);
|
|
356
353
|
}
|
|
@@ -517,10 +514,7 @@ export class Model {
|
|
|
517
514
|
* Sets attributes (buffers)
|
|
518
515
|
* @note Overrides any attributes previously set with the same name
|
|
519
516
|
*/
|
|
520
|
-
setAttributes(
|
|
521
|
-
buffers: Record<string, Buffer>,
|
|
522
|
-
options?: {ignoreUnknownAttributes?: boolean}
|
|
523
|
-
): void {
|
|
517
|
+
setAttributes(buffers: Record<string, Buffer>, options?: {disableWarnings?: boolean}): void {
|
|
524
518
|
if (buffers.indices) {
|
|
525
519
|
log.warn(
|
|
526
520
|
`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`
|
|
@@ -545,7 +539,7 @@ export class Model {
|
|
|
545
539
|
set = true;
|
|
546
540
|
}
|
|
547
541
|
}
|
|
548
|
-
if (!set && (options?.
|
|
542
|
+
if (!set && !(options?.disableWarnings || this.props.disableWarnings)) {
|
|
549
543
|
log.warn(
|
|
550
544
|
`Model(${this.id}): Ignoring buffer "${buffer.id}" for unknown attribute "${bufferName}"`
|
|
551
545
|
)();
|
|
@@ -562,12 +556,15 @@ export class Model {
|
|
|
562
556
|
* is read from the context's global constant value for that attribute location.
|
|
563
557
|
* @param constantAttributes
|
|
564
558
|
*/
|
|
565
|
-
setConstantAttributes(
|
|
559
|
+
setConstantAttributes(
|
|
560
|
+
attributes: Record<string, TypedArray>,
|
|
561
|
+
options?: {disableWarnings?: boolean}
|
|
562
|
+
): void {
|
|
566
563
|
for (const [attributeName, value] of Object.entries(attributes)) {
|
|
567
564
|
const attributeInfo = this._attributeInfos[attributeName];
|
|
568
565
|
if (attributeInfo) {
|
|
569
566
|
this.vertexArray.setConstantWebGL(attributeInfo.location, value);
|
|
570
|
-
} else {
|
|
567
|
+
} else if (!(options?.disableWarnings || this.props.disableWarnings)) {
|
|
571
568
|
log.warn(
|
|
572
569
|
`Model "${this.id}: Ignoring constant supplied for unknown attribute "${attributeName}"`
|
|
573
570
|
)();
|
|
@@ -638,9 +635,9 @@ export class Model {
|
|
|
638
635
|
|
|
639
636
|
// TODO - delete previous geometry?
|
|
640
637
|
this.vertexCount = gpuGeometry.vertexCount;
|
|
641
|
-
this.setIndexBuffer(gpuGeometry.indices);
|
|
642
|
-
this.setAttributes(gpuGeometry.attributes, {
|
|
643
|
-
this.setAttributes(attributes, {
|
|
638
|
+
this.setIndexBuffer(gpuGeometry.indices || null);
|
|
639
|
+
this.setAttributes(gpuGeometry.attributes, {disableWarnings: true});
|
|
640
|
+
this.setAttributes(attributes, {disableWarnings: this.props.disableWarnings});
|
|
644
641
|
|
|
645
642
|
this.setNeedsRedraw('geometry attributes');
|
|
646
643
|
}
|