@edv4h/usketch-css3d-renderer 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +131 -2
- package/dist/css3d-css.d.ts +94 -0
- package/dist/css3d-css.d.ts.map +1 -0
- package/dist/css3d-css.js +136 -0
- package/dist/css3d-css.js.map +1 -0
- package/dist/css3d-renderer.d.ts +85 -0
- package/dist/css3d-renderer.d.ts.map +1 -0
- package/dist/css3d-renderer.js +461 -0
- package/dist/css3d-renderer.js.map +1 -0
- package/dist/css3d-shapes.d.ts +23 -0
- package/dist/css3d-shapes.d.ts.map +1 -0
- package/dist/css3d-shapes.js +110 -0
- package/dist/css3d-shapes.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/shapes-layer.d.ts +53 -0
- package/dist/shapes-layer.d.ts.map +1 -0
- package/dist/shapes-layer.js +198 -0
- package/dist/shapes-layer.js.map +1 -0
- package/dist/shapes-layout.d.ts +163 -0
- package/dist/shapes-layout.d.ts.map +1 -0
- package/dist/shapes-layout.js +277 -0
- package/dist/shapes-layout.js.map +1 -0
- package/package.json +50 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 EdV4H
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,132 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @edv4h/usketch-css3d-renderer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
ボードの 3D 表示(コアの `View3dState`)を CSS の 3D 変形で描くレンダラー。DOM レンダラーと組み合わせて使う。Shape は 2D の DOM のまま描き、それを載せた層だけを傾けて奥へ続く地面にする。3D の見た目を持つ Shape(`ShapeData.view3d`)は、自分の層(`shape-3d`)で地面から立ち上げて描く。
|
|
4
|
+
|
|
5
|
+
Mode 7 などの 3D ビューは、ボードの 3D 表示の状態(カメラ・切り替えの進み具合・描画距離)を変えるだけで、描くのはこのレンダラー。
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @edv4h/usketch-css3d-renderer @edv4h/usketch-dom-renderer @edv4h/usketch-shared react
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 使い方
|
|
14
|
+
|
|
15
|
+
DOM レンダラーと並べて追加する。
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { createCss3dRendererPlugin } from "@edv4h/usketch-css3d-renderer";
|
|
19
|
+
import { createDomRendererPlugin } from "@edv4h/usketch-dom-renderer";
|
|
20
|
+
import { createMode7Plugin } from "@edv4h/usketch-plugin-mode7";
|
|
21
|
+
|
|
22
|
+
createApp({
|
|
23
|
+
plugins: [
|
|
24
|
+
createDomRendererPlugin(),
|
|
25
|
+
createCss3dRendererPlugin(),
|
|
26
|
+
createMode7Plugin(),
|
|
27
|
+
],
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`createMode7Plugin` は、ボードにレンダラーが無ければ自分で 1 つ用意する。今のバージョンでは追加しなくても動くが、次のメジャーからはホストが追加する。
|
|
32
|
+
|
|
33
|
+
## どの層をどう描くか
|
|
34
|
+
|
|
35
|
+
層は `Layer.view3d` で 3D 表示での見え方を宣言する。
|
|
36
|
+
|
|
37
|
+
| `view3d` | 描き方 |
|
|
38
|
+
|------|------|
|
|
39
|
+
| `tilt` | カメラの傾きで地面に寝かせ、描画距離より奥を切り取る |
|
|
40
|
+
| `depth` | `tilt` と同じく寝かせるが切り取らず、中の要素が地面から立ち上がれるように 3D の文脈を保つ |
|
|
41
|
+
| `screen` / 未指定 | 画面に固定したまま(HUD・空など) |
|
|
42
|
+
| `ground` | 自分で地面を描く層(標高のメッシュなど)。傾けない。奥行きステージでは、地面に立つものより奥に置く |
|
|
43
|
+
| `hidden` | 3D 表示の間は出さない |
|
|
44
|
+
|
|
45
|
+
3D ビューが自分の層ピッカーを持つとき(Mode 7)は、`setTiltLayers` / `setDepthLayers` で一覧を渡す。`null` で宣言に戻る。
|
|
46
|
+
|
|
47
|
+
## 奥行きステージ(実験)
|
|
48
|
+
|
|
49
|
+
既定では、傾けた層は層の順に重なる(後の層が前の層の上に描かれる)。奥行きステージをオンにすると、メインのキャンバスを 1 つの 3D 空間にして、傾けた層の中身を実際の奥行きで重ねる。立てた看板の後ろにいるキャラクターは看板に隠れ、手前にいれば看板の前に出る。
|
|
50
|
+
|
|
51
|
+
HUD の「3D の描き方(CSS 3D)」→「奥行きで重ねる(実験)」か、`setDepthStage(true)` で切り替える。
|
|
52
|
+
|
|
53
|
+
- 傾けない層は邪魔にならない位置へ動かす: 最初の傾けた層より前の層(空)と `ground` の層は奥へ、それ以外(霧・HUD)は手前へ。それぞれの中では層の順を保つ
|
|
54
|
+
- `ground` の層が何かを描いている間は、その下に重なる層(傾けた層も)をさらに奥へ置く。平らなボードでも隠れていたものなので見た目は変わらない
|
|
55
|
+
- キャンバスの背景は一番奥に描き直す。ステージ自身は切り取れない(Chrome では `overflow: clip` で 3D が平らになる)ので、親要素で切り取る
|
|
56
|
+
- 標高のメッシュ(canvas)は奥行きで並ばないので、その陰に入ったものは下の「地形の陰」で扱う
|
|
57
|
+
|
|
58
|
+
## 地形の陰
|
|
59
|
+
|
|
60
|
+
標高のメッシュは canvas なので、ブラウザは「丘の向こうの看板」を丘の後ろに回せない(丘の上に描いてしまう)。そこで、カメラから見て地面の陰に入ったものを薄くする(既定)か隠す。
|
|
61
|
+
|
|
62
|
+
- 判定は shared の純関数 `isOccluded(point, view, heightAt)`: 点から目(`cameraEye(view)`、CSS の `perspective()` の視点)までの視線に沿って地面の高さ(`ctx.height` の `groundAt`)を調べ、視線より高い地面があれば陰
|
|
63
|
+
- レンダラーはこの答えを `view3dOcclusionService`(shared)で出す。3D の Shape は上端が陰に入ったら、キャラクターは体の中ほどが入ったら薄くなる。キャラクターの体は描き手(ホスト)が `occluded` を見て面ごとに薄くする(3D の入れ物に opacity を付けると平らになるため)
|
|
64
|
+
- 箱(`box`)は壁と天面を 1 枚ずつ薄くする。種別の自前の 3D 表現(`render3d`)は薄くすると平らになるので、陰では隠す
|
|
65
|
+
- 毎フレームすべてを調べると重いので、答えは 100ms 使い回し、1 フレームで調べ直すのは 40 個まで(`createOcclusionCache`)
|
|
66
|
+
- HUD の「地形の陰」(薄くする / 隠す / そのまま)か `setOcclusion(mode)` で切り替える
|
|
67
|
+
|
|
68
|
+
## 3D の Shape
|
|
69
|
+
|
|
70
|
+
`view3d`(または種別の既定)を持つ Shape を、`depth` の層 `shape-3d`(order 51)で立ち上げて描く。
|
|
71
|
+
|
|
72
|
+
| mode | 見え方 |
|
|
73
|
+
|---|---|
|
|
74
|
+
| `stand` | 下辺の中点を軸に起こして立てる。`facing: "camera"` はカメラの方を向く |
|
|
75
|
+
| `box` | 面を `height` だけ持ち上げて天面にし、四辺に壁を下ろす(壁の色は `style.fill` を暗くしたもの) |
|
|
76
|
+
| `float` | 面をそのまま `height` だけ持ち上げる。下に影 |
|
|
77
|
+
|
|
78
|
+
- 種別ごとに使える mode と既定・自前の 3D 表現(`render3d`)は、その種別の `ShapeDefinition.view3d`(ホストの `ctx.shapes.configureView3d` で上書き)から読む。宣言の無い種別は `stand` / `float` だけ
|
|
79
|
+
- 3D の見た目を持たない Shape も、起伏のある地形の上では平らなままその高さに乗せる(`groundFlat`、既定オン)
|
|
80
|
+
- 画面上で小さすぎるもの(既定 8px 未満)・描かれている地面の外・全体 LOD 中は立てない。数は手前から最大 200 個
|
|
81
|
+
- 描いている Shape は shared の `shapeClaims(services)` で宣言し、DOM レンダラーはそれを描かない
|
|
82
|
+
- プラグインは `css3dShapeSourceService` で種別の表(`types()`)と上限(`limits()`: `minPx` / `maxCount` / `groundFlat`)を渡せる(shape-3d プラグインが HUD の設定を渡すのに使う)
|
|
83
|
+
- 立ち上がる見た目の HUD とキャラクターとの当たり判定は、shape-3d プラグインとコア(`ctx.height`)が受け持つ
|
|
84
|
+
|
|
85
|
+
## 公開 API
|
|
86
|
+
|
|
87
|
+
### `createCss3dRendererPlugin(options?)`
|
|
88
|
+
|
|
89
|
+
レンダラーのプラグイン。すでにボードにレンダラーがあれば何もしない。
|
|
90
|
+
|
|
91
|
+
| option | 内容 |
|
|
92
|
+
|------|------|
|
|
93
|
+
| `tiltLayerIds` | 宣言の代わりに傾ける層 |
|
|
94
|
+
| `depthLayerIds` | 宣言の代わりに奥行きを持たせる層 |
|
|
95
|
+
| `view3d` | 3D 表示の状態の置き場所。既定はボードのストア(`BoardStore.getView3d`)。古いストアのホストは自前のセルを渡す |
|
|
96
|
+
| `shapes` | 3D の Shape を描くか。既定 `true` |
|
|
97
|
+
| `depthStage` | 奥行きステージをオンで始める。既定 `false` |
|
|
98
|
+
| `hud` | 設定(地形の陰・奥行きステージ)を HUD に出す。既定 `true` |
|
|
99
|
+
| `occlusion` | 地形の陰に入ったもの: `"fade"`(既定)/ `"hide"` / `"none"` |
|
|
100
|
+
|
|
101
|
+
### `css3dRendererService`
|
|
102
|
+
|
|
103
|
+
`ctx.services` に置かれる `Css3dRendererApi`。
|
|
104
|
+
|
|
105
|
+
| メソッド | 内容 |
|
|
106
|
+
|------|------|
|
|
107
|
+
| `isDrawing()` | いま 3D で描いているか(切り替えの進み具合が 0 より大きい) |
|
|
108
|
+
| `setTiltLayers(ids \| null)` | 傾ける層を決める |
|
|
109
|
+
| `setDepthLayers(ids \| null)` | 奥行きを持たせる層を決める |
|
|
110
|
+
| `getTiltLayers()` / `getDepthLayers()` | いまの一覧 |
|
|
111
|
+
| `setDepthStage(on)` / `isDepthStage()` | 奥行きステージ(実験)の切り替え |
|
|
112
|
+
| `setOcclusion(mode)` / `getOcclusion()` | 地形の陰に入ったものの見せ方 |
|
|
113
|
+
|
|
114
|
+
### `setupCss3dRenderer(ctx, options?)`
|
|
115
|
+
|
|
116
|
+
プラグインを使わずに組み込むとき用。`{ api, dispose }` を返す(ボードの 3D 表示の状態が無いときは `null`)。
|
|
117
|
+
|
|
118
|
+
### 純関数
|
|
119
|
+
|
|
120
|
+
- `layerTransform(state)`: 傾けた層の `transform` / `transform-origin`
|
|
121
|
+
- `cameraHeightPx(state, zoom)`: 画面上のカメラの高さ(px)
|
|
122
|
+
- `drawDistanceClip(...)` / `drawDistanceOverscanPx(...)`: 描画距離の切り取りと、背景を奥まで敷く幅
|
|
123
|
+
- `tiltLayerRules(ids, options)`: 層を傾ける CSS
|
|
124
|
+
- `depthStageRules(options)`: 奥行きステージの CSS
|
|
125
|
+
- `projectionCamera(state, zoom)`: 描いているカメラを shared の射影関数の形で
|
|
126
|
+
- 3D の Shape の配置: `selectShapes3d` / `shapePose` / `poseBox` / `poseTransform` / `render3dFrame` / `boxWalls` / `shadowStyle` など
|
|
127
|
+
|
|
128
|
+
## 描画の仕組み
|
|
129
|
+
|
|
130
|
+
- 1 枚の `<style data-css3d-renderer>` に `!important` の規則を書き、メインのキャンバスに付けた `data-view3d-stage` 属性で範囲を絞る。React の再描画を越えて残り、後から追加された層にも効く
|
|
131
|
+
- カメラの高さは CSS 変数 `--usketch-mode7-camera-height` 1 つで全層を下げるので、毎フレーム変わってもシートは書き換えない
|
|
132
|
+
- 旧属性 `data-mode7-stage` と旧イベント `bg-grid:set-overscan` も次のメジャーまで出す
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `clip-path` for the tilted layer wrappers. The tilt uses `overflow:visible` to
|
|
3
|
+
* keep the 3D intact, which would otherwise let content float PAST the grid; the clip
|
|
4
|
+
* bounds the tilted content instead.
|
|
5
|
+
*
|
|
6
|
+
* `distance` is the draw distance in **canvas/world units** measured forward from the
|
|
7
|
+
* near edge (bottom of the viewport). `distance <= 0` means "auto": clip exactly to the
|
|
8
|
+
* box (`inset(0)` — nothing floats past the grid, no overscan). A positive `distance`
|
|
9
|
+
* maps to `distance * zoom` screen px at the bottom of the wrapper box:
|
|
10
|
+
* - within the box (`distance*zoom < height`) → positive inset (a closer cutoff);
|
|
11
|
+
* - beyond the box (`distance*zoom > height`) → NEGATIVE inset, i.e. the clip extends
|
|
12
|
+
* above the box so content farther than the viewport is drawn. The background grid
|
|
13
|
+
* must be extended to match (see {@link drawDistanceOverscanPx}) or that far content
|
|
14
|
+
* would float; `clip-path` keeps the 3D tilt intact (unlike `overflow`, flattening).
|
|
15
|
+
*/
|
|
16
|
+
export declare function drawDistanceClip(distance: number, zoom: number, viewportHeightPx: number,
|
|
17
|
+
/** Transition amount 0…1: a near-band clip fades in with the tilt, so the still-flat
|
|
18
|
+
* board isn't cut off at the top while the ground rises. */
|
|
19
|
+
strength?: number): string;
|
|
20
|
+
/**
|
|
21
|
+
* The px the background grid must extend ABOVE/BEYOND the viewport box to stay under the
|
|
22
|
+
* content that {@link drawDistanceClip} reveals for a draw `distance` larger than the
|
|
23
|
+
* viewport. `0` when the distance is auto/within the box (no extension needed). This is
|
|
24
|
+
* what the canvas hands backgrounds as `LayerRenderContext.view3dOverscan` (see
|
|
25
|
+
* `view3dOverscanPx`), so the grid and the shapes end together.
|
|
26
|
+
*/
|
|
27
|
+
export declare function drawDistanceOverscanPx(distance: number, zoom: number, viewportHeightPx: number): number;
|
|
28
|
+
export interface TiltRuleOptions {
|
|
29
|
+
/** Attribute marking the main canvas container (rules are scoped to it). */
|
|
30
|
+
stageAttr: string;
|
|
31
|
+
transform: string;
|
|
32
|
+
transformOrigin: string;
|
|
33
|
+
/** The draw-distance `clip-path` (see {@link drawDistanceClip}). */
|
|
34
|
+
clip: string;
|
|
35
|
+
/** Layers rendered with real depth (`Layer.view3d` `depth`). */
|
|
36
|
+
depthLayerIds: ReadonlySet<string>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The injected stylesheet that tilts each selected layer wrapper.
|
|
40
|
+
*
|
|
41
|
+
* `overflow:visible` + `transform-style:preserve-3d` are essential for layers like
|
|
42
|
+
* `dom-shapes`: their wrapper has `overflow:hidden` (which the CSS spec forces
|
|
43
|
+
* `transform-style` to `flat`) and an inner viewport-transform div that Chrome
|
|
44
|
+
* composites separately — so without these the SHAPES render flat in screen space
|
|
45
|
+
* while only the wrapper tilts. A DESCENDANT selector (space, not `>`) matches the
|
|
46
|
+
* wrapper regardless of nesting.
|
|
47
|
+
*
|
|
48
|
+
* Plain layers get the draw-distance clip. A `clip-path` is a grouping property that
|
|
49
|
+
* FLATTENS its subtree onto the plane, so DEPTH layers skip it and instead keep the
|
|
50
|
+
* 3D context through the engine's inner wrappers (viewport-transform / pointer divs):
|
|
51
|
+
* content that sets its own depth (raised map terrain, a character standing on it) then
|
|
52
|
+
* rises out of the tilted ground instead of being painted onto it.
|
|
53
|
+
*/
|
|
54
|
+
export declare function tiltLayerRules(layerIds: readonly string[], o: TiltRuleOptions): string;
|
|
55
|
+
/** How far (px) the depth stage pushes the layers that aren't tilted out of the ground. */
|
|
56
|
+
export declare const DEPTH_STAGE_FAR_PX = 100000;
|
|
57
|
+
/** A layer as the depth stage sees it, in drawing order. */
|
|
58
|
+
export interface DepthStageLayer {
|
|
59
|
+
id: string;
|
|
60
|
+
/** Tilted into the ground (a `tilt` or `depth` layer). */
|
|
61
|
+
tilted: boolean;
|
|
62
|
+
/** Draws the ground itself without being tilted (`Layer.view3d` `ground`). */
|
|
63
|
+
ground?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export interface DepthStageOptions {
|
|
66
|
+
stageAttr: string;
|
|
67
|
+
layers: readonly DepthStageLayer[];
|
|
68
|
+
/** The stage's own background (drawn behind everything once the stage is transparent). */
|
|
69
|
+
background: string;
|
|
70
|
+
/** The tilted layers' `transform` (as in {@link TiltRuleOptions.transform}). */
|
|
71
|
+
tiltTransform: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The depth stage: the main canvas container becomes ONE 3D space (`preserve-3d`), so the
|
|
75
|
+
* tilted layers' contents sort by their real depth across layers (a character behind a
|
|
76
|
+
* standing sign is hidden by it, a cliff hides what is behind it) instead of each layer
|
|
77
|
+
* painting over the ones before it.
|
|
78
|
+
*
|
|
79
|
+
* Everything in that space is sorted by depth, so the stage moves what isn't part of the
|
|
80
|
+
* tilted ground out of the way, keeping the drawing order inside each band (from the back):
|
|
81
|
+
*
|
|
82
|
+
* 1. the stage's own background (a `::before`);
|
|
83
|
+
* 2. every layer stacked under a layer that draws the ground itself (a terrain mesh): it
|
|
84
|
+
* covers them on the flat board too. A tilted one is moved back along the view
|
|
85
|
+
* (a `translateZ` before its tilt), so it still lands on the same pixels;
|
|
86
|
+
* 3. the layers drawing the ground, and the untilted ones before the first tilted (a sky);
|
|
87
|
+
* 4. the tilted layers, where they are;
|
|
88
|
+
* 5. the other untilted layers (overlays, HUD), in front.
|
|
89
|
+
*
|
|
90
|
+
* The stage can't clip without flattening the space (`overflow: clip` flattens in
|
|
91
|
+
* Chrome), so it is left unclipped: its parent clips instead. Pure.
|
|
92
|
+
*/
|
|
93
|
+
export declare function depthStageRules(o: DepthStageOptions): string;
|
|
94
|
+
//# sourceMappingURL=css3d-css.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css3d-css.d.ts","sourceRoot":"","sources":["../src/css3d-css.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAC/B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,MAAM;AACxB;6DAC6D;AAC7D,QAAQ,SAAI,GACV,MAAM,CAeR;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACrC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,MAAM,GACtB,MAAM,CAIR;AAED,MAAM,WAAW,eAAe;IAC/B,4EAA4E;IAC5E,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACnC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,CAAC,EAAE,eAAe,GAAG,MAAM,CAStF;AAWD,2FAA2F;AAC3F,eAAO,MAAM,kBAAkB,SAAU,CAAC;AAE1C,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,0DAA0D;IAC1D,MAAM,EAAE,OAAO,CAAC;IAChB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;IACnC,0FAA0F;IAC1F,UAAU,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,aAAa,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,iBAAiB,GAAG,MAAM,CA2B5D"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// The CSS the renderer injects: the tilt of each layer wrapper, the draw-distance clip
|
|
2
|
+
// and the depth context. Pure string builders (moved from the Mode 7 plugin).
|
|
3
|
+
/**
|
|
4
|
+
* The `clip-path` for the tilted layer wrappers. The tilt uses `overflow:visible` to
|
|
5
|
+
* keep the 3D intact, which would otherwise let content float PAST the grid; the clip
|
|
6
|
+
* bounds the tilted content instead.
|
|
7
|
+
*
|
|
8
|
+
* `distance` is the draw distance in **canvas/world units** measured forward from the
|
|
9
|
+
* near edge (bottom of the viewport). `distance <= 0` means "auto": clip exactly to the
|
|
10
|
+
* box (`inset(0)` — nothing floats past the grid, no overscan). A positive `distance`
|
|
11
|
+
* maps to `distance * zoom` screen px at the bottom of the wrapper box:
|
|
12
|
+
* - within the box (`distance*zoom < height`) → positive inset (a closer cutoff);
|
|
13
|
+
* - beyond the box (`distance*zoom > height`) → NEGATIVE inset, i.e. the clip extends
|
|
14
|
+
* above the box so content farther than the viewport is drawn. The background grid
|
|
15
|
+
* must be extended to match (see {@link drawDistanceOverscanPx}) or that far content
|
|
16
|
+
* would float; `clip-path` keeps the 3D tilt intact (unlike `overflow`, flattening).
|
|
17
|
+
*/
|
|
18
|
+
export function drawDistanceClip(distance, zoom, viewportHeightPx,
|
|
19
|
+
/** Transition amount 0…1: a near-band clip fades in with the tilt, so the still-flat
|
|
20
|
+
* board isn't cut off at the top while the ground rises. */
|
|
21
|
+
strength = 1) {
|
|
22
|
+
if (!(distance > 0) || !(zoom > 0) || !(viewportHeightPx > 0)) {
|
|
23
|
+
return "inset(0% 0% 0% 0%)"; // auto → clip to the box
|
|
24
|
+
}
|
|
25
|
+
const bandPx = distance * zoom;
|
|
26
|
+
if (bandPx <= viewportHeightPx) {
|
|
27
|
+
// Within the viewport: keep only the near band; sides stay at the box.
|
|
28
|
+
const s = Math.min(1, Math.max(0, strength));
|
|
29
|
+
return `inset(${round((1 - bandPx / viewportHeightPx) * 100 * s)}% 0% 0% 0%)`;
|
|
30
|
+
}
|
|
31
|
+
// Beyond the viewport: extend equally on ALL sides so the far ground fans out
|
|
32
|
+
// (not just a box-wide strip). The grid overscans to match; the canvas container
|
|
33
|
+
// clips whatever runs off-screen. Negative inset grows the clip region past the box.
|
|
34
|
+
const over = round(bandPx - viewportHeightPx);
|
|
35
|
+
return `inset(${-over}px ${-over}px ${-over}px ${-over}px)`;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The px the background grid must extend ABOVE/BEYOND the viewport box to stay under the
|
|
39
|
+
* content that {@link drawDistanceClip} reveals for a draw `distance` larger than the
|
|
40
|
+
* viewport. `0` when the distance is auto/within the box (no extension needed). This is
|
|
41
|
+
* what the canvas hands backgrounds as `LayerRenderContext.view3dOverscan` (see
|
|
42
|
+
* `view3dOverscanPx`), so the grid and the shapes end together.
|
|
43
|
+
*/
|
|
44
|
+
export function drawDistanceOverscanPx(distance, zoom, viewportHeightPx) {
|
|
45
|
+
if (!(distance > 0) || !(zoom > 0) || !(viewportHeightPx > 0))
|
|
46
|
+
return 0;
|
|
47
|
+
const bandPx = distance * zoom;
|
|
48
|
+
return bandPx > viewportHeightPx ? Math.ceil(bandPx - viewportHeightPx) : 0;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The injected stylesheet that tilts each selected layer wrapper.
|
|
52
|
+
*
|
|
53
|
+
* `overflow:visible` + `transform-style:preserve-3d` are essential for layers like
|
|
54
|
+
* `dom-shapes`: their wrapper has `overflow:hidden` (which the CSS spec forces
|
|
55
|
+
* `transform-style` to `flat`) and an inner viewport-transform div that Chrome
|
|
56
|
+
* composites separately — so without these the SHAPES render flat in screen space
|
|
57
|
+
* while only the wrapper tilts. A DESCENDANT selector (space, not `>`) matches the
|
|
58
|
+
* wrapper regardless of nesting.
|
|
59
|
+
*
|
|
60
|
+
* Plain layers get the draw-distance clip. A `clip-path` is a grouping property that
|
|
61
|
+
* FLATTENS its subtree onto the plane, so DEPTH layers skip it and instead keep the
|
|
62
|
+
* 3D context through the engine's inner wrappers (viewport-transform / pointer divs):
|
|
63
|
+
* content that sets its own depth (raised map terrain, a character standing on it) then
|
|
64
|
+
* rises out of the tilted ground instead of being painted onto it.
|
|
65
|
+
*/
|
|
66
|
+
export function tiltLayerRules(layerIds, o) {
|
|
67
|
+
return layerIds
|
|
68
|
+
.map((id) => {
|
|
69
|
+
const layer = `[${o.stageAttr}="on"] [data-layer-id="${attrValue(id)}"]`;
|
|
70
|
+
const base = `transform:${o.transform} !important;transform-origin:${o.transformOrigin} !important;overflow:visible !important;transform-style:preserve-3d !important;`;
|
|
71
|
+
if (!o.depthLayerIds.has(id))
|
|
72
|
+
return `${layer}{${base}clip-path:${o.clip} !important;}`;
|
|
73
|
+
return `${layer}{${base}}${layer}>div,${layer}>div>div{transform-style:preserve-3d}`;
|
|
74
|
+
})
|
|
75
|
+
.join("");
|
|
76
|
+
}
|
|
77
|
+
/** Keep an attribute-selector value valid (layer ids are simple, but be safe). */
|
|
78
|
+
function attrValue(id) {
|
|
79
|
+
return id.replace(/["\\]/g, "");
|
|
80
|
+
}
|
|
81
|
+
function round(n) {
|
|
82
|
+
return Math.round(n * 1000) / 1000;
|
|
83
|
+
}
|
|
84
|
+
/** How far (px) the depth stage pushes the layers that aren't tilted out of the ground. */
|
|
85
|
+
export const DEPTH_STAGE_FAR_PX = 100_000;
|
|
86
|
+
/**
|
|
87
|
+
* The depth stage: the main canvas container becomes ONE 3D space (`preserve-3d`), so the
|
|
88
|
+
* tilted layers' contents sort by their real depth across layers (a character behind a
|
|
89
|
+
* standing sign is hidden by it, a cliff hides what is behind it) instead of each layer
|
|
90
|
+
* painting over the ones before it.
|
|
91
|
+
*
|
|
92
|
+
* Everything in that space is sorted by depth, so the stage moves what isn't part of the
|
|
93
|
+
* tilted ground out of the way, keeping the drawing order inside each band (from the back):
|
|
94
|
+
*
|
|
95
|
+
* 1. the stage's own background (a `::before`);
|
|
96
|
+
* 2. every layer stacked under a layer that draws the ground itself (a terrain mesh): it
|
|
97
|
+
* covers them on the flat board too. A tilted one is moved back along the view
|
|
98
|
+
* (a `translateZ` before its tilt), so it still lands on the same pixels;
|
|
99
|
+
* 3. the layers drawing the ground, and the untilted ones before the first tilted (a sky);
|
|
100
|
+
* 4. the tilted layers, where they are;
|
|
101
|
+
* 5. the other untilted layers (overlays, HUD), in front.
|
|
102
|
+
*
|
|
103
|
+
* The stage can't clip without flattening the space (`overflow: clip` flattens in
|
|
104
|
+
* Chrome), so it is left unclipped: its parent clips instead. Pure.
|
|
105
|
+
*/
|
|
106
|
+
export function depthStageRules(o) {
|
|
107
|
+
const stage = `[${o.stageAttr}="on"]`;
|
|
108
|
+
const far = DEPTH_STAGE_FAR_PX;
|
|
109
|
+
const firstTilted = o.layers.findIndex((l) => l.tilted);
|
|
110
|
+
let lastGround = -1;
|
|
111
|
+
o.layers.forEach((l, i) => {
|
|
112
|
+
if (l.ground && !l.tilted)
|
|
113
|
+
lastGround = i;
|
|
114
|
+
});
|
|
115
|
+
const parts = [
|
|
116
|
+
`${stage}{transform-style:preserve-3d !important;overflow:visible !important;background:transparent !important;}`,
|
|
117
|
+
`${stage}::before{content:"";position:absolute;inset:0;pointer-events:none;background:${o.background};transform:translateZ(-${far * 3}px);}`,
|
|
118
|
+
];
|
|
119
|
+
o.layers.forEach((l, i) => {
|
|
120
|
+
const ground = l.ground === true && !l.tilted;
|
|
121
|
+
const layer = `${stage}>[data-layer-id="${attrValue(l.id)}"]`;
|
|
122
|
+
if (!ground && i < lastGround) {
|
|
123
|
+
// Under the ground. Later ones a little nearer, as everywhere below.
|
|
124
|
+
const z = -far * 2 + i;
|
|
125
|
+
const transform = l.tilted ? `translateZ(${z}px) ${o.tiltTransform}` : `translateZ(${z}px)`;
|
|
126
|
+
parts.push(`${layer}{transform:${transform} !important;}`);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (l.tilted)
|
|
130
|
+
return;
|
|
131
|
+
const behind = ground || firstTilted < 0 || i < firstTilted;
|
|
132
|
+
parts.push(`${layer}{transform:translateZ(${(behind ? -far : far) + i}px) !important;}`);
|
|
133
|
+
});
|
|
134
|
+
return parts.join("");
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=css3d-css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css3d-css.js","sourceRoot":"","sources":["../src/css3d-css.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,8EAA8E;AAC9E;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAC/B,QAAgB,EAChB,IAAY,EACZ,gBAAwB;AACxB;6DAC6D;AAC7D,QAAQ,GAAG,CAAC;IAEZ,IAAI,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,gBAAgB,GAAG,CAAC,CAAC,EAAE,CAAC;QAC/D,OAAO,oBAAoB,CAAC,CAAC,yBAAyB;IACvD,CAAC;IACD,MAAM,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;IAC/B,IAAI,MAAM,IAAI,gBAAgB,EAAE,CAAC;QAChC,uEAAuE;QACvE,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC7C,OAAO,SAAS,KAAK,CAAC,CAAC,CAAC,GAAG,M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,CAAC,MAAM,CAAC;QAC9C,MAAM,KAAK,GAAG,GAAG,KAAK,oBAAoB,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC;QAC9D,IAAI,CAAC,MAAM,IAAI,CAAC,GAAG,UAAU,EAAE,CAAC;YAC/B,qEAAqE;YACrE,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;YACvB,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC;YAC5F,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,cAAc,SAAS,eAAe,CAAC,CAAC;YAC3D,OAAO;QACR,CAAC;QACD,IAAI,CAAC,CAAC,MAAM;YAAE,OAAO;QACrB,MAAM,MAAM,GAAG,MAAM,IAAI,WAAW,GAAG,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC;QAC5D,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAC1F,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { type PluginContext, type ProjectionCamera, type UsketchPlugin, type View3dCell, type View3dRendererApi, type View3dState } from "@edv4h/usketch-shared";
|
|
2
|
+
/** Attribute the renderer puts on the main canvas container while drawing in 3D. */
|
|
3
|
+
export declare const STAGE_ATTR = "data-view3d-stage";
|
|
4
|
+
/** The attribute Mode 7 used to set; still set (some plugins look for it) until the next major. */
|
|
5
|
+
export declare const LEGACY_STAGE_ATTR = "data-mode7-stage";
|
|
6
|
+
/** CSS variable on the stage holding the camera height (px); the tilt lowers every layer by it. */
|
|
7
|
+
export declare const CAMERA_HEIGHT_VAR = "--usketch-mode7-camera-height";
|
|
8
|
+
export interface Css3dRendererApi extends View3dRendererApi {
|
|
9
|
+
/** Whether the board is being drawn in 3D now (the view's amount is above 0). */
|
|
10
|
+
isDrawing(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Tilt exactly these layers, or `null` (default) for the layers that declare
|
|
13
|
+
* `view3d: "tilt" | "depth"`. A 3D view with its own layer picker (Mode 7) sets it.
|
|
14
|
+
*/
|
|
15
|
+
setTiltLayers(ids: readonly string[] | null): void;
|
|
16
|
+
/** Give exactly these tilted layers depth, or `null` (default) for those declaring `depth`. */
|
|
17
|
+
setDepthLayers(ids: readonly string[] | null): void;
|
|
18
|
+
/** The layers tilted now (as resolved from the declarations or the set lists). */
|
|
19
|
+
getTiltLayers(): readonly string[];
|
|
20
|
+
/** The tilted layers drawn with depth. */
|
|
21
|
+
getDepthLayers(): readonly string[];
|
|
22
|
+
/**
|
|
23
|
+
* Sort the layers' 3D contents by their real depth in one 3D space (experimental, off
|
|
24
|
+
* by default): see `depthStageRules`.
|
|
25
|
+
*/
|
|
26
|
+
setDepthStage(on: boolean): void;
|
|
27
|
+
isDepthStage(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* How standing things (3D shapes, characters) behind the ground (a hill, a cliff) are
|
|
30
|
+
* drawn: faded (default), not drawn, or as if nothing hid them (`none`).
|
|
31
|
+
*/
|
|
32
|
+
setOcclusion(mode: Css3dOcclusionMode): void;
|
|
33
|
+
getOcclusion(): Css3dOcclusionMode;
|
|
34
|
+
}
|
|
35
|
+
/** See {@link Css3dRendererApi.setOcclusion}. */
|
|
36
|
+
export type Css3dOcclusionMode = "fade" | "hide" | "none";
|
|
37
|
+
/** The renderer on `ctx.services` (one per board). */
|
|
38
|
+
export declare const css3dRendererService: import("@edv4h/usketch-shared").ServiceHandle<Css3dRendererApi>;
|
|
39
|
+
export interface Css3dRendererOptions {
|
|
40
|
+
/** Layers to tilt instead of the declared ones (see {@link Css3dRendererApi.setTiltLayers}). */
|
|
41
|
+
tiltLayerIds?: readonly string[];
|
|
42
|
+
/** Layers to give depth instead of the declared ones. */
|
|
43
|
+
depthLayerIds?: readonly string[];
|
|
44
|
+
/**
|
|
45
|
+
* Where the 3D view state lives. Default: the board store's (`BoardStore.getView3d`);
|
|
46
|
+
* a host on an older store passes a cell of its own.
|
|
47
|
+
*/
|
|
48
|
+
view3d?: View3dCell;
|
|
49
|
+
/** Draw the shapes that have a 3D look (see css3d-shapes). Default `true`. */
|
|
50
|
+
shapes?: boolean;
|
|
51
|
+
/** Start with the depth stage on (see {@link Css3dRendererApi.setDepthStage}). Default `false`. */
|
|
52
|
+
depthStage?: boolean;
|
|
53
|
+
/** Offer the renderer's settings on the HUD. Default `true`. */
|
|
54
|
+
hud?: boolean;
|
|
55
|
+
/** How things behind the ground are drawn (see {@link Css3dRendererApi.setOcclusion}). Default `"fade"`. */
|
|
56
|
+
occlusion?: Css3dOcclusionMode;
|
|
57
|
+
}
|
|
58
|
+
/** The camera a tilted layer is drawn with, as the projection functions take it. Pure. */
|
|
59
|
+
export declare function projectionCamera(state: View3dState, zoom: number): ProjectionCamera;
|
|
60
|
+
/** The camera height in screen px as drawn: height × zoom, faded with the amount. */
|
|
61
|
+
export declare function cameraHeightPx(state: View3dState, zoom: number): number;
|
|
62
|
+
/** The transform of a tilted layer: the camera's tilt, lowered by the camera height. */
|
|
63
|
+
export declare function layerTransform(state: View3dState): {
|
|
64
|
+
transform: string;
|
|
65
|
+
transformOrigin: string;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Set up the renderer on `ctx`: draws whenever the 3D view's amount is above 0. Returns
|
|
69
|
+
* its API and a teardown that clears every injected rule.
|
|
70
|
+
*/
|
|
71
|
+
export declare function setupCss3dRenderer(ctx: PluginContext, options?: Css3dRendererOptions): {
|
|
72
|
+
api: Css3dRendererApi;
|
|
73
|
+
dispose: () => void;
|
|
74
|
+
} | null;
|
|
75
|
+
/** HUD field name of the depth stage toggle. */
|
|
76
|
+
export declare const DEPTH_STAGE_FIELD = "depthStage";
|
|
77
|
+
/** HUD field name of the occlusion choice. */
|
|
78
|
+
export declare const OCCLUSION_FIELD = "occlusion";
|
|
79
|
+
/**
|
|
80
|
+
* The CSS 3D renderer plugin. Add it next to the DOM renderer; a 3D view (Mode 7) then
|
|
81
|
+
* only changes the core's 3D view state. If a renderer is already on the board (Mode 7
|
|
82
|
+
* adds one when the host didn't), this one does nothing.
|
|
83
|
+
*/
|
|
84
|
+
export declare function createCss3dRendererPlugin(options?: Css3dRendererOptions): UsketchPlugin;
|
|
85
|
+
//# sourceMappingURL=css3d-renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css3d-renderer.d.ts","sourceRoot":"","sources":["../src/css3d-renderer.ts"],"names":[],"mappings":"AAgBA,OAAO,EAKN,KAAK,aAAa,EAClB,KAAK,gBAAgB,EAGrB,KAAK,aAAa,EAClB,KAAK,UAAU,EAGf,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAIhB,MAAM,uBAAuB,CAAC;AAS/B,oFAAoF;AACpF,eAAO,MAAM,UAAU,sBAAsB,CAAC;AAC9C,mGAAmG;AACnG,eAAO,MAAM,iBAAiB,qBAAqB,CAAC;AACpD,mGAAmG;AACnG,eAAO,MAAM,iBAAiB,kCAAkC,CAAC;AAIjE,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IAC1D,iFAAiF;IACjF,SAAS,IAAI,OAAO,CAAC;IACrB;;;OAGG;IACH,aAAa,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;IACnD,+FAA+F;IAC/F,cAAc,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;IACpD,kFAAkF;IAClF,aAAa,IAAI,SAAS,MAAM,EAAE,CAAC;IACnC,0CAA0C;IAC1C,cAAc,IAAI,SAAS,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