postext-folio 0.74.2 → 0.76.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/bookGeometry.d.ts +6 -1
- package/dist/bookGeometry.d.ts.map +1 -1
- package/dist/bookGeometry.js +41 -20
- package/dist/bookGeometry.js.map +1 -1
- package/dist/pageFlip/finish.d.ts +8 -2
- package/dist/pageFlip/finish.d.ts.map +1 -1
- package/dist/pageFlip/finish.js +10 -2
- package/dist/pageFlip/finish.js.map +1 -1
- package/dist/pageFlip/leaf.d.ts +9 -1
- package/dist/pageFlip/leaf.d.ts.map +1 -1
- package/dist/pageFlip/leaf.js +22 -1
- package/dist/pageFlip/leaf.js.map +1 -1
- package/dist/pageFlip/materials.d.ts.map +1 -1
- package/dist/pageFlip/materials.js +15 -0
- package/dist/pageFlip/materials.js.map +1 -1
- package/dist/pageFlip/through.d.ts +78 -28
- package/dist/pageFlip/through.d.ts.map +1 -1
- package/dist/pageFlip/through.js +136 -27
- package/dist/pageFlip/through.js.map +1 -1
- package/dist/pageFlip.d.ts +8 -0
- package/dist/pageFlip.d.ts.map +1 -1
- package/dist/pageFlip.js +30 -12
- package/dist/pageFlip.js.map +1 -1
- package/dist/pageFlipFlat/shaders.d.ts.map +1 -1
- package/dist/pageFlipFlat/shaders.js +5 -1
- package/dist/pageFlipFlat/shaders.js.map +1 -1
- package/dist/postext/book.d.ts +9 -0
- package/dist/postext/book.d.ts.map +1 -1
- package/dist/postext/book.js +41 -1
- package/dist/postext/book.js.map +1 -1
- package/dist/postext/through.d.ts +2 -1
- package/dist/postext/through.d.ts.map +1 -1
- package/dist/postext/through.js +61 -3
- package/dist/postext/through.js.map +1 -1
- package/dist/viewer/layout.d.ts.map +1 -1
- package/dist/viewer/layout.js +1 -0
- package/dist/viewer/layout.js.map +1 -1
- package/dist/viewer/types.d.ts +5 -0
- package/dist/viewer/types.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MeshDepthMaterial, type Texture } from 'three';
|
|
1
|
+
import { BoxGeometry, MeshDepthMaterial, MeshStandardMaterial, type Texture } from 'three';
|
|
2
2
|
/** A through picture as the document side paints it: RGBA bytes, top row
|
|
3
3
|
* first; RGB the stack seen through the holes, A the depth code (0 off
|
|
4
4
|
* the holes, k the k-th layer beneath). `layers`: how many there are. */
|
|
@@ -7,6 +7,16 @@ export interface FaceThroughData {
|
|
|
7
7
|
height: number;
|
|
8
8
|
data: Uint8ClampedArray;
|
|
9
9
|
layers: number;
|
|
10
|
+
/** The deepest layer is past the book's end (the board or what the
|
|
11
|
+
* book lies on), not a page. */
|
|
12
|
+
end?: boolean;
|
|
13
|
+
/** Each layer's own cut, as many texels as `data`: the four bytes of a
|
|
14
|
+
* texel are a 32-bit word (R the low byte) whose bit k−1 is set where
|
|
15
|
+
* the k-th layer beneath has a hole. The straight-down picture cannot
|
|
16
|
+
* tell a leaf under an overhang (a hole that widens below the page, as
|
|
17
|
+
* the leaves already turned show it) from paper: the walk asks each
|
|
18
|
+
* layer at its own depth (#1592). */
|
|
19
|
+
cuts?: Uint8ClampedArray;
|
|
10
20
|
}
|
|
11
21
|
/** A through picture as a texture: its colour sRGB like the pages' (the
|
|
12
22
|
* alpha, the depth codes, stays as it is), filtered; the shader reads
|
|
@@ -34,6 +44,14 @@ export interface CutUniforms {
|
|
|
34
44
|
uBackThrough: {
|
|
35
45
|
value: Texture | null;
|
|
36
46
|
};
|
|
47
|
+
/** The face's through texture carries the layers' cuts below its
|
|
48
|
+
* picture (see {@link FaceThroughData.cuts}). */
|
|
49
|
+
uHasFrontCuts: {
|
|
50
|
+
value: number;
|
|
51
|
+
};
|
|
52
|
+
uHasBackCuts: {
|
|
53
|
+
value: number;
|
|
54
|
+
};
|
|
37
55
|
uHasFrontThrough: {
|
|
38
56
|
value: number;
|
|
39
57
|
};
|
|
@@ -48,41 +66,78 @@ export interface CutUniforms {
|
|
|
48
66
|
uLeafDepth: {
|
|
49
67
|
value: number;
|
|
50
68
|
};
|
|
69
|
+
/** The depth code of the layer past the book's end, per face (0: the
|
|
70
|
+
* holes stop at a page). */
|
|
71
|
+
uFrontEnd: {
|
|
72
|
+
value: number;
|
|
73
|
+
};
|
|
74
|
+
uBackEnd: {
|
|
75
|
+
value: number;
|
|
76
|
+
};
|
|
77
|
+
/** Nothing lies past the book's end but the desk (no case): the ray
|
|
78
|
+
* that gets there leaves the book. */
|
|
79
|
+
uSeeDesk: {
|
|
80
|
+
value: number;
|
|
81
|
+
};
|
|
51
82
|
}
|
|
52
83
|
export declare const cutUniforms: (mode: number) => CutUniforms;
|
|
53
84
|
/** Declarations for the page material's fragment shader. */
|
|
54
|
-
export declare const CUT_PARS = "\n uniform float uCutMode;\n uniform float uHasFrontCut;\n uniform float uHasBackCut;\n uniform sampler2D uFrontThrough;\n uniform sampler2D uBackThrough;\n uniform float uHasFrontThrough;\n uniform float uHasBackThrough;\n uniform float uThroughLayers;\n uniform float uLeafDepth;\n // The direct light a hole's wall keeps from a point deep in it, and the\n // sky its depth leaves it.\n float throughLit = 1.0;\n float throughAo = 1.0;\n vec4 throughAt(bool front, ivec2 t) {\n return front ? texelFetch(uFrontThrough, t, 0) : texelFetch(uBackThrough, t, 0);\n }\n // The depth code at a point of the face (y down), 0 off the holes.\n float throughDepth(bool front, vec2 p, vec2 size) {\n ivec2 t = ivec2(clamp(p, vec2(0.0), vec2(0.999999)) * size);\n return floor(throughAt(front, t).a * 255.0 + 0.5);\n }\n vec3 throughColour(bool front, vec2 p) {\n return front ? texture2D(uFrontThrough, p).rgb : texture2D(uBackThrough, p).rgb;\n }\n";
|
|
85
|
+
export declare const CUT_PARS = "\n uniform float uCutMode;\n uniform float uHasFrontCut;\n uniform float uHasBackCut;\n uniform sampler2D uFrontThrough;\n uniform sampler2D uBackThrough;\n uniform float uHasFrontCuts;\n uniform float uHasBackCuts;\n uniform float uHasFrontThrough;\n uniform float uHasBackThrough;\n uniform float uThroughLayers;\n uniform float uLeafDepth;\n uniform float uFrontEnd;\n uniform float uBackEnd;\n uniform float uSeeDesk;\n // The direct light a hole's wall keeps from a point deep in it, and the\n // sky its depth leaves it.\n float throughLit = 1.0;\n float throughAo = 1.0;\n vec4 throughAt(bool front, ivec2 t) {\n return front ? texelFetch(uFrontThrough, t, 0) : texelFetch(uBackThrough, t, 0);\n }\n // The depth code at a point of the face (y down), 0 off the holes.\n float throughDepth(bool front, vec2 p, vec2 size) {\n ivec2 t = ivec2(clamp(p, vec2(0.0), vec2(0.999999)) * size);\n return floor(throughAt(front, t).a * 255.0 + 0.5);\n }\n // Whether the k-th layer beneath (k \u2265 1) has a hole at a point of the\n // face, from its own cut; without the cuts, from the straight-down\n // picture (right while every hole lies within the one above it).\n bool layerCut(bool front, vec2 p, vec2 size, float k) {\n if ((front ? uHasFrontCuts : uHasBackCuts) < 0.5) return throughDepth(front, p, size) > k + 0.5;\n ivec2 t = ivec2(clamp(p, vec2(0.0), vec2(0.999999)) * size) + ivec2(0, int(size.y));\n vec4 c = throughAt(front, t);\n int b = int(k) - 1;\n if (b < 0 || b > 31) return false;\n int bits = int(floor((b < 8 ? c.r : b < 16 ? c.g : b < 24 ? c.b : c.a) * 255.0 + 0.5));\n return ((bits >> (b - (b / 8) * 8)) & 1) == 1;\n }\n vec3 throughColour(bool front, vec2 p) {\n if ((front ? uHasFrontCuts : uHasBackCuts) < 0.5) return front ? texture2D(uFrontThrough, p).rgb : texture2D(uBackThrough, p).rgb;\n // The picture is the texture's top half, raw: kept off the cuts'\n // rows by half a texel, and decoded from sRGB here.\n float h = float(front ? textureSize(uFrontThrough, 0).y : textureSize(uBackThrough, 0).y);\n vec2 q = vec2(p.x, min(p.y * 0.5, 0.5 - 0.5 / h));\n vec3 c = front ? texture2D(uFrontThrough, q).rgb : texture2D(uBackThrough, q).rgb;\n return mix(c / 12.92, pow((c + 0.055) / 1.055, vec3(2.4)), step(vec3(0.04045), c));\n }\n";
|
|
55
86
|
/**
|
|
56
87
|
* In `map_fragment`, once the face's page texel `page` (RGBA, alpha the
|
|
57
88
|
* cut) and its print `ink` are known. A leaf in the air drops its holes;
|
|
58
89
|
* an open page draws them: the view ray walked down the stack.
|
|
59
90
|
*/
|
|
60
|
-
export declare const CUT_FRAGMENT = "\n if (uCutMode > 0.5 && (front ? uHasFrontCut : uHasBackCut) > 0.5 && cutA < 0.999) {\n if (uCutMode > 1.5) {\n if (cutA < 0.5) discard;\n } else {\n vec2 p0 = vec2(tuv.x, 1.0 - tuv.y);\n bool hasThrough = (front ? uHasFrontThrough : uHasBackThrough) > 0.5;\n vec2 size = hasThrough ? vec2(front ? textureSize(uFrontThrough, 0) : textureSize(uBackThrough, 0)) : vec2(1.0);\n float d0 = hasThrough ? throughDepth(front, p0, size) : 0.0;\n // The picture is coarser than the page: at the hole's rim it may\n // still say paper where the page's alpha says hole.\n if (hasThrough && d0 < 0.5) {\n for (int i = 0; i < 4; i++) {\n vec2 o = vec2(i == 0 ? 1.0 : i == 1 ? -1.0 : 0.0, i == 2 ? 1.0 : i == 3 ? -1.0 : 0.0) / size;\n d0 = max(d0, throughDepth(front, p0 + o, size));\n }\n }\n // Off the holes (past the leaf's outline): nothing of this page.\n if (d0 < 0.5 && cutA < 0.5) discard;\n vec3 hole = uPaper;\n if (hasThrough && d0 > 0.5) {\n // The face's frame on screen: the gradients of its uv, so a step\n // on the page in view space is a step in the picture.\n vec3 pos = -vViewPosition;\n vec3 dp1 = dFdx(pos);\n vec3 dp2 = dFdy(pos);\n vec3 n = normalize(cross(dp1, dp2));\n vec3 eye = normalize(vViewPosition);\n if (dot(n, eye) < 0.0) n = -n;\n vec2 duv1 = dFdx(p0);\n vec2 duv2 = dFdy(p0);\n vec3 dp2perp = cross(dp2, n);\n vec3 dp1perp = cross(n, dp1);\n float det = dot(dp2perp, dp1);\n vec3 gu = (dp2perp * duv1.x + dp1perp * duv2.x) / det;\n vec3 gv = (dp2perp * duv1.y + dp1perp * duv2.y) / det;\n // A leaf down along the view ray, and a leaf up towards the key.\n float h = uLeafDepth;\n vec3 down = -eye * (h / max(dot(eye, n), 0.05)) + n * h;\n vec2 stepDown = vec2(dot(down, gu), dot(down, gv));\n vec2 stepUp = vec2(0.0);\n #if NUM_DIR_LIGHTS > 0\n vec3 l = directionalLights[0].direction;\n vec3 up = l * (h / max(dot(l, n), 0.05)) - n * h;\n stepUp = vec2(dot(up, gu), dot(up, gv));\n #endif\n float k = 1.0;\n float wall = 0.0;\n vec2 hit = p0;\n for (int i = 1; i <= 33; i++) {\n k = float(i);\n if (k > uThroughLayers) break;\n hit = p0 + stepDown * k;\n
|
|
91
|
+
export declare const CUT_FRAGMENT = "\n if (uCutMode > 0.5 && (front ? uHasFrontCut : uHasBackCut) > 0.5 && cutA < 0.999) {\n if (uCutMode > 1.5) {\n if (cutA < 0.5) discard;\n } else {\n vec2 p0 = vec2(tuv.x, 1.0 - tuv.y);\n bool hasThrough = (front ? uHasFrontThrough : uHasBackThrough) > 0.5;\n vec2 size = hasThrough ? vec2(front ? textureSize(uFrontThrough, 0) : textureSize(uBackThrough, 0)) : vec2(1.0);\n // A texture with the cuts below its picture is twice its height.\n if ((front ? uHasFrontCuts : uHasBackCuts) > 0.5) size.y *= 0.5;\n float d0 = hasThrough ? throughDepth(front, p0, size) : 0.0;\n // The picture is coarser than the page: at the hole's rim it may\n // still say paper where the page's alpha says hole.\n if (hasThrough && d0 < 0.5) {\n for (int i = 0; i < 4; i++) {\n vec2 o = vec2(i == 0 ? 1.0 : i == 1 ? -1.0 : 0.0, i == 2 ? 1.0 : i == 3 ? -1.0 : 0.0) / size;\n d0 = max(d0, throughDepth(front, p0 + o, size));\n }\n }\n // Off the holes (past the leaf's outline): nothing of this page.\n if (d0 < 0.5 && cutA < 0.5) discard;\n vec3 hole = uPaper;\n if (hasThrough && d0 > 0.5) {\n // The face's frame on screen: the gradients of its uv, so a step\n // on the page in view space is a step in the picture.\n vec3 pos = -vViewPosition;\n vec3 dp1 = dFdx(pos);\n vec3 dp2 = dFdy(pos);\n vec3 n = normalize(cross(dp1, dp2));\n vec3 eye = normalize(vViewPosition);\n if (dot(n, eye) < 0.0) n = -n;\n vec2 duv1 = dFdx(p0);\n vec2 duv2 = dFdy(p0);\n vec3 dp2perp = cross(dp2, n);\n vec3 dp1perp = cross(n, dp1);\n float det = dot(dp2perp, dp1);\n vec3 gu = (dp2perp * duv1.x + dp1perp * duv2.x) / det;\n vec3 gv = (dp2perp * duv1.y + dp1perp * duv2.y) / det;\n // A leaf down along the view ray, and a leaf up towards the key.\n float h = uLeafDepth;\n vec3 down = -eye * (h / max(dot(eye, n), 0.05)) + n * h;\n vec2 stepDown = vec2(dot(down, gu), dot(down, gv));\n vec2 stepUp = vec2(0.0);\n #if NUM_DIR_LIGHTS > 0\n vec3 l = directionalLights[0].direction;\n vec3 up = l * (h / max(dot(l, n), 0.05)) - n * h;\n stepUp = vec2(dot(up, gu), dot(up, gv));\n #endif\n float k = 1.0;\n float wall = 0.0;\n vec2 hit = p0;\n for (int i = 1; i <= 33; i++) {\n k = float(i);\n if (k > uThroughLayers) break;\n hit = p0 + stepDown * k;\n // Down through the leaf above this layer: paper there is a\n // wall (the page itself, then each layer at its own depth, so a\n // hole that widens beneath an overhang shows its own step).\n bool clear = k < 1.5 ? throughDepth(front, hit, size) > 0.5 : layerCut(front, hit, size, k - 1.0);\n if (!clear) { wall = 1.0; break; }\n if (!layerCut(front, hit, size, k)) break;\n }\n // Out past the book's last page with nothing there but the desk:\n // the page lets the eye through, to the real desk under the book.\n float endK = front ? uFrontEnd : uBackEnd;\n if (uSeeDesk > 0.5 && endK > 0.5 && wall < 0.5 && k > endK - 0.5) discard;\n // The key's ray from there back up: paper on its way is a wall's\n // shadow.\n float lit = 1.0;\n float top = wall > 0.5 ? k - 0.5 : k;\n for (int j = 1; j <= 33; j++) {\n float z = top - float(j);\n if (z < 0.0) break;\n if (throughDepth(front, hit + stepUp * float(j), size) <= z) { lit = 0.0; break; }\n }\n throughLit = wall > 0.5 ? 0.45 * lit : lit;\n // Deeper is darker: less of the sky reaches down a narrow shaft.\n throughAo = mix(0.35, 1.0, exp(-0.12 * (k - 1.0))) * (wall > 0.5 ? 0.7 : 1.0);\n // A layer reached under an overhang is not in the picture seen\n // straight down: its paper, in the shade the overhang gives it.\n bool seen = throughDepth(front, hit, size) > k - 0.5;\n hole = wall > 0.5 ? uPaper * 0.8 : seen ? throughColour(front, hit) : uPaper * 0.7;\n }\n ink = mix(hole, ink, cutA);\n }\n }\n";
|
|
61
92
|
/**
|
|
62
93
|
* The key light's depth material for a cut leaf: three.js's, with the
|
|
63
94
|
* page texture's alpha discarding the holes (the leaf's front, or its back
|
|
64
95
|
* read through the paper), so the key's shadow falls through them.
|
|
65
96
|
*/
|
|
66
|
-
export declare function cutDepthMaterial(): MeshDepthMaterial & {
|
|
97
|
+
export declare function cutDepthMaterial(cut?: LeafCut): MeshDepthMaterial & {
|
|
67
98
|
userData: {
|
|
68
|
-
cut:
|
|
69
|
-
uCut: {
|
|
70
|
-
value: Texture | null;
|
|
71
|
-
};
|
|
72
|
-
uCutBack: {
|
|
73
|
-
value: number;
|
|
74
|
-
};
|
|
75
|
-
uMirror: {
|
|
76
|
-
value: number;
|
|
77
|
-
};
|
|
78
|
-
};
|
|
99
|
+
cut: LeafCut;
|
|
79
100
|
};
|
|
80
101
|
};
|
|
102
|
+
/** A leaf's cut as its depth material, its caster and a board's edges
|
|
103
|
+
* read it: the painted face whose alpha is the cut, whether that is its
|
|
104
|
+
* back, the book's mirroring, and whether there is a cut at all. */
|
|
105
|
+
export interface LeafCut {
|
|
106
|
+
uCut: {
|
|
107
|
+
value: Texture | null;
|
|
108
|
+
};
|
|
109
|
+
uCutBack: {
|
|
110
|
+
value: number;
|
|
111
|
+
};
|
|
112
|
+
uMirror: {
|
|
113
|
+
value: number;
|
|
114
|
+
};
|
|
115
|
+
uHasCut: {
|
|
116
|
+
value: number;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export declare const leafCut: () => LeafCut;
|
|
120
|
+
/**
|
|
121
|
+
* The edges of a board in the air (#1586): a unit box's four sides (its
|
|
122
|
+
* two faces are the leaf's meshes), its colour the board's. Each side
|
|
123
|
+
* stands only where the leaf has paper at its rim: a rounded or shaped
|
|
124
|
+
* outline takes its edges with it. Without a lid between the two faces a
|
|
125
|
+
* hole stays open through the board's thickness.
|
|
126
|
+
*/
|
|
127
|
+
export declare function boardEdges(cut: LeafCut): {
|
|
128
|
+
geometry: BoxGeometry;
|
|
129
|
+
material: MeshStandardMaterial;
|
|
130
|
+
};
|
|
81
131
|
/** The same discard for the height-map caster of a cut leaf. */
|
|
82
132
|
export declare const CASTER_CUT: {
|
|
83
133
|
pars: string;
|
|
84
134
|
discard: string;
|
|
85
135
|
};
|
|
136
|
+
/** The leaf's cut uniforms its depth material and its board's edges share,
|
|
137
|
+
* made once per mesh. */
|
|
138
|
+
export declare const leafCutOf: (mesh: {
|
|
139
|
+
userData: Record<string, unknown>;
|
|
140
|
+
}) => LeafCut;
|
|
86
141
|
type CutMesh = {
|
|
87
142
|
material: {
|
|
88
143
|
userData: {
|
|
@@ -108,31 +163,26 @@ export interface CutSources {
|
|
|
108
163
|
throughOf(src: unknown): {
|
|
109
164
|
texture: Texture;
|
|
110
165
|
layers: number;
|
|
166
|
+
end?: boolean;
|
|
111
167
|
} | null;
|
|
112
168
|
}
|
|
113
169
|
/**
|
|
114
170
|
* Sets a page mesh's cut uniforms from the pages on its faces: which face
|
|
115
171
|
* is cut, what its holes show (open pages), a leaf's thickness, and for a
|
|
116
172
|
* leaf in the air its key-light depth material and its caster, which
|
|
117
|
-
* discard the holes (the shared caster again once it is not cut).
|
|
173
|
+
* discard the holes (the shared caster again once it is not cut). `desk`:
|
|
174
|
+
* nothing lies past the book's end but the desk (no case), so an open page
|
|
175
|
+
* whose holes reach it lets the key light through them too.
|
|
118
176
|
*/
|
|
119
177
|
export declare function dressCut(mesh: CutMesh, sources: CutSources, leafDepth: number, caster: {
|
|
120
178
|
shared: unknown;
|
|
121
179
|
cut: () => unknown;
|
|
122
|
-
}): void;
|
|
180
|
+
}, desk?: boolean): void;
|
|
123
181
|
/** The caster discard's uniforms, fresh for each cut leaf. */
|
|
124
182
|
export declare const casterCut: () => {
|
|
125
|
-
uniforms: {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
};
|
|
129
|
-
uCutBack: {
|
|
130
|
-
value: number;
|
|
131
|
-
};
|
|
132
|
-
uMirror: {
|
|
133
|
-
value: number;
|
|
134
|
-
};
|
|
135
|
-
};
|
|
183
|
+
uniforms: Record<string, {
|
|
184
|
+
value: unknown;
|
|
185
|
+
}>;
|
|
136
186
|
pars: string;
|
|
137
187
|
discard: string;
|
|
138
188
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"through.d.ts","sourceRoot":"","sources":["../../src/pageFlip/through.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"through.d.ts","sourceRoot":"","sources":["../../src/pageFlip/through.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,WAAW,EAA6B,iBAAiB,EAAE,oBAAoB,EAAkE,KAAK,OAAO,EAAE,MAAM,OAAO,CAAC;AAEtL;;0EAE0E;AAC1E,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,iBAAiB,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf;qCACiC;IACjC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd;;;;;0CAKsC;IACtC,IAAI,CAAC,EAAE,iBAAiB,CAAC;CAC1B;AAED;;8DAE8D;AAC9D,wBAAgB,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAuBhE;AAED;4DAC4D;AAC5D,eAAO,MAAM,OAAO,IAAI,CAAC;AACzB,eAAO,MAAM,QAAQ,IAAI,CAAC;AAC1B,eAAO,MAAM,OAAO,IAAI,CAAC;AAEzB,8DAA8D;AAC9D,MAAM,WAAW,WAAW;I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UAAU;IACzB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC;IAC7B,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;CACrF;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,OAAO,CAAA;CAAE,EAAE,IAAI,UAAQ,QAiD5I;AAED,8DAA8D;AAC9D,eAAO,MAAM,SAAS;cAAyD,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;;;CAAG,CAAC"}
|
package/dist/pageFlip/through.js
CHANGED
|
@@ -7,17 +7,39 @@
|
|
|
7
7
|
// The fragment walks the view ray down the stack a leaf at a time: a
|
|
8
8
|
// layer shows where the ray reaches it, a cut wall where it meets paper
|
|
9
9
|
// first; the key light's ray is walked back up for the shadow the walls
|
|
10
|
-
// throw, and the deep pages darken with depth.
|
|
10
|
+
// throw, and the deep pages darken with depth. Where the holes go
|
|
11
|
+
// through to the end of the book and nothing lies past it but the desk
|
|
12
|
+
// (a book whose own printed covers are its case, #1586), the ray leaves
|
|
13
|
+
// the book: the page discards there and the desk shows, in the key
|
|
14
|
+
// light's depth too, so light falls through.
|
|
11
15
|
// - A leaf in the air (or the block of a long jump) is real geometry: it
|
|
12
16
|
// discards its holes, in its colour, in its key-light depth and in the
|
|
13
17
|
// height map, so the open page under it shows and shadows fall through.
|
|
18
|
+
// A board in the air is two faces with its edges between them: the edges
|
|
19
|
+
// follow the leaf's outline and leave the holes open, and a face seen
|
|
20
|
+
// from inside the board, through a hole, is the board's core (#1586).
|
|
14
21
|
// - Paper cut away past the leaf's outline (rounded corners, a shaped
|
|
15
22
|
// book) is discarded everywhere.
|
|
16
|
-
import { DataTexture, LinearFilter, MeshDepthMaterial, RGBADepthPacking, RGBAFormat, SRGBColorSpace, UnsignedByteType } from 'three';
|
|
23
|
+
import { BoxGeometry, DataTexture, LinearFilter, MeshDepthMaterial, MeshStandardMaterial, RGBADepthPacking, RGBAFormat, SRGBColorSpace, UnsignedByteType } from 'three';
|
|
17
24
|
/** A through picture as a texture: its colour sRGB like the pages' (the
|
|
18
25
|
* alpha, the depth codes, stays as it is), filtered; the shader reads
|
|
19
26
|
* the codes texel by texel (`texelFetch`), never blended. */
|
|
20
27
|
export function throughTexture(through) {
|
|
28
|
+
if (through.cuts) {
|
|
29
|
+
// The layers' cuts ride below the picture, in rows of their own (a
|
|
30
|
+
// sampler more would pass the page shader's texture units): bits, so
|
|
31
|
+
// the texture stays raw and the shader decodes the picture's sRGB.
|
|
32
|
+
const both = new Uint8Array(through.data.byteLength * 2);
|
|
33
|
+
both.set(through.data, 0);
|
|
34
|
+
both.set(through.cuts, through.data.byteLength);
|
|
35
|
+
const texture = new DataTexture(both, through.width, through.height * 2, RGBAFormat, UnsignedByteType);
|
|
36
|
+
texture.minFilter = LinearFilter;
|
|
37
|
+
texture.magFilter = LinearFilter;
|
|
38
|
+
texture.generateMipmaps = false;
|
|
39
|
+
texture.needsUpdate = true;
|
|
40
|
+
texture.userData.cuts = true;
|
|
41
|
+
return texture;
|
|
42
|
+
}
|
|
21
43
|
const texture = new DataTexture(new Uint8Array(through.data.buffer, through.data.byteOffset, through.data.byteLength), through.width, through.height, RGBAFormat, UnsignedByteType);
|
|
22
44
|
texture.colorSpace = SRGBColorSpace;
|
|
23
45
|
texture.minFilter = LinearFilter;
|
|
@@ -37,10 +59,15 @@ export const cutUniforms = (mode) => ({
|
|
|
37
59
|
uHasBackCut: { value: 0 },
|
|
38
60
|
uFrontThrough: { value: null },
|
|
39
61
|
uBackThrough: { value: null },
|
|
62
|
+
uHasFrontCuts: { value: 0 },
|
|
63
|
+
uHasBackCuts: { value: 0 },
|
|
40
64
|
uHasFrontThrough: { value: 0 },
|
|
41
65
|
uHasBackThrough: { value: 0 },
|
|
42
66
|
uThroughLayers: { value: 0 },
|
|
43
67
|
uLeafDepth: { value: 1 },
|
|
68
|
+
uFrontEnd: { value: 0 },
|
|
69
|
+
uBackEnd: { value: 0 },
|
|
70
|
+
uSeeDesk: { value: 0 },
|
|
44
71
|
});
|
|
45
72
|
/** Declarations for the page material's fragment shader. */
|
|
46
73
|
export const CUT_PARS = /* glsl */ `
|
|
@@ -49,10 +76,15 @@ export const CUT_PARS = /* glsl */ `
|
|
|
49
76
|
uniform float uHasBackCut;
|
|
50
77
|
uniform sampler2D uFrontThrough;
|
|
51
78
|
uniform sampler2D uBackThrough;
|
|
79
|
+
uniform float uHasFrontCuts;
|
|
80
|
+
uniform float uHasBackCuts;
|
|
52
81
|
uniform float uHasFrontThrough;
|
|
53
82
|
uniform float uHasBackThrough;
|
|
54
83
|
uniform float uThroughLayers;
|
|
55
84
|
uniform float uLeafDepth;
|
|
85
|
+
uniform float uFrontEnd;
|
|
86
|
+
uniform float uBackEnd;
|
|
87
|
+
uniform float uSeeDesk;
|
|
56
88
|
// The direct light a hole's wall keeps from a point deep in it, and the
|
|
57
89
|
// sky its depth leaves it.
|
|
58
90
|
float throughLit = 1.0;
|
|
@@ -65,8 +97,26 @@ export const CUT_PARS = /* glsl */ `
|
|
|
65
97
|
ivec2 t = ivec2(clamp(p, vec2(0.0), vec2(0.999999)) * size);
|
|
66
98
|
return floor(throughAt(front, t).a * 255.0 + 0.5);
|
|
67
99
|
}
|
|
100
|
+
// Whether the k-th layer beneath (k ≥ 1) has a hole at a point of the
|
|
101
|
+
// face, from its own cut; without the cuts, from the straight-down
|
|
102
|
+
// picture (right while every hole lies within the one above it).
|
|
103
|
+
bool layerCut(bool front, vec2 p, vec2 size, float k) {
|
|
104
|
+
if ((front ? uHasFrontCuts : uHasBackCuts) < 0.5) return throughDepth(front, p, size) > k + 0.5;
|
|
105
|
+
ivec2 t = ivec2(clamp(p, vec2(0.0), vec2(0.999999)) * size) + ivec2(0, int(size.y));
|
|
106
|
+
vec4 c = throughAt(front, t);
|
|
107
|
+
int b = int(k) - 1;
|
|
108
|
+
if (b < 0 || b > 31) return false;
|
|
109
|
+
int bits = int(floor((b < 8 ? c.r : b < 16 ? c.g : b < 24 ? c.b : c.a) * 255.0 + 0.5));
|
|
110
|
+
return ((bits >> (b - (b / 8) * 8)) & 1) == 1;
|
|
111
|
+
}
|
|
68
112
|
vec3 throughColour(bool front, vec2 p) {
|
|
69
|
-
return front ? texture2D(uFrontThrough, p).rgb : texture2D(uBackThrough, p).rgb;
|
|
113
|
+
if ((front ? uHasFrontCuts : uHasBackCuts) < 0.5) return front ? texture2D(uFrontThrough, p).rgb : texture2D(uBackThrough, p).rgb;
|
|
114
|
+
// The picture is the texture's top half, raw: kept off the cuts'
|
|
115
|
+
// rows by half a texel, and decoded from sRGB here.
|
|
116
|
+
float h = float(front ? textureSize(uFrontThrough, 0).y : textureSize(uBackThrough, 0).y);
|
|
117
|
+
vec2 q = vec2(p.x, min(p.y * 0.5, 0.5 - 0.5 / h));
|
|
118
|
+
vec3 c = front ? texture2D(uFrontThrough, q).rgb : texture2D(uBackThrough, q).rgb;
|
|
119
|
+
return mix(c / 12.92, pow((c + 0.055) / 1.055, vec3(2.4)), step(vec3(0.04045), c));
|
|
70
120
|
}
|
|
71
121
|
`;
|
|
72
122
|
/**
|
|
@@ -82,6 +132,8 @@ export const CUT_FRAGMENT = /* glsl */ `
|
|
|
82
132
|
vec2 p0 = vec2(tuv.x, 1.0 - tuv.y);
|
|
83
133
|
bool hasThrough = (front ? uHasFrontThrough : uHasBackThrough) > 0.5;
|
|
84
134
|
vec2 size = hasThrough ? vec2(front ? textureSize(uFrontThrough, 0) : textureSize(uBackThrough, 0)) : vec2(1.0);
|
|
135
|
+
// A texture with the cuts below its picture is twice its height.
|
|
136
|
+
if ((front ? uHasFrontCuts : uHasBackCuts) > 0.5) size.y *= 0.5;
|
|
85
137
|
float d0 = hasThrough ? throughDepth(front, p0, size) : 0.0;
|
|
86
138
|
// The picture is coarser than the page: at the hole's rim it may
|
|
87
139
|
// still say paper where the page's alpha says hole.
|
|
@@ -127,10 +179,17 @@ export const CUT_FRAGMENT = /* glsl */ `
|
|
|
127
179
|
k = float(i);
|
|
128
180
|
if (k > uThroughLayers) break;
|
|
129
181
|
hit = p0 + stepDown * k;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
182
|
+
// Down through the leaf above this layer: paper there is a
|
|
183
|
+
// wall (the page itself, then each layer at its own depth, so a
|
|
184
|
+
// hole that widens beneath an overhang shows its own step).
|
|
185
|
+
bool clear = k < 1.5 ? throughDepth(front, hit, size) > 0.5 : layerCut(front, hit, size, k - 1.0);
|
|
186
|
+
if (!clear) { wall = 1.0; break; }
|
|
187
|
+
if (!layerCut(front, hit, size, k)) break;
|
|
133
188
|
}
|
|
189
|
+
// Out past the book's last page with nothing there but the desk:
|
|
190
|
+
// the page lets the eye through, to the real desk under the book.
|
|
191
|
+
float endK = front ? uFrontEnd : uBackEnd;
|
|
192
|
+
if (uSeeDesk > 0.5 && endK > 0.5 && wall < 0.5 && k > endK - 0.5) discard;
|
|
134
193
|
// The key's ray from there back up: paper on its way is a wall's
|
|
135
194
|
// shadow.
|
|
136
195
|
float lit = 1.0;
|
|
@@ -143,7 +202,10 @@ export const CUT_FRAGMENT = /* glsl */ `
|
|
|
143
202
|
throughLit = wall > 0.5 ? 0.45 * lit : lit;
|
|
144
203
|
// Deeper is darker: less of the sky reaches down a narrow shaft.
|
|
145
204
|
throughAo = mix(0.35, 1.0, exp(-0.12 * (k - 1.0))) * (wall > 0.5 ? 0.7 : 1.0);
|
|
146
|
-
|
|
205
|
+
// A layer reached under an overhang is not in the picture seen
|
|
206
|
+
// straight down: its paper, in the shade the overhang gives it.
|
|
207
|
+
bool seen = throughDepth(front, hit, size) > k - 0.5;
|
|
208
|
+
hole = wall > 0.5 ? uPaper * 0.8 : seen ? throughColour(front, hit) : uPaper * 0.7;
|
|
147
209
|
}
|
|
148
210
|
ink = mix(hole, ink, cutA);
|
|
149
211
|
}
|
|
@@ -154,9 +216,8 @@ export const CUT_FRAGMENT = /* glsl */ `
|
|
|
154
216
|
* page texture's alpha discarding the holes (the leaf's front, or its back
|
|
155
217
|
* read through the paper), so the key's shadow falls through them.
|
|
156
218
|
*/
|
|
157
|
-
export function cutDepthMaterial() {
|
|
219
|
+
export function cutDepthMaterial(cut = leafCut()) {
|
|
158
220
|
const m = new MeshDepthMaterial({ depthPacking: RGBADepthPacking });
|
|
159
|
-
const cut = { uCut: { value: null }, uCutBack: { value: 0 }, uMirror: { value: 0 } };
|
|
160
221
|
m.userData.cut = cut;
|
|
161
222
|
m.onBeforeCompile = (shader) => {
|
|
162
223
|
Object.assign(shader.uniforms, cut);
|
|
@@ -169,29 +230,64 @@ export function cutDepthMaterial() {
|
|
|
169
230
|
};
|
|
170
231
|
return m;
|
|
171
232
|
}
|
|
233
|
+
export const leafCut = () => ({ uCut: { value: null }, uCutBack: { value: 0 }, uMirror: { value: 0 }, uHasCut: { value: 0 } });
|
|
172
234
|
/** The leaf's cut at a point, from either face's texture. */
|
|
173
235
|
const CUT_UV_PARS = /* glsl */ `
|
|
174
236
|
uniform sampler2D uCut;
|
|
175
237
|
uniform float uCutBack;
|
|
176
238
|
uniform float uMirror;
|
|
239
|
+
uniform float uHasCut;
|
|
177
240
|
varying vec2 vCutUv;
|
|
178
241
|
`;
|
|
179
242
|
const CUT_DISCARD = /* glsl */ `
|
|
180
|
-
{
|
|
243
|
+
if (uHasCut > 0.5) {
|
|
181
244
|
float u = uMirror > 0.5 ? 1.0 - vCutUv.x : vCutUv.x;
|
|
182
245
|
vec2 st = uCutBack > 0.5 ? vec2(1.0 - u, vCutUv.y) : vec2(u, vCutUv.y);
|
|
183
|
-
|
|
246
|
+
// Kept a hair inside the sheet: a board's edges stand on its rim.
|
|
247
|
+
if (texture2D(uCut, clamp(st, 0.002, 0.998)).a < 0.5) discard;
|
|
184
248
|
}
|
|
185
249
|
`;
|
|
250
|
+
/**
|
|
251
|
+
* The edges of a board in the air (#1586): a unit box's four sides (its
|
|
252
|
+
* two faces are the leaf's meshes), its colour the board's. Each side
|
|
253
|
+
* stands only where the leaf has paper at its rim: a rounded or shaped
|
|
254
|
+
* outline takes its edges with it. Without a lid between the two faces a
|
|
255
|
+
* hole stays open through the board's thickness.
|
|
256
|
+
*/
|
|
257
|
+
export function boardEdges(cut) {
|
|
258
|
+
const box = new BoxGeometry(1, 1, 1);
|
|
259
|
+
// A box's groups run +x, −x, +y, −y, +z, −z: the faces are the last two.
|
|
260
|
+
const sides = box.groups.slice(0, 4).reduce((n, g) => n + g.count, 0);
|
|
261
|
+
box.setIndex(Array.from(box.index.array.slice(0, sides)));
|
|
262
|
+
box.clearGroups();
|
|
263
|
+
const material = new MeshStandardMaterial({ roughness: 0.8 });
|
|
264
|
+
material.onBeforeCompile = (shader) => {
|
|
265
|
+
Object.assign(shader.uniforms, cut);
|
|
266
|
+
shader.vertexShader = shader.vertexShader
|
|
267
|
+
.replace("#include <common>", "#include <common>\nvarying vec2 vCutUv;")
|
|
268
|
+
// The box's x runs from the spine (−½) to the fore-edge, y from foot
|
|
269
|
+
// to head: the leaf's own uv.
|
|
270
|
+
.replace("#include <begin_vertex>", "#include <begin_vertex>\nvCutUv = position.xy + 0.5;");
|
|
271
|
+
shader.fragmentShader = shader.fragmentShader
|
|
272
|
+
.replace("#include <common>", `#include <common>\n${CUT_UV_PARS}`)
|
|
273
|
+
.replace("#include <clipping_planes_fragment>", `#include <clipping_planes_fragment>\n${CUT_DISCARD}`);
|
|
274
|
+
};
|
|
275
|
+
return { geometry: box, material };
|
|
276
|
+
}
|
|
186
277
|
/** The same discard for the height-map caster of a cut leaf. */
|
|
187
278
|
export const CASTER_CUT = { pars: CUT_UV_PARS, discard: CUT_DISCARD };
|
|
279
|
+
/** The leaf's cut uniforms its depth material and its board's edges share,
|
|
280
|
+
* made once per mesh. */
|
|
281
|
+
export const leafCutOf = (mesh) => (mesh.userData.leafCut ??= leafCut());
|
|
188
282
|
/**
|
|
189
283
|
* Sets a page mesh's cut uniforms from the pages on its faces: which face
|
|
190
284
|
* is cut, what its holes show (open pages), a leaf's thickness, and for a
|
|
191
285
|
* leaf in the air its key-light depth material and its caster, which
|
|
192
|
-
* discard the holes (the shared caster again once it is not cut).
|
|
286
|
+
* discard the holes (the shared caster again once it is not cut). `desk`:
|
|
287
|
+
* nothing lies past the book's end but the desk (no case), so an open page
|
|
288
|
+
* whose holes reach it lets the key light through them too.
|
|
193
289
|
*/
|
|
194
|
-
export function dressCut(mesh, sources, leafDepth, caster) {
|
|
290
|
+
export function dressCut(mesh, sources, leafDepth, caster, desk = false) {
|
|
195
291
|
const u = mesh.material.userData.uniforms;
|
|
196
292
|
const front = mesh.userData.Front;
|
|
197
293
|
const back = mesh.userData.Back;
|
|
@@ -207,29 +303,42 @@ export function dressCut(mesh, sources, leafDepth, caster) {
|
|
|
207
303
|
u.uHasFrontThrough.value = ft ? 1 : 0;
|
|
208
304
|
u.uBackThrough.value = bt?.texture ?? null;
|
|
209
305
|
u.uHasBackThrough.value = bt ? 1 : 0;
|
|
306
|
+
u.uHasFrontCuts.value = ft?.texture.userData.cuts ? 1 : 0;
|
|
307
|
+
u.uHasBackCuts.value = bt?.texture.userData.cuts ? 1 : 0;
|
|
210
308
|
u.uThroughLayers.value = Math.max(ft?.layers ?? 0, bt?.layers ?? 0);
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
309
|
+
u.uFrontEnd.value = ft?.end ? ft.layers : 0;
|
|
310
|
+
u.uBackEnd.value = bt?.end ? bt.layers : 0;
|
|
311
|
+
u.uSeeDesk.value = desk ? 1 : 0;
|
|
312
|
+
const air = u.uCutMode.value === CUT_AIR;
|
|
313
|
+
// The face's holes, from whichever face is painted and cut.
|
|
214
314
|
const tex = fc && u.uFront.value ? u.uFront.value : bc && u.uBack.value ? u.uBack.value : null;
|
|
315
|
+
const shared = leafCutOf(mesh);
|
|
316
|
+
shared.uCut.value = tex;
|
|
317
|
+
shared.uHasCut.value = tex ? 1 : 0;
|
|
318
|
+
shared.uCutBack.value = tex && tex !== u.uFront.value ? 1 : 0;
|
|
319
|
+
shared.uMirror.value = u.uMirror.value;
|
|
320
|
+
// An open page drops its holes from the key light's depth only where the
|
|
321
|
+
// desk shows through them: elsewhere the pages beneath are its own
|
|
322
|
+
// picture, shadowed by the walk.
|
|
323
|
+
const throughToDesk = open && desk && !!(ft?.end || bt?.end);
|
|
215
324
|
const casterMesh = mesh.userData.caster;
|
|
216
|
-
if (!tex) {
|
|
325
|
+
if (!tex || !(air || throughToDesk)) {
|
|
217
326
|
mesh.customDepthMaterial = undefined;
|
|
218
327
|
if (casterMesh)
|
|
219
328
|
casterMesh.material = caster.shared;
|
|
220
329
|
return;
|
|
221
330
|
}
|
|
222
|
-
|
|
331
|
+
mesh.customDepthMaterial = (mesh.userData.cutDepth ??= cutDepthMaterial(shared));
|
|
332
|
+
if (!casterMesh)
|
|
333
|
+
return;
|
|
223
334
|
const cutCaster = (mesh.userData.cutCaster ??= caster.cut());
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
if (casterMesh)
|
|
231
|
-
casterMesh.material = cutCaster;
|
|
335
|
+
const c = cutCaster.uniforms;
|
|
336
|
+
c.uCut.value = tex;
|
|
337
|
+
c.uCutBack.value = shared.uCutBack.value;
|
|
338
|
+
c.uMirror.value = shared.uMirror.value;
|
|
339
|
+
c.uHasCut.value = 1;
|
|
340
|
+
casterMesh.material = cutCaster;
|
|
232
341
|
}
|
|
233
342
|
/** The caster discard's uniforms, fresh for each cut leaf. */
|
|
234
|
-
export const casterCut = () => ({ ...CASTER_CUT, uniforms: {
|
|
343
|
+
export const casterCut = () => ({ ...CASTER_CUT, uniforms: { ...leafCut() } });
|
|
235
344
|
//# sourceMappingURL=through.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"through.js","sourceRoot":"","sources":["../../src/pageFlip/through.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,wEAAwE;AACxE,4BAA4B;AAC5B,wEAAwE;AACxE,0EAA0E;AAC1E,2EAA2E;AAC3E,uEAAuE;AACvE,0EAA0E;AAC1E,0EAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"through.js","sourceRoot":"","sources":["../../src/pageFlip/through.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,wEAAwE;AACxE,4BAA4B;AAC5B,wEAAwE;AACxE,0EAA0E;AAC1E,2EAA2E;AAC3E,uEAAuE;AACvE,0EAA0E;AAC1E,0EAA0E;AAC1E,oEAAoE;AACpE,yEAAyE;AACzE,0EAA0E;AAC1E,qEAAqE;AACrE,+CAA+C;AAC/C,yEAAyE;AACzE,yEAAyE;AACzE,0EAA0E;AAC1E,2EAA2E;AAC3E,wEAAwE;AACxE,wEAAwE;AACxE,sEAAsE;AACtE,mCAAmC;AACnC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,UAAU,EAAE,cAAc,EAAE,gBAAgB,EAAgB,MAAM,OAAO,CAAC;AAsBtL;;8DAE8D;AAC9D,MAAM,UAAU,cAAc,CAAC,OAAwB;IACrD,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,mEAAmE;QACnE,qEAAqE;QACrE,mEAAmE;QACnE,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;QACzD,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAC1B,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC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C;IAC1C,CAAC,CAAC,OAAQ,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;IACxC,CAAC,CAAC,OAAQ,CAAC,KAAK,GAAG,CAAC,CAAC;IACrB,UAAU,CAAC,QAAQ,GAAG,SAAS,CAAC;AAClC,CAAC;AAED,8DAA8D;AAC9D,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,QAAQ,EAAE,EAAE,GAAG,OAAO,EAAE,EAAwC,EAAE,CAAC,CAAC"}
|
package/dist/pageFlip.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type FolioConfig, type FolioPaperConfig } from 'postext';
|
|
2
|
+
import { type EdgeOutline } from './bookGeometry.js';
|
|
2
3
|
import { type FaceFinish } from './pageFlip/finish.js';
|
|
3
4
|
export { BLOCK_PAGES } from './pageFlip/constants.js';
|
|
4
5
|
export { withStockForExtent } from './pageFlip/materials.js';
|
|
@@ -79,6 +80,9 @@ export interface FlipAppearance {
|
|
|
79
80
|
* the right. Fitted to cover the back of the block, centred. A
|
|
80
81
|
* saddle-stitched book has no spine and shows none. */
|
|
81
82
|
spineImage?: PageSource;
|
|
83
|
+
/** The leaves' outline past the spine when they are cut to a shape
|
|
84
|
+
* (rounded corners, a shaped book): the blocks' sides follow it. */
|
|
85
|
+
edgeOutline?: EdgeOutline;
|
|
82
86
|
}
|
|
83
87
|
/**
|
|
84
88
|
* Turns the pages of the viewer's DOM spread in a 3D scene: the book lies
|
|
@@ -240,6 +244,10 @@ export declare class PageFlipper {
|
|
|
240
244
|
/** A mesh's faces' finish masks, and the clear coat a varnish needs;
|
|
241
245
|
* their die-cuts (#1569). */
|
|
242
246
|
private dressFinish;
|
|
247
|
+
/** Nothing lies under the book's outer leaves but the desk: its own
|
|
248
|
+
* printed covers stand for the case (or folded sheets have none), so a
|
|
249
|
+
* hole through to the end of the book shows the desk (#1586). */
|
|
250
|
+
private onDesk;
|
|
243
251
|
/** The special inks of the pages (#1568): page source → its finish
|
|
244
252
|
* mask. Pages left out have none; their textures are freed. */
|
|
245
253
|
setFinishes(finishes: ReadonlyMap<PageSource, FaceFinish>): void;
|
package/dist/pageFlip.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pageFlip.d.ts","sourceRoot":"","sources":["../src/pageFlip.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAgD,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"pageFlip.d.ts","sourceRoot":"","sources":["../src/pageFlip.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAgD,MAAM,SAAS,CAAC;AAChH,OAAO,EAA6D,KAAK,WAAW,EAAgB,MAAM,mBAAmB,CAAC;AAW9H,OAAO,EAA+B,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIpF,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE9E;wDACwD;AACxD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,IAAI,CAAC;AAE9E,gCAAgC;AAChC,MAAM,MAAM,SAAS,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AAIjD;;;;;;;;;GASG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjC,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjC,IAAI,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