reze-engine 0.61.0 → 0.61.1
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/camera.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camera.d.ts","sourceRoot":"","sources":["../src/camera.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAQ,IAAI,EAAE,MAAM,QAAQ,CAAA;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"camera.d.ts","sourceRoot":"","sources":["../src/camera.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAQ,IAAI,EAAE,MAAM,QAAQ,CAAA;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAgCpD,qBAAa,MAAM;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,IAAI,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAI;IAClB;;;oFAGgF;IAChF,IAAI,EAAE,MAAM,CAAiB;IAC7B,GAAG,EAAE,MAAM,CAAU;IACrB;+EAC2E;IAC3E,SAAS,UAAQ;IAGjB,OAAO,CAAC,MAAM,CAAiC;IAC/C,OAAO,CAAC,WAAW,CAAiB;IACpC;;;;;;;;;OASG;IACH,OAAO,EAAE,IAAI,GAAG,IAAI,CAAO;IAC3B,OAAO,CAAC,UAAU,CAAiB;IACnC,OAAO,CAAC,WAAW,CAAsB;IACzC,OAAO,CAAC,YAAY,CAAiB;IACrC,OAAO,CAAC,YAAY,CAAiB;IACrC,OAAO,CAAC,eAAe,CAAsB;IAC7C,OAAO,CAAC,UAAU,CAAiB;IACnC,OAAO,CAAC,iBAAiB,CAAY;IACrC,OAAO,CAAC,iBAAiB,CAA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;;;;;;;OAeG;IACH,OAAO,CAAC,oBAAoB;IAM5B,mBAAmB,IAAI,IAAI;IAW3B,aAAa,CAAC,MAAM,EAAE,iBAAiB;IAiBvC,aAAa;IAkBb,cAAc,CAAC,MAAM,EAAE,OAAO;IAS9B,OAAO,CAAC,WAAW;IAWnB;;;;;;;;;OASG;IACH,OAAO,CAAC,WAAW,CAA4B;IAE/C,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI;IAI/C,OAAO,CAAC,WAAW;IAmBnB,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,OAAO;IAYf,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,YAAY;IA8BpB,OAAO,CAAC,WAAW;IAuFnB,OAAO,CAAC,UAAU;CA+BnB"}
|
package/dist/camera.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { Mat4, Quat, Vec3 } from "./math";
|
|
2
2
|
/** Far cap / zoom limit; large enough for wide shots without clipping distant ground */
|
|
3
3
|
const FAR_CAP = 8000;
|
|
4
|
+
/**
|
|
5
|
+
* The far plane's cap on a float, reversed-Z depth buffer, where precision
|
|
6
|
+
* holds out to kilometres: a game's sky hangs its moon and its dome a kilometre
|
|
7
|
+
* and more out (X309's moon 1.1 km, its dome 1.4 km), and at 8000 units they
|
|
8
|
+
* were loaded and never drawn. The 24-bit buffer keeps FAR_CAP.
|
|
9
|
+
*/
|
|
10
|
+
const FAR_CAP_REVERSED = 80000;
|
|
4
11
|
const FAR_MIN = 200;
|
|
5
12
|
/**
|
|
6
13
|
* Near-plane floor and cap, in two sets, because what a near plane costs depends
|
|
@@ -359,7 +366,7 @@ export class Camera {
|
|
|
359
366
|
// centre, so the far side of a dome is extent + radius away.
|
|
360
367
|
const fromOrbit = this.radius * 12 + margin;
|
|
361
368
|
const fromScene = this.sceneExtent > 0 ? this.sceneExtent + this.radius + margin : 0;
|
|
362
|
-
this.far = Math.min(FAR_CAP, Math.max(FAR_MIN, fromOrbit, fromScene));
|
|
369
|
+
this.far = Math.min(this.reversedZ ? FAR_CAP_REVERSED : FAR_CAP, Math.max(FAR_MIN, fromOrbit, fromScene));
|
|
363
370
|
}
|
|
364
371
|
/**
|
|
365
372
|
* Near plane scales with how far out you are framing.
|
|
@@ -70,12 +70,6 @@ type XYZ = {
|
|
|
70
70
|
y: number;
|
|
71
71
|
z: number;
|
|
72
72
|
};
|
|
73
|
-
/**
|
|
74
|
-
* Where each cascade's slice of the view starts and ends, as distances along
|
|
75
|
-
* the view: [near, split] and [near, farFit]. The far end is where the scene
|
|
76
|
-
* ends, so an empty floor with a dancer on it keeps a short, sharp frustum
|
|
77
|
-
* rather than the camera's far plane.
|
|
78
|
-
*/
|
|
79
73
|
export declare function cascadeSlices(view: ShadowView, bounds: ShadowBounds): [number, number][];
|
|
80
74
|
/** The eight corners of a slice, for tests and for the fit's own checks. */
|
|
81
75
|
export declare function sliceCorners(view: ShadowView, n: number, f: number): XYZ[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadow-cascades.d.ts","sourceRoot":"","sources":["../src/shadow-cascades.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,qEAAqE;IACrE,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,SAAS,aAAa,EAA2C,CAAA;AAE/F;iFACiF;AACjF,eAAO,MAAM,UAAU,KAAK,CAAA;AAE5B;;+EAE+E;AAC/E,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACxC,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC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,EAAE,GAAG,EACjB,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,aAAa,EACtB,GAAG,EAAE,YAAY,EACjB,MAAM,EAAE,MAAM,GACb,YAAY,CA0Cd;AAED,gEAAgE;AAChE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY,GAAG,YAAY,CAI9H"}
|
package/dist/shadow-cascades.js
CHANGED
|
@@ -9,6 +9,9 @@ export const NEAR_REACH = 40;
|
|
|
9
9
|
* ends, so an empty floor with a dancer on it keeps a short, sharp frustum
|
|
10
10
|
* rather than the camera's far plane.
|
|
11
11
|
*/
|
|
12
|
+
/** The deepest a cascade reaches along the view, in world units — the far
|
|
13
|
+
* plane's old cap, which is where every stage's shadows were fitted before. */
|
|
14
|
+
const SHADOW_FAR = 8000;
|
|
12
15
|
export function cascadeSlices(view, bounds) {
|
|
13
16
|
let farFit = view.near + 200;
|
|
14
17
|
if (bounds) {
|
|
@@ -21,7 +24,10 @@ export function cascadeSlices(view, bounds) {
|
|
|
21
24
|
}
|
|
22
25
|
farFit = deepest + 1;
|
|
23
26
|
}
|
|
24
|
-
|
|
27
|
+
// Never past SHADOW_FAR, whatever the camera's far plane: a stage's sky dome
|
|
28
|
+
// a kilometre out is in the scene's bounds, and fitting the far cascade to it
|
|
29
|
+
// would spread the stage's shadow map across the sky.
|
|
30
|
+
farFit = Math.min(view.far, SHADOW_FAR, Math.max(view.near + 1, farFit));
|
|
25
31
|
const split = Math.min(farFit, Math.max(view.near + 8, view.focus + NEAR_REACH));
|
|
26
32
|
return [
|
|
27
33
|
[view.near, split],
|
package/package.json
CHANGED
package/src/camera.ts
CHANGED
|
@@ -3,6 +3,13 @@ import type { CameraPose } from "./camera-animation"
|
|
|
3
3
|
|
|
4
4
|
/** Far cap / zoom limit; large enough for wide shots without clipping distant ground */
|
|
5
5
|
const FAR_CAP = 8000
|
|
6
|
+
/**
|
|
7
|
+
* The far plane's cap on a float, reversed-Z depth buffer, where precision
|
|
8
|
+
* holds out to kilometres: a game's sky hangs its moon and its dome a kilometre
|
|
9
|
+
* and more out (X309's moon 1.1 km, its dome 1.4 km), and at 8000 units they
|
|
10
|
+
* were loaded and never drawn. The 24-bit buffer keeps FAR_CAP.
|
|
11
|
+
*/
|
|
12
|
+
const FAR_CAP_REVERSED = 80000
|
|
6
13
|
const FAR_MIN = 200
|
|
7
14
|
/**
|
|
8
15
|
* Near-plane floor and cap, in two sets, because what a near plane costs depends
|
|
@@ -376,7 +383,7 @@ export class Camera {
|
|
|
376
383
|
// centre, so the far side of a dome is extent + radius away.
|
|
377
384
|
const fromOrbit = this.radius * 12 + margin
|
|
378
385
|
const fromScene = this.sceneExtent > 0 ? this.sceneExtent + this.radius + margin : 0
|
|
379
|
-
this.far = Math.min(FAR_CAP, Math.max(FAR_MIN, fromOrbit, fromScene))
|
|
386
|
+
this.far = Math.min(this.reversedZ ? FAR_CAP_REVERSED : FAR_CAP, Math.max(FAR_MIN, fromOrbit, fromScene))
|
|
380
387
|
}
|
|
381
388
|
|
|
382
389
|
/**
|
package/src/shadow-cascades.ts
CHANGED
|
@@ -61,6 +61,10 @@ type XYZ = { x: number; y: number; z: number }
|
|
|
61
61
|
* ends, so an empty floor with a dancer on it keeps a short, sharp frustum
|
|
62
62
|
* rather than the camera's far plane.
|
|
63
63
|
*/
|
|
64
|
+
/** The deepest a cascade reaches along the view, in world units — the far
|
|
65
|
+
* plane's old cap, which is where every stage's shadows were fitted before. */
|
|
66
|
+
const SHADOW_FAR = 8000
|
|
67
|
+
|
|
64
68
|
export function cascadeSlices(view: ShadowView, bounds: ShadowBounds): [number, number][] {
|
|
65
69
|
let farFit = view.near + 200
|
|
66
70
|
if (bounds) {
|
|
@@ -73,7 +77,10 @@ export function cascadeSlices(view: ShadowView, bounds: ShadowBounds): [number,
|
|
|
73
77
|
}
|
|
74
78
|
farFit = deepest + 1
|
|
75
79
|
}
|
|
76
|
-
|
|
80
|
+
// Never past SHADOW_FAR, whatever the camera's far plane: a stage's sky dome
|
|
81
|
+
// a kilometre out is in the scene's bounds, and fitting the far cascade to it
|
|
82
|
+
// would spread the stage's shadow map across the sky.
|
|
83
|
+
farFit = Math.min(view.far, SHADOW_FAR, Math.max(view.near + 1, farFit))
|
|
77
84
|
const split = Math.min(farFit, Math.max(view.near + 8, view.focus + NEAR_REACH))
|
|
78
85
|
return [
|
|
79
86
|
[view.near, split],
|