@tileflow/dev 0.1.0-alpha.33 → 0.1.0-alpha.35

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/server.d.ts CHANGED
@@ -5,7 +5,7 @@ import '@tileflow/core';
5
5
  import '@tileflow/core/build';
6
6
  import '@tileflow/core/manifest';
7
7
  import '@tileflow/core/native-profile';
8
- import './icons-BdOehQmB.js';
8
+ import './icons-BIHpw5Zy.js';
9
9
  import './config.js';
10
10
 
11
11
  declare const tileflowComparisonSchemaVersion: 1;
package/dist/server.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  parseTileflowLineBackgroundGlyphPath,
6
6
  tileflowArtifactSessionSchemaVersion,
7
7
  tileflowLineBackgroundGlyphRoute
8
- } from "./chunk-WJOF6USY.js";
8
+ } from "./chunk-2F7LOYQI.js";
9
9
  import {
10
10
  getTileflowAssetBasePath,
11
11
  getTileflowAssetFileName,
@@ -13,7 +13,7 @@ import {
13
13
  normalizeTileflowBasePath,
14
14
  resolveTileflowArtifactPublicUrls
15
15
  } from "./chunk-UTRO4IBQ.js";
16
- import "./chunk-QYU4OW5A.js";
16
+ import "./chunk-5RT4CHSK.js";
17
17
  import "./chunk-7C4F6GAX.js";
18
18
  import {
19
19
  TileflowStyleValidationError
@@ -3271,7 +3271,7 @@ function createTileflowDevRequestHandler(options = {}) {
3271
3271
  return options.session ? eventStreamResponse(options.session) : jsonResponse2({ error: "Live events require a development session." }, 404);
3272
3272
  }
3273
3273
  if (path.startsWith("/__runtime/")) {
3274
- const runtimeResponse = (await import("./preview-assets-KGUICQHG.js")).getTileflowPreviewRuntimeResponse(path);
3274
+ const runtimeResponse = (await import("./preview-assets-MT3RXZMN.js")).getTileflowPreviewRuntimeResponse(path);
3275
3275
  if (runtimeResponse) return runtimeResponse;
3276
3276
  }
3277
3277
  const session = options.session ?? await loadOwnedSession(url.origin);
@@ -45,7 +45,7 @@ Baedeker, Cívica, 1777, Siegfried, Soundings, and Blueprint declare only
45
45
  `[soundingsIcons]`, and `[blueprintIcons]`, respectively. No official root composes another map's assets even though all
46
46
  use the semantic compiler ABI. Baedeker's directory contains eight original travel-atlas patterns;
47
47
  its browser-derived Mapterhorn contours use runtime terrain tiles and are not part of the icon
48
- package. Soundings owns ten original nautical symbols and
48
+ package. Soundings owns eleven original nautical symbols and
49
49
  patterns. Blueprint owns four technical blueprint patterns and one schematic POI node; its
50
50
  unbundled Mapterhorn contours remain runtime terrain, and its text uses the canonical Noto Sans
51
51
  glyph provider. An application map may inherit a root's exact array, replace it, clear it with `[]`,
@@ -0,0 +1,179 @@
1
+ # Prepare recolorable building models
2
+
3
+ Custom buildings and landmarks use the same preparation path. Export uncompressed glTF 2.0
4
+ binaries in metres, Y up, with the origin on the ground. The default scene's triangles and node
5
+ transforms are read. Building preparation retains physical materials and embedded PNG/JPEG
6
+ textures. Animations, skins and morph targets are not evaluated; export their static geometry.
7
+
8
+ ## Separate colour from architectural role
9
+
10
+ Material names select a palette slot: `surface`, `secondary`, `glass`, `accent` or `roof`.
11
+ The optional `material.extras.tileflow.lightingRole` selects lighting independently:
12
+
13
+ ```json
14
+ {
15
+ "name": "accent",
16
+ "extras": {
17
+ "tileflow": {
18
+ "lightingRole": "door"
19
+ }
20
+ },
21
+ "pbrMetallicRoughness": {
22
+ "baseColorFactor": [0.8, 0.8, 0.8, 1]
23
+ }
24
+ }
25
+ ```
26
+
27
+ This door can take the map's `accent` colour while receiving its `door` lighting profile. Accepted
28
+ roles are `unclassified`, `wall`, `door`, `roof`, `window`, `lamp` and `logo`. A role describes
29
+ geometry; it does not turn on light by itself. The map supplies emission through
30
+ `buildings.threeDimensional.modelLighting`.
31
+
32
+ Legacy models without an explicit role use these defaults:
33
+
34
+ | Palette slot | Lighting role |
35
+ | -------------------------------- | ------------- |
36
+ | `surface`, `secondary`, `accent` | `wall` |
37
+ | `glass` | `window` |
38
+ | `roof` | `roof` |
39
+
40
+ Doors, lamps and logos require an explicit role. Use `unclassified` for a part that must not inherit
41
+ a role. Invalid role names fail preparation. An exporter's numeric material suffix, such as
42
+ `surface.001`, is ignored.
43
+
44
+ Keep a stone relief in a wall role when it should receive the wall's lighting. A separate colour
45
+ slot can distinguish its stone without creating a separate light source. Mark roof geometry as
46
+ roof even when it shares a colour with a facade.
47
+
48
+ ## Physical materials
49
+
50
+ The importer retains these glTF 2.0 channels independently of palette and role:
51
+
52
+ | Channel | Inputs |
53
+ | ------------------ | --------------------------------------------------------------------------------- |
54
+ | Base colour | Linear `baseColorFactor`, linear `COLOR_0` RGB/RGBA, sRGB base-colour texture |
55
+ | Reflection | `metallicFactor`, `roughnessFactor`, texture blue/green channels |
56
+ | Surface normal | Tangent-space normal texture and `scale`; tangent basis from geometry and UVs |
57
+ | Ambient visibility | Occlusion texture red channel and `strength`, multiplied by geometric visibility |
58
+ | Emission | Linear `emissiveFactor`, sRGB emissive texture, `KHR_materials_emissive_strength` |
59
+ | Coverage | `OPAQUE`, `MASK` with `alphaCutoff`, or `BLEND`; `doubleSided` |
60
+ | Unlit | `KHR_materials_unlit` |
61
+
62
+ `TEXCOORD_0`, `TEXCOORD_1`, glTF sampler wrapping/filtering and `KHR_texture_transform` are retained.
63
+ Every referenced channel must have its declared UV set. UV and colour seams survive welding.
64
+ Colour textures and lit output use the scene's gamma-2.2 transfer approximation.
65
+ Role emission mixes the complete material radiance toward its target, including authored emission.
66
+ Images must be embedded in buffer views or PNG/JPEG data URIs; preparation never fetches external
67
+ images. Other image formats and physical-material extensions are not supported.
68
+
69
+ Each level accepts at most 256 distinct materials, 32 textures, 4096 pixels per image dimension
70
+ and 16,777,216 decoded image pixels in total. The complete prepared file remains limited to 16 MiB.
71
+ Invalid references, missing UVs and image headers that disagree with their dimensions fail preparation.
72
+
73
+ Without overrides, a physical model retains its authored material. `modelLighting` can tint and
74
+ override roughness/metallicity by role. Explicit `modelColors` take precedence over role tints;
75
+ textures and vertex colours still modulate the chosen colour. Keep vertex colours neutral when
76
+ they should not affect recolouring.
77
+
78
+ Colour and normal textures, metallic reflection and alpha coverage use the browser's physical
79
+ model path. Ambient visibility never attenuates solar light or emission. Masked pixels also leave
80
+ holes in dynamic solar shadows; blended surfaces cast an alpha-tested shadow at 0.5. Transparent
81
+ material ranges draw back to front after opaque surfaces; intersecting transparent triangles are
82
+ not sorted individually.
83
+
84
+ ## Explicit area emitters
85
+
86
+ A `door` role lights the surface. To project its spill, declare a rectangle in
87
+ `node.extras.tileflow.emitters`. This glTF fragment uses node-local metres and Y up:
88
+
89
+ ```json
90
+ {
91
+ "extras": {
92
+ "tileflow": {
93
+ "emitters": [
94
+ {
95
+ "start": [-1, 0, 0],
96
+ "end": [1, 0, 0],
97
+ "height": 3,
98
+ "depth": 0.2,
99
+ "role": "door",
100
+ "part": "accent"
101
+ }
102
+ ]
103
+ }
104
+ }
105
+ }
106
+ ```
107
+
108
+ `start` and `end` form the horizontal lower edge. The spill faces the right of that edge when
109
+ viewed from above. `height` sets the rectangle's height; optional `depth` narrows the spill around
110
+ recessed jambs. Node transforms apply to the emitter. Its role supplies emission and its part
111
+ supplies the fallback palette colour. No emitter is inferred from material colour or geometry.
112
+
113
+ Each level accepts 128 emitters. Each projects a four-triangle, depth-tested spill with reach
114
+ `clamp(1.3 * height, 4, 10)` metres. This authored effect does not cast a new light or shadow onto
115
+ other meshes. It follows the model's visibility and theme; zero emission removes it.
116
+
117
+ ## Ambient visibility
118
+
119
+ Preparation estimates each vertex's local ambient visibility using 48 deterministic,
120
+ cosine-weighted hemisphere samples, a two-metre reach and a two-millimetre origin bias. A spatial
121
+ hierarchy limits intersection work; repeated positions and normals share samples. Nearby
122
+ occluders contribute more than distant ones. Each level is prepared independently, including
123
+ occlusion between its distinct primitives. Footprint meshes do not occlude.
124
+
125
+ The result travels independently of colour. Do not bake ambient occlusion into `COLOR_0`: colour
126
+ also affects direct sunlight and emission. The runtime applies prepared visibility only to the
127
+ ambient contribution; solar visibility still comes from the dynamic shadow map.
128
+
129
+ `threeDimensional.modelOcclusion` controls strength from zero to one and defaults to `0.75`.
130
+ `threeDimensional.occlusion: false` also disables model ambient occlusion. Changing these
131
+ runtime controls does not prepare the geometry again.
132
+
133
+ Preparation cost grows with unique vertices, samples and nearby geometry. It is paid when a raw
134
+ model is prepared, never per frame. Runtime occlusion adds no draw pass or texture and uses the
135
+ existing visibility byte. It describes opaque geometry at rest; it does not follow moving parts,
136
+ other models, the ground or surrounding buildings.
137
+
138
+ ## Files and compatibility
139
+
140
+ Use `<id>.glb`, optionally `<id>.mid.glb` and `<id>.far.glb`. A mesh whose material is `footprint`
141
+ defines the area replaced by the model and is not drawn. Otherwise preparation derives a footprint.
142
+ See the [Core building guide](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/buildings-3d.md)
143
+ for placement and limits.
144
+
145
+ Prepared files retain a 16-byte vertex:
146
+
147
+ | Bytes | Content |
148
+ | ----- | -------------------------------- |
149
+ | 0–5 | Quantized position |
150
+ | 6–7 | Padding |
151
+ | 8–10 | Normal |
152
+ | 11 | Padding |
153
+ | 12 | Palette slot |
154
+ | 13 | Shade within that slot |
155
+ | 14 | Ambient visibility, 0–255 |
156
+ | 15 | Architectural lighting role, 0–6 |
157
+
158
+ The model root's `extras.tileflow.lightingRoles: 1` declares the last byte. Older files without
159
+ that marker use the legacy palette mapping. Existing fully exposed visibility values stay fully
160
+ exposed; reprepare the original GLBs to obtain geometric occlusion. Geometry, normals and palette
161
+ slots are not modified by the visibility calculation.
162
+
163
+ Roles and visibility survive meshoptimizer compression. The existing `_PAINT` accessor and vertex
164
+ stride are retained; the role occupies previously unused padding. Prepared files are an SDK
165
+ transport format, while material extras are the authoring interface.
166
+
167
+ Physical data is optional `extras.tileflow.surface` metadata on each level, with `version: 1`.
168
+ Two VEC4 accessors address a separate 32-byte stream: UV0/UV1 followed by linear vertex RGBA.
169
+ The metadata also holds material draw ranges, channel references, embedded images and emitters.
170
+ Ranges preserve each source mesh's vertical emission bounds independently of its material.
171
+ The original primitive layout remains unchanged. Older readers draw its legacy geometry and
172
+ palette; they ignore the optional physical data. New readers preserve the legacy shading path
173
+ when physical data is absent. Reprepare source GLBs to obtain the new channels.
174
+
175
+ The auxiliary stream costs 32 bytes per retained vertex on the GPU. Each resident texture uses
176
+ four bytes per pixel, plus about one third for mipmaps when enabled. Decoded images stay available
177
+ for context restoration until the model is evicted. Physical materials add one draw per material
178
+ range per colour/shadow pass; explicit emitters add one four-triangle draw each. No environment
179
+ cube map or screen-space effect is required.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tileflow/dev",
3
- "version": "0.1.0-alpha.33",
3
+ "version": "0.1.0-alpha.35",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Node development utilities for Tileflow configs and builds.",
6
6
  "type": "module",
@@ -84,9 +84,8 @@
84
84
  "dependencies": {
85
85
  "@mapbox/vector-tile": "3.0.0",
86
86
  "@maplibre/maplibre-gl-style-spec": "26.4.4",
87
- "@tileflow/core": ">=0.1.0-alpha.36 <0.1.0-beta.0",
87
+ "@tileflow/core": ">=0.1.0-alpha.38 <0.1.0-beta.0",
88
88
  "chokidar": "4.0.3",
89
- "fflate": "0.8.3",
90
89
  "fontkit": "2.0.4",
91
90
  "jiti": "^2.7.0",
92
91
  "maplibre-gl": "6.13.0",
@@ -97,7 +96,7 @@
97
96
  "three": "0.185.1"
98
97
  },
99
98
  "devDependencies": {
100
- "@tileflow/maps": "0.1.0-alpha.10"
99
+ "@tileflow/maps": "0.1.0-alpha.12"
101
100
  },
102
101
  "optionalDependencies": {
103
102
  "sharp": "0.35.5"