@adatechnology/game-floorplan-three 0.10.0 → 0.10.2
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/{chunk-7XVCZF6H.js → chunk-Y3Y7NYOL.js} +422 -272
- package/dist/chunk-Y3Y7NYOL.js.map +1 -0
- package/dist/index.d.ts +92 -34
- package/dist/index.global.js +447 -292
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/testing-BK7QmoUq.d.ts +1611 -0
- package/dist/testing.d.ts +12 -1
- package/dist/testing.js +1 -1
- package/package.json +24 -10
- package/dist/chunk-7XVCZF6H.js.map +0 -1
- package/dist/testing-CcAh3Eg1.d.ts +0 -386
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,38 @@
|
|
|
1
|
-
import { H as HouseRendererOptions, a as HouseRenderer } from './testing-
|
|
2
|
-
export { A as AreaContext, B as BuildOptions, D as DEFAULT_SPECIMENS,
|
|
1
|
+
import { R as RoomRects, T as Three, H as HouseRendererOptions, a as HouseRenderer, b as HouseRecord } from './testing-BK7QmoUq.js';
|
|
2
|
+
export { A as AreaContext, B as BuildOptions, D as DEFAULT_SPECIMENS, c as Damageable, F as FLOORPLAN_AREA_ID, d as FloorplanEngineLike, e as FloorplanTestOptions, f as House, g as HouseBoxCollider, h as HouseFurnitureCollider, i as HouseInteractable, j as HouseInteractives, k as HousePart, l as HousePlan, m as HousePoint, n as HouseTargetOptions, L as LightingOptions, M as Messages, S as SPECIMEN_AT, o as SpecimenDef, p as TemplateGroup, q as Translate, r as buildSpecimenMeshes, s as createFloorplanTestModule, t as createHouseScenarios, u as createTranslator, v as en, w as locales, x as ptBR, y as specimenSpec } from './testing-BK7QmoUq.js';
|
|
3
|
+
import { DestructionEvent, DestructionWorld } from '@adatechnology/game-destruction';
|
|
3
4
|
import { DestructibleSpec, WarmUpProbes } from '@adatechnology/game-contracts';
|
|
5
|
+
import * as THREE_NS from 'three';
|
|
6
|
+
import { Construction, Structure } from '@adatechnology/game-floorplan-structure';
|
|
7
|
+
import { Rect } from '@adatechnology/game-floorplan';
|
|
8
|
+
import '@adatechnology/game-destruction-three';
|
|
4
9
|
import '@adatechnology/game-render-three';
|
|
10
|
+
import '@adatechnology/game-props3d';
|
|
11
|
+
import '@adatechnology/game-shapes-three';
|
|
12
|
+
import '@adatechnology/game-vegetation';
|
|
13
|
+
import '@adatechnology/game-interactables';
|
|
14
|
+
import '@adatechnology/game-floorplan-interactables';
|
|
15
|
+
import '@adatechnology/game-vegetation/three';
|
|
5
16
|
|
|
17
|
+
/** A house as the shared draw budget reads it: its distance, its draw calls with and without the small pieces, and how to set its LOD. */
|
|
18
|
+
interface LodHouse {
|
|
19
|
+
distance(focus: unknown): number;
|
|
20
|
+
stats: {
|
|
21
|
+
drawCalls: number;
|
|
22
|
+
drawCallsLOD1: number;
|
|
23
|
+
};
|
|
24
|
+
setLod(level: number): void;
|
|
25
|
+
}
|
|
6
26
|
declare const OPEN_ROOM_TYPES: Set<string>;
|
|
7
|
-
declare const rectsOf: (c:
|
|
8
|
-
declare const isOpenArea: (c:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
27
|
+
declare const rectsOf: (c: RoomRects) => readonly Rect[];
|
|
28
|
+
declare const isOpenArea: (c: {
|
|
29
|
+
type: string;
|
|
30
|
+
outdoor?: boolean;
|
|
31
|
+
}) => boolean;
|
|
32
|
+
declare function planLod<H extends LodHouse>(houses: readonly H[], focus: unknown, budget: number): {
|
|
33
|
+
total: number;
|
|
34
|
+
levels: number[];
|
|
35
|
+
houses: H[];
|
|
13
36
|
};
|
|
14
37
|
|
|
15
38
|
declare const VERSION = "1.0.0";
|
|
@@ -18,7 +41,7 @@ declare const VERSION = "1.0.0";
|
|
|
18
41
|
* Creates a house renderer: `create(THREE, options).build(result, { quality, night })` turns the result of `@adatechnology/game-floorplan`
|
|
19
42
|
* (plus the structure of `@adatechnology/game-floorplan-structure`) into a three.js group. Port of the team's Casa3DSDK.
|
|
20
43
|
*/
|
|
21
|
-
declare function create(THREE:
|
|
44
|
+
declare function create(THREE: Three, options?: HouseRendererOptions): HouseRenderer;
|
|
22
45
|
|
|
23
46
|
/** A rectangle `[x0, z0, x1, z1]` in the house's coordinates. */
|
|
24
47
|
type NavRect = [number, number, number, number];
|
|
@@ -35,8 +58,8 @@ interface NavHouseDef {
|
|
|
35
58
|
id: string;
|
|
36
59
|
floors: NavFloor[];
|
|
37
60
|
stairs?: NavStair[];
|
|
38
|
-
groups?:
|
|
39
|
-
roof?:
|
|
61
|
+
groups?: NavShowable[];
|
|
62
|
+
roof?: NavShowable;
|
|
40
63
|
/** The fine grid also rules the ground floor inside the house (default: the ground floor uses the game's grid, except stairs and banisters). */
|
|
41
64
|
own?: boolean;
|
|
42
65
|
/** The house's rectangle (default: the union of its solids and stairs). */
|
|
@@ -64,7 +87,7 @@ interface NavFlight {
|
|
|
64
87
|
axis: 0 | 1;
|
|
65
88
|
from: number;
|
|
66
89
|
to: number;
|
|
67
|
-
group:
|
|
90
|
+
group: StairGroup;
|
|
68
91
|
yFrom: number;
|
|
69
92
|
yTo: number;
|
|
70
93
|
dir: number;
|
|
@@ -72,15 +95,39 @@ interface NavFlight {
|
|
|
72
95
|
len: number;
|
|
73
96
|
e: number;
|
|
74
97
|
}
|
|
98
|
+
/** What is drawn of a floor (or the roof): an object with `visible`, a function `show(visible)`, or a list of them. */
|
|
99
|
+
type NavShowable = {
|
|
100
|
+
visible: boolean;
|
|
101
|
+
} | ((visible: boolean) => void) | readonly NavShowable[] | null | undefined;
|
|
102
|
+
/** The flights that share one stair footprint: the axis they climb along, the footprint and each flight's floors. */
|
|
103
|
+
interface StairGroup {
|
|
104
|
+
ax: 0 | 1;
|
|
105
|
+
r: number[];
|
|
106
|
+
m: {
|
|
107
|
+
from: number;
|
|
108
|
+
to: number;
|
|
109
|
+
inv: boolean;
|
|
110
|
+
}[];
|
|
111
|
+
}
|
|
112
|
+
/** The path field of a floor on the coarse grid: free cells, distances and the BFS queue to the current target cell. */
|
|
113
|
+
interface PathField {
|
|
114
|
+
gx: number;
|
|
115
|
+
gz: number;
|
|
116
|
+
free: Uint8Array;
|
|
117
|
+
d: Int16Array;
|
|
118
|
+
q: Int32Array;
|
|
119
|
+
target: number;
|
|
120
|
+
t: number;
|
|
121
|
+
}
|
|
75
122
|
interface NavHouse {
|
|
76
123
|
id: string;
|
|
77
124
|
own: boolean;
|
|
78
125
|
floors: NavFloor[];
|
|
79
|
-
groups:
|
|
80
|
-
roof:
|
|
126
|
+
groups: NavShowable[];
|
|
127
|
+
roof: NavShowable;
|
|
81
128
|
flights: NavFlight[];
|
|
82
129
|
grids: Uint8Array[];
|
|
83
|
-
fields:
|
|
130
|
+
fields: (PathField | null)[];
|
|
84
131
|
/** Triples (floor, cell, previous value) of the run-time changes of the grid. */
|
|
85
132
|
journal: number[];
|
|
86
133
|
shown: number;
|
|
@@ -121,6 +168,15 @@ interface FloorNavigator {
|
|
|
121
168
|
undoChanges(houseId: string): void;
|
|
122
169
|
}
|
|
123
170
|
|
|
171
|
+
/** A box collider of the house: type, floor and rectangle. */
|
|
172
|
+
interface NavBoxCollider {
|
|
173
|
+
type: string;
|
|
174
|
+
f: number;
|
|
175
|
+
x0: number;
|
|
176
|
+
z0: number;
|
|
177
|
+
x1: number;
|
|
178
|
+
z1: number;
|
|
179
|
+
}
|
|
124
180
|
/** The parts of a built house (`create(THREE, options).build(...)`) the navigator reads. */
|
|
125
181
|
interface NavigableHouse {
|
|
126
182
|
name?: string;
|
|
@@ -131,14 +187,11 @@ interface NavigableHouse {
|
|
|
131
187
|
ceiling: number;
|
|
132
188
|
}[];
|
|
133
189
|
};
|
|
134
|
-
colliders
|
|
190
|
+
/** Its colliders; the box ones (`x0`..`z1`) of the solid types make the cells solid. */
|
|
191
|
+
colliders: readonly (NavBoxCollider | {
|
|
135
192
|
type: string;
|
|
136
193
|
f: number;
|
|
137
|
-
|
|
138
|
-
z0: number;
|
|
139
|
-
x1: number;
|
|
140
|
-
z1: number;
|
|
141
|
-
}[];
|
|
194
|
+
})[];
|
|
142
195
|
stairs: {
|
|
143
196
|
m: {
|
|
144
197
|
ry: number;
|
|
@@ -147,8 +200,8 @@ interface NavigableHouse {
|
|
|
147
200
|
to: number;
|
|
148
201
|
rect: NavRect;
|
|
149
202
|
}[];
|
|
150
|
-
floors:
|
|
151
|
-
roof:
|
|
203
|
+
floors: NavShowable[];
|
|
204
|
+
roof: NavShowable;
|
|
152
205
|
}
|
|
153
206
|
interface NavigationDefOptions {
|
|
154
207
|
/** Id the house registers with (default: the house's name). */
|
|
@@ -182,7 +235,7 @@ interface DestructibleHouse {
|
|
|
182
235
|
}>;
|
|
183
236
|
};
|
|
184
237
|
destruction: {
|
|
185
|
-
onEvent(listener: (event:
|
|
238
|
+
onEvent(listener: (event: DestructionEvent) => void): () => void;
|
|
186
239
|
restore?: () => void;
|
|
187
240
|
};
|
|
188
241
|
}
|
|
@@ -234,7 +287,7 @@ interface FurnitureSpecResult {
|
|
|
234
287
|
/** One part per box or cylinder the builder drew, origin at the centre of the footprint on the floor. */
|
|
235
288
|
spec: DestructibleSpec;
|
|
236
289
|
/** Draws the piece: one mesh per part, named by the part id, coloured as the builder coloured it. */
|
|
237
|
-
build(THREE:
|
|
290
|
+
build(THREE: Three): THREE_NS.Group;
|
|
238
291
|
/** The widest high horizontal part and the height of its upper face (what loose things rest on), or null when the piece has none. */
|
|
239
292
|
/** What loose things rest on. A solid top is boards: `parts` are all of them, `part` the one in the middle. */
|
|
240
293
|
top: {
|
|
@@ -266,7 +319,7 @@ interface FurnitureSpecResult {
|
|
|
266
319
|
* @example
|
|
267
320
|
* const { spec, build, top } = furnitureSpec(THREE, 'bookcase') // 1.2 x 0.35 x 2 m, boards and books
|
|
268
321
|
*/
|
|
269
|
-
declare function furnitureSpec(THREE:
|
|
322
|
+
declare function furnitureSpec(THREE: Three, type: string, opts?: FurnitureSpecOptions): FurnitureSpecResult;
|
|
270
323
|
interface TapSpecOptions {
|
|
271
324
|
/** `counter` (default): the tap of a sink, standing on the counter; `wall`: the tap of a laundry tub or a garden, with its plate on the wall. */
|
|
272
325
|
kind?: 'counter' | 'wall';
|
|
@@ -279,7 +332,7 @@ interface TapSpecResult {
|
|
|
279
332
|
/** The tap as parts (base, column, spout, lever), origin on the counter under the column (`counter`) or on the wall plate's centre line at the floor (`wall`). */
|
|
280
333
|
spec: DestructibleSpec;
|
|
281
334
|
/** Draws the tap: one mesh per part, named by the part id. */
|
|
282
|
-
build(THREE:
|
|
335
|
+
build(THREE: Three): THREE_NS.Group;
|
|
283
336
|
/** Where the water leaves the spout, in the space of the spec. */
|
|
284
337
|
spout: [number, number, number];
|
|
285
338
|
}
|
|
@@ -287,7 +340,7 @@ interface TapSpecResult {
|
|
|
287
340
|
* The team's tap (`counterTap` of the sink, `wallTap` of the laundry tub: `furniture/taps.ts`) drawn by the same code into parts, with the lever at rest. `spout` is where its
|
|
288
341
|
* water thread starts, so a host can put a tap of the fluids world there; the water thread itself is not drawn.
|
|
289
342
|
*/
|
|
290
|
-
declare function tapSpec(THREE:
|
|
343
|
+
declare function tapSpec(THREE: Three, opts?: TapSpecOptions): TapSpecResult;
|
|
291
344
|
|
|
292
345
|
/** A free-standing wall built and drawn as the walls of the houses. */
|
|
293
346
|
interface WallPieceOptions {
|
|
@@ -305,18 +358,18 @@ interface WallPieceOptions {
|
|
|
305
358
|
}
|
|
306
359
|
interface WallPiece {
|
|
307
360
|
/** The plan of the wall: one storey, one exterior wall, no rooms and no roof; its `structure` is the houses' load path. */
|
|
308
|
-
readonly plan:
|
|
361
|
+
readonly plan: WallPlan;
|
|
309
362
|
/** The destructible spec, as a house gives it (`house.structure.spec()`): the wall with its layers, units and breach on the ground, its concrete pillars (`wall_column_*`, at the ends and every 4 m at most) and the bond beam on both. */
|
|
310
|
-
readonly spec:
|
|
363
|
+
readonly spec: DestructibleSpec;
|
|
311
364
|
/** Draws the wall with the house renderer: meshes carry `userData.destructionPart` of their part, in the space of the spec. */
|
|
312
|
-
build(THREE:
|
|
365
|
+
build(THREE: Three): THREE_NS.Group;
|
|
313
366
|
/**
|
|
314
367
|
* Once a drawing from `build` is in a destruction world as `objectId` (with this `spec`), the house renderer follows its events and draws on it what
|
|
315
368
|
* a generic destruction renderer cannot: the bricks that shots and blows knock out (`chip`) and the opening of a breach, as gaps in the wall's
|
|
316
369
|
* courses. `restore` puts the wall back (after `world.reset`), `dispose` stops following. `update` paints the damage of the events since the last call, once
|
|
317
370
|
* per wall (call it every frame; without it the damage is painted 100 ms after the event).
|
|
318
371
|
*/
|
|
319
|
-
follow(root:
|
|
372
|
+
follow(root: THREE_NS.Object3D, world: DestructionWorld, objectId: string): {
|
|
320
373
|
restore(): void;
|
|
321
374
|
dispose(): void;
|
|
322
375
|
update(): void;
|
|
@@ -328,15 +381,20 @@ interface WallPiece {
|
|
|
328
381
|
*/
|
|
329
382
|
warmUpProbes(THREE: unknown): WarmUpProbes;
|
|
330
383
|
}
|
|
384
|
+
/** The plan of a free-standing wall, with its construction and structure. */
|
|
385
|
+
type WallPlan = HouseRecord & {
|
|
386
|
+
construction: Construction;
|
|
387
|
+
structure: Structure;
|
|
388
|
+
};
|
|
331
389
|
/**
|
|
332
390
|
* The plan of a free-standing wall along x, centred on the origin: a one-storey plan whose only wall is exterior on both sides, with the masonry construction of
|
|
333
391
|
* the houses (brick, concrete bond beam, strip footing) and the structure `buildStructure` gives the houses, without a roof.
|
|
334
392
|
*/
|
|
335
|
-
declare function wallPlan(options: WallPieceOptions):
|
|
393
|
+
declare function wallPlan(options: WallPieceOptions): WallPlan;
|
|
336
394
|
/**
|
|
337
395
|
* A free-standing wall (a target wall, a garden wall) built and drawn exactly as the walls of the houses: the structure of `game-floorplan-structure` (the wall on
|
|
338
396
|
* the strip footing, the bond beam on it, the assembly's layers, units and breach) and the house renderer's plaster, paint, baseboard and sidewalk.
|
|
339
397
|
*/
|
|
340
|
-
declare function wallPiece(THREE:
|
|
398
|
+
declare function wallPiece(THREE: Three, options: WallPieceOptions): WallPiece;
|
|
341
399
|
|
|
342
400
|
export { type DestructibleHouse, type FloorNavigator, type FurnitureCatalogEntry, type FurnitureSpecOptions, type FurnitureSpecResult, HouseRenderer, HouseRendererOptions, type NavFlight, type NavFloor, type NavHouse, type NavHouseDef, type NavRect, type NavResult, type NavShape, type NavStair, type NavigableHouse, type NavigationDefOptions, type NavigatorBinding, OPEN_ROOM_TYPES, type TapSpecOptions, type TapSpecResult, VERSION, type WallPiece, type WallPieceOptions, bindNavigator, create, createFloorNavigator, create as createHouseRenderer, furnitureSpec, isOpenArea, navigationDefOf, planLod, rectsOf, tapSpec, wallPiece, wallPlan };
|