@pretty-chitty/core 1.2.16 → 1.2.17
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/components/Gallery/GalleryViewer.d.ts.map +1 -1
- package/dist/components/Gallery/GalleryViewer.js +7 -2
- package/dist/components/Gallery/GalleryViewer.js.map +1 -1
- package/dist/components/SparkLineChart.d.ts.map +1 -1
- package/dist/components/SparkLineChart.js +37 -64
- package/dist/components/SparkLineChart.js.map +1 -1
- package/dist/components/Viewer.d.ts.map +1 -1
- package/dist/components/Viewer.js +12 -2
- package/dist/components/Viewer.js.map +1 -1
- package/dist/game/Chit.js +1 -1
- package/dist/game/Chit.js.map +1 -1
- package/dist/hooks/useWebGlRenderer.d.ts.map +1 -1
- package/dist/hooks/useWebGlRenderer.js +11 -1
- package/dist/hooks/useWebGlRenderer.js.map +1 -1
- package/dist/rendering/CameraWrapperPerspective.d.ts.map +1 -1
- package/dist/rendering/CameraWrapperPerspective.js +10 -5
- package/dist/rendering/CameraWrapperPerspective.js.map +1 -1
- package/dist/rendering/LightWrapper.d.ts.map +1 -1
- package/dist/rendering/LightWrapper.js +14 -1
- package/dist/rendering/LightWrapper.js.map +1 -1
- package/dist/rendering/outline/EffectComposer.js +9 -5
- package/dist/rendering/outline/EffectComposer.js.map +1 -1
- package/package.json +1 -1
- package/src/library/components/Gallery/GalleryViewer.tsx +7 -2
- package/src/library/components/SparkLineChart.tsx +65 -104
- package/src/library/components/Viewer.tsx +11 -2
- package/src/library/game/Chit.ts +1 -1
- package/src/library/hooks/useWebGlRenderer.tsx +12 -1
- package/src/library/rendering/CameraWrapperPerspective.ts +10 -5
- package/src/library/rendering/LightWrapper.ts +20 -1
- package/src/library/rendering/outline/EffectComposer.ts +4 -4
|
@@ -566,7 +566,13 @@ export class CameraWrapperPerspective {
|
|
|
566
566
|
tween
|
|
567
567
|
.to(newPosition, duration)
|
|
568
568
|
.easing(Easing.Quadratic.InOut)
|
|
569
|
-
.onUpdate((obj) =>
|
|
569
|
+
.onUpdate((obj) => {
|
|
570
|
+
this.camera.position.set(obj.x, obj.y, obj.z);
|
|
571
|
+
const planes = this.calculateOptimalNearFar(this.bbox, this.camera.position);
|
|
572
|
+
this.camera.near = planes.near;
|
|
573
|
+
this.camera.far = planes.far;
|
|
574
|
+
this.camera.updateProjectionMatrix();
|
|
575
|
+
}),
|
|
570
576
|
);
|
|
571
577
|
}
|
|
572
578
|
|
|
@@ -581,8 +587,8 @@ export class CameraWrapperPerspective {
|
|
|
581
587
|
);
|
|
582
588
|
}
|
|
583
589
|
|
|
584
|
-
//
|
|
585
|
-
if (nearFarDistance > 0.001) {
|
|
590
|
+
// Only tween near/far independently when camera position isn't changing
|
|
591
|
+
if (positionDistance === 0 && nearFarDistance > 0.001) {
|
|
586
592
|
this.nearFarTween = this.chit.createTween({ near: currentNear, far: currentFar }, (tween) =>
|
|
587
593
|
tween
|
|
588
594
|
.to({ near: optimalPlanes.near, far: optimalPlanes.far }, duration)
|
|
@@ -593,8 +599,7 @@ export class CameraWrapperPerspective {
|
|
|
593
599
|
this.camera.updateProjectionMatrix();
|
|
594
600
|
}),
|
|
595
601
|
);
|
|
596
|
-
} else if (nearFarDistance > 0) {
|
|
597
|
-
// If difference is tiny, just set immediately
|
|
602
|
+
} else if (positionDistance === 0 && nearFarDistance > 0) {
|
|
598
603
|
this.camera.near = optimalPlanes.near;
|
|
599
604
|
this.camera.far = optimalPlanes.far;
|
|
600
605
|
this.camera.updateProjectionMatrix();
|
|
@@ -74,7 +74,6 @@ export class LightWrapper {
|
|
|
74
74
|
l.shadow.camera.right = 0.1;
|
|
75
75
|
l.shadow.camera.top = 0.1;
|
|
76
76
|
l.shadow.camera.bottom = -0.1;
|
|
77
|
-
l.shadow.camera.near = 0.000001;
|
|
78
77
|
this.group.add(l);
|
|
79
78
|
}
|
|
80
79
|
|
|
@@ -147,6 +146,26 @@ export class LightWrapper {
|
|
|
147
146
|
camera.right = Math.max(right, b.max.x);
|
|
148
147
|
camera.bottom = Math.min(bottom, b.min.y);
|
|
149
148
|
camera.top = Math.max(top, b.max.y);
|
|
149
|
+
|
|
150
|
+
const lDist = light.position.length();
|
|
151
|
+
if (lDist > 0) {
|
|
152
|
+
const lightDir = light.position.clone().normalize();
|
|
153
|
+
let minDepth = Infinity;
|
|
154
|
+
let maxDepth = -Infinity;
|
|
155
|
+
[this.bbox.min.x, this.bbox.max.x].forEach((x) =>
|
|
156
|
+
[this.bbox.min.y, this.bbox.max.y].forEach((y) =>
|
|
157
|
+
[this.bbox.min.z, this.bbox.max.z].forEach((z) => {
|
|
158
|
+
const depth = lDist - (x * lightDir.x + y * lightDir.y + z * lightDir.z);
|
|
159
|
+
minDepth = Math.min(minDepth, depth);
|
|
160
|
+
maxDepth = Math.max(maxDepth, depth);
|
|
161
|
+
}),
|
|
162
|
+
),
|
|
163
|
+
);
|
|
164
|
+
const margin = Math.max(1, (maxDepth - minDepth) * 0.1);
|
|
165
|
+
camera.near = Math.max(0.1, minDepth - margin);
|
|
166
|
+
camera.far = maxDepth + margin;
|
|
167
|
+
}
|
|
168
|
+
|
|
150
169
|
camera.updateProjectionMatrix();
|
|
151
170
|
}
|
|
152
171
|
}
|
|
@@ -69,7 +69,7 @@ export class EffectComposer {
|
|
|
69
69
|
Math.max(1, Math.floor(this._width * this._pixelRatio)),
|
|
70
70
|
Math.max(1, Math.floor(this._height * this._pixelRatio)),
|
|
71
71
|
);
|
|
72
|
-
|
|
72
|
+
if (renderer.capabilities.isWebGL2) renderTarget.depthTexture.type = FloatType;
|
|
73
73
|
|
|
74
74
|
this.renderTarget = renderTarget;
|
|
75
75
|
|
|
@@ -83,7 +83,7 @@ export class EffectComposer {
|
|
|
83
83
|
Math.max(1, Math.floor(this._width * this._pixelRatio)),
|
|
84
84
|
Math.max(1, Math.floor(this._height * this._pixelRatio)),
|
|
85
85
|
);
|
|
86
|
-
|
|
86
|
+
if (renderer.capabilities.isWebGL2) this.renderTarget2.depthTexture.type = FloatType;
|
|
87
87
|
|
|
88
88
|
this.copyPass = new ShaderPass(CopyShader, this.textureId);
|
|
89
89
|
}
|
|
@@ -166,13 +166,13 @@ export class EffectComposer {
|
|
|
166
166
|
if (this.renderTarget.depthTexture) {
|
|
167
167
|
this.renderTarget.depthTexture.dispose();
|
|
168
168
|
this.renderTarget.depthTexture = new DepthTexture(effectiveWidth, effectiveHeight);
|
|
169
|
-
|
|
169
|
+
if (this.renderer.capabilities.isWebGL2) this.renderTarget.depthTexture.type = FloatType;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
if (this.renderTarget2.depthTexture) {
|
|
173
173
|
this.renderTarget2.depthTexture.dispose();
|
|
174
174
|
this.renderTarget2.depthTexture = new DepthTexture(effectiveWidth, effectiveHeight);
|
|
175
|
-
|
|
175
|
+
if (this.renderer.capabilities.isWebGL2) this.renderTarget2.depthTexture.type = FloatType;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
for (let i = 0; i < this.passes.length; i++) {
|