@pacem/pacem-3d 2.0.0-abel → 2.0.0-cauchy
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/browser/pacem-3d.js +759 -68
- package/dist/browser/pacem-3d.js.map +1 -1
- package/dist/browser/pacem-3d.min.js +2 -2
- package/dist/bundle/pacem-3d.min.mjs +105 -51
- package/dist/bundle/pacem-3d.mjs +825 -222
- package/dist/bundle/pacem-3d.mjs.map +4 -4
- package/dist/docs/pacem-3d.json +650 -8
- package/dist/esm/constants.js +1 -1
- package/dist/esm/converters.js +1 -1
- package/dist/esm/decorators.js +1 -1
- package/dist/esm/detector.js +1 -1
- package/dist/esm/geometry.js +1 -1
- package/dist/esm/index-components-drawing3d.js +1 -1
- package/dist/esm/index-components.js +1 -1
- package/dist/esm/index-drawing3d.js +1 -1
- package/dist/esm/index-iife.js +1 -1
- package/dist/esm/index-root.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/stage.js +1 -1
- package/dist/esm/types.js +38 -1
- package/package.json +1 -1
- package/typings/index.d.ts +29 -1
package/dist/esm/constants.js
CHANGED
package/dist/esm/converters.js
CHANGED
package/dist/esm/decorators.js
CHANGED
package/dist/esm/detector.js
CHANGED
package/dist/esm/geometry.js
CHANGED
package/dist/esm/index-iife.js
CHANGED
package/dist/esm/index-root.js
CHANGED
package/dist/esm/index.js
CHANGED
package/dist/esm/stage.js
CHANGED
package/dist/esm/types.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @pacem/pacem-3d v2.0.0-
|
|
2
|
+
* @pacem/pacem-3d v2.0.0-cauchy (https://js.pacem.it)
|
|
3
3
|
* Pacem (https://pacem.it)
|
|
4
4
|
* Licensed under Apache-2.0
|
|
5
5
|
*/
|
|
@@ -132,6 +132,8 @@ export var StalePropertyFlag;
|
|
|
132
132
|
StalePropertyFlag["Camera"] = "camera";
|
|
133
133
|
/** The object's {@link Renderable.hide} visibility changed. */
|
|
134
134
|
StalePropertyFlag["Visibility"] = "visibility";
|
|
135
|
+
/** The mesh's {@link Mesh.castShadow}/{@link Mesh.receiveShadow} changed. */
|
|
136
|
+
StalePropertyFlag["Shadow"] = "shadow";
|
|
135
137
|
})(StalePropertyFlag || (StalePropertyFlag = {}));
|
|
136
138
|
/** Type guard checking whether `object` implements the {@link Interaction} contract. */
|
|
137
139
|
export function isInteraction(object) {
|
|
@@ -329,6 +331,13 @@ Pacem3DGroupElement = __decorate([
|
|
|
329
331
|
export { Pacem3DGroupElement };
|
|
330
332
|
/** `<pacem-3d-mesh>`: a {@link Ui3DElement} that renders a {@link NodeGeometry} (mesh or line) with a front/back {@link Material}. */
|
|
331
333
|
let Pacem3DMeshElement = class Pacem3DMeshElement extends Ui3DElement {
|
|
334
|
+
constructor() {
|
|
335
|
+
super(...arguments);
|
|
336
|
+
/** Gets or sets whether the mesh occludes shadow-casting lights. */
|
|
337
|
+
this.castShadow = true;
|
|
338
|
+
/** Gets or sets whether the mesh gets darkened by the shadows of the other meshes. */
|
|
339
|
+
this.receiveShadow = true;
|
|
340
|
+
}
|
|
332
341
|
propertyChangedCallback(name, old, val, first) {
|
|
333
342
|
super.propertyChangedCallback(name, old, val, first);
|
|
334
343
|
switch (name) {
|
|
@@ -339,6 +348,10 @@ let Pacem3DMeshElement = class Pacem3DMeshElement extends Ui3DElement {
|
|
|
339
348
|
case 'backMaterial':
|
|
340
349
|
this.setAsDirty(StalePropertyFlag.Material);
|
|
341
350
|
break;
|
|
351
|
+
case 'castShadow':
|
|
352
|
+
case 'receiveShadow':
|
|
353
|
+
this.setAsDirty(StalePropertyFlag.Shadow);
|
|
354
|
+
break;
|
|
342
355
|
}
|
|
343
356
|
}
|
|
344
357
|
};
|
|
@@ -351,6 +364,12 @@ __decorate([
|
|
|
351
364
|
__decorate([
|
|
352
365
|
Watch({ emit: false, converter: PropertyConverters.Json })
|
|
353
366
|
], Pacem3DMeshElement.prototype, "backMaterial", void 0);
|
|
367
|
+
__decorate([
|
|
368
|
+
Watch({ emit: false, converter: PropertyConverters.Boolean })
|
|
369
|
+
], Pacem3DMeshElement.prototype, "castShadow", void 0);
|
|
370
|
+
__decorate([
|
|
371
|
+
Watch({ emit: false, converter: PropertyConverters.Boolean })
|
|
372
|
+
], Pacem3DMeshElement.prototype, "receiveShadow", void 0);
|
|
354
373
|
Pacem3DMeshElement = __decorate([
|
|
355
374
|
CustomElement({ tagName: Constants.MESH_SELECTOR })
|
|
356
375
|
], Pacem3DMeshElement);
|
|
@@ -386,6 +405,12 @@ let Pacem3DLightElement = class Pacem3DLightElement extends RenderableElement {
|
|
|
386
405
|
this.color = '#fff';
|
|
387
406
|
/** Gets or sets the kind of light source. */
|
|
388
407
|
this.type = 'omni';
|
|
408
|
+
/** Gets or sets whether the light casts shadows (directional and omni lights, WebGPU adapter). */
|
|
409
|
+
this.castShadow = false;
|
|
410
|
+
/** Gets or sets the side, in texels, of the light's shadow map. */
|
|
411
|
+
this.shadowMapSize = 2048;
|
|
412
|
+
/** Gets or sets the normal offset applied to the shadow receivers, as a fraction of the shadow frustum radius: raise it against shadow acne, lower it against detached shadows. */
|
|
413
|
+
this.shadowBias = 0.002;
|
|
389
414
|
}
|
|
390
415
|
propertyChangedCallback(name, old, val, first) {
|
|
391
416
|
super.propertyChangedCallback(name, old, val, first);
|
|
@@ -394,6 +419,9 @@ let Pacem3DLightElement = class Pacem3DLightElement extends RenderableElement {
|
|
|
394
419
|
case 'color':
|
|
395
420
|
case 'intensity':
|
|
396
421
|
case 'target':
|
|
422
|
+
case 'castShadow':
|
|
423
|
+
case 'shadowMapSize':
|
|
424
|
+
case 'shadowBias':
|
|
397
425
|
this.setAsDirty(StalePropertyFlag.Light);
|
|
398
426
|
break;
|
|
399
427
|
}
|
|
@@ -411,6 +439,15 @@ __decorate([
|
|
|
411
439
|
__decorate([
|
|
412
440
|
Watch({ emit: false, converter: PropertyConverters.String })
|
|
413
441
|
], Pacem3DLightElement.prototype, "type", void 0);
|
|
442
|
+
__decorate([
|
|
443
|
+
Watch({ emit: false, converter: PropertyConverters.Boolean })
|
|
444
|
+
], Pacem3DLightElement.prototype, "castShadow", void 0);
|
|
445
|
+
__decorate([
|
|
446
|
+
Watch({ emit: false, converter: PropertyConverters.Number })
|
|
447
|
+
], Pacem3DLightElement.prototype, "shadowMapSize", void 0);
|
|
448
|
+
__decorate([
|
|
449
|
+
Watch({ emit: false, converter: PropertyConverters.Number })
|
|
450
|
+
], Pacem3DLightElement.prototype, "shadowBias", void 0);
|
|
414
451
|
Pacem3DLightElement = __decorate([
|
|
415
452
|
CustomElement({ tagName: Constants.LIGHT_SELECTOR })
|
|
416
453
|
], Pacem3DLightElement);
|
package/package.json
CHANGED
package/typings/index.d.ts
CHANGED
|
@@ -411,6 +411,12 @@ declare interface Light extends Renderable {
|
|
|
411
411
|
attenuationEnd?: number;
|
|
412
412
|
/** Cone angle, in degrees (spotlight-specific). */
|
|
413
413
|
angle?: number;
|
|
414
|
+
/** Whether the light casts shadows (directional and omni lights). */
|
|
415
|
+
castShadow?: boolean;
|
|
416
|
+
/** Side, in texels, of the light's shadow map. */
|
|
417
|
+
shadowMapSize?: number;
|
|
418
|
+
/** Normal offset applied to the receivers before testing them against the shadow map, as a fraction of the shadow frustum radius: fights shadow acne. */
|
|
419
|
+
shadowBias?: number;
|
|
414
420
|
}
|
|
415
421
|
|
|
416
422
|
/** A {@link NodeGeometry} rendered as a polyline through its {@link positions} (no faces/triangles). */
|
|
@@ -514,6 +520,10 @@ declare interface Mesh extends Ui3DObject {
|
|
|
514
520
|
material?: Material;
|
|
515
521
|
/** Gets or sets the material applied to back-facing faces (defaults to {@link material} when unset). */
|
|
516
522
|
backMaterial?: Material;
|
|
523
|
+
/** Gets or sets whether the mesh occludes shadow-casting lights (defaults to `true`). */
|
|
524
|
+
castShadow?: boolean;
|
|
525
|
+
/** Gets or sets whether the mesh gets darkened by the shadows of the other meshes (defaults to `true`). */
|
|
526
|
+
receiveShadow?: boolean;
|
|
517
527
|
}
|
|
518
528
|
|
|
519
529
|
/** A {@link NodeGeometry} for triangulated surfaces: adds triangle vertex indices, per-vertex UV texture coordinates and normals. */
|
|
@@ -829,6 +839,12 @@ declare class Pacem3DLightElement extends RenderableElement implements Light {
|
|
|
829
839
|
color: string;
|
|
830
840
|
/** Gets or sets the kind of light source. */
|
|
831
841
|
type: 'spot' | 'direction' | 'omni';
|
|
842
|
+
/** Gets or sets whether the light casts shadows (directional and omni lights, WebGPU adapter). */
|
|
843
|
+
castShadow: boolean;
|
|
844
|
+
/** Gets or sets the side, in texels, of the light's shadow map. */
|
|
845
|
+
shadowMapSize: number;
|
|
846
|
+
/** Gets or sets the normal offset applied to the shadow receivers, as a fraction of the shadow frustum radius: raise it against shadow acne, lower it against detached shadows. */
|
|
847
|
+
shadowBias: number;
|
|
832
848
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
833
849
|
}
|
|
834
850
|
|
|
@@ -840,6 +856,10 @@ declare class Pacem3DMeshElement extends Ui3DElement implements Mesh {
|
|
|
840
856
|
material: Material;
|
|
841
857
|
/** Gets or sets the material applied to back-facing faces (defaults to {@link material} when unset). */
|
|
842
858
|
backMaterial: Material;
|
|
859
|
+
/** Gets or sets whether the mesh occludes shadow-casting lights. */
|
|
860
|
+
castShadow: boolean;
|
|
861
|
+
/** Gets or sets whether the mesh gets darkened by the shadows of the other meshes. */
|
|
862
|
+
receiveShadow: boolean;
|
|
843
863
|
propertyChangedCallback(name: string, old: any, val: any, first?: boolean): void;
|
|
844
864
|
}
|
|
845
865
|
|
|
@@ -971,6 +991,12 @@ declare class Pacem3DWebgpuAdapterElement extends Pacem3DAdapterElement implemen
|
|
|
971
991
|
* blending in draw order. Lines are always blended. Reassigning it reinitializes the renderer(s).
|
|
972
992
|
*/
|
|
973
993
|
transparency: TransparencyMode;
|
|
994
|
+
/**
|
|
995
|
+
* Gets or sets whether the depth buffer is reversed (near → 1, far → 0) and floating point: depth precision gets
|
|
996
|
+
* spread evenly over distance, reducing z-fighting on deep scenes and tiny `near` planes. Off by default.
|
|
997
|
+
* Reassigning it reinitializes the renderer(s).
|
|
998
|
+
*/
|
|
999
|
+
reversedZ: boolean;
|
|
974
1000
|
private _ensureRenderer;
|
|
975
1001
|
private _updatePipeline;
|
|
976
1002
|
/**
|
|
@@ -1371,7 +1397,9 @@ declare enum StalePropertyFlag {
|
|
|
1371
1397
|
/** A {@link Camera}-specific property (near, far, fov, frustum, ...) changed. */
|
|
1372
1398
|
Camera = "camera",
|
|
1373
1399
|
/** The object's {@link Renderable.hide} visibility changed. */
|
|
1374
|
-
Visibility = "visibility"
|
|
1400
|
+
Visibility = "visibility",
|
|
1401
|
+
/** The mesh's {@link Mesh.castShadow}/{@link Mesh.receiveShadow} changed. */
|
|
1402
|
+
Shadow = "shadow"
|
|
1375
1403
|
}
|
|
1376
1404
|
|
|
1377
1405
|
/** A {@link DiffuseMaterial} using a physically-based (metalness/roughness) shading model. */
|