@pascal-app/core 0.1.10 → 0.1.12
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/events/bus.d.ts +6 -2
- package/dist/events/bus.d.ts.map +1 -1
- package/dist/hooks/scene-registry/scene-registry.d.ts +1 -0
- package/dist/hooks/scene-registry/scene-registry.d.ts.map +1 -1
- package/dist/hooks/scene-registry/scene-registry.js +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/schema/nodes/item.d.ts +2 -2
- package/dist/schema/nodes/site.d.ts +1 -1
- package/dist/schema/nodes/site.js +5 -5
- package/dist/schema/types.d.ts +2 -2
- package/dist/store/use-scene.d.ts.map +1 -1
- package/dist/store/use-scene.js +35 -9
- package/dist/systems/wall/wall-system.d.ts.map +1 -1
- package/dist/systems/wall/wall-system.js +9 -1
- package/package.json +2 -1
package/dist/events/bus.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ThreeEvent } from '@react-three/fiber';
|
|
2
|
-
import type { BuildingNode, CeilingNode, ItemNode, LevelNode, RoofNode, SlabNode, WallNode, ZoneNode } from '../schema';
|
|
2
|
+
import type { BuildingNode, CeilingNode, ItemNode, LevelNode, RoofNode, SiteNode, SlabNode, WallNode, ZoneNode } from '../schema';
|
|
3
3
|
import type { AnyNode } from '../schema/types';
|
|
4
4
|
export interface GridEvent {
|
|
5
5
|
position: [number, number, number];
|
|
@@ -15,6 +15,7 @@ export interface NodeEvent<T extends AnyNode = AnyNode> {
|
|
|
15
15
|
}
|
|
16
16
|
export type WallEvent = NodeEvent<WallNode>;
|
|
17
17
|
export type ItemEvent = NodeEvent<ItemNode>;
|
|
18
|
+
export type SiteEvent = NodeEvent<SiteNode>;
|
|
18
19
|
export type BuildingEvent = NodeEvent<BuildingNode>;
|
|
19
20
|
export type LevelEvent = NodeEvent<LevelNode>;
|
|
20
21
|
export type ZoneEvent = NodeEvent<ZoneNode>;
|
|
@@ -35,8 +36,11 @@ export interface CameraControlEvent {
|
|
|
35
36
|
type CameraControlEvents = {
|
|
36
37
|
'camera-controls:view': CameraControlEvent;
|
|
37
38
|
'camera-controls:capture': CameraControlEvent;
|
|
39
|
+
'camera-controls:top-view': undefined;
|
|
40
|
+
'camera-controls:orbit-cw': undefined;
|
|
41
|
+
'camera-controls:orbit-ccw': undefined;
|
|
38
42
|
};
|
|
39
|
-
type EditorEvents = GridEvents & NodeEvents<'wall', WallEvent> & NodeEvents<'item', ItemEvent> & NodeEvents<'building', BuildingEvent> & NodeEvents<'level', LevelEvent> & NodeEvents<'zone', ZoneEvent> & NodeEvents<'slab', SlabEvent> & NodeEvents<'ceiling', CeilingEvent> & NodeEvents<'roof', RoofEvent> & CameraControlEvents;
|
|
43
|
+
type EditorEvents = GridEvents & NodeEvents<'wall', WallEvent> & NodeEvents<'item', ItemEvent> & NodeEvents<'site', SiteEvent> & NodeEvents<'building', BuildingEvent> & NodeEvents<'level', LevelEvent> & NodeEvents<'zone', ZoneEvent> & NodeEvents<'slab', SlabEvent> & NodeEvents<'ceiling', CeilingEvent> & NodeEvents<'roof', RoofEvent> & CameraControlEvents;
|
|
40
44
|
export declare const emitter: import("mitt").Emitter<EditorEvents>;
|
|
41
45
|
export {};
|
|
42
46
|
//# sourceMappingURL=bus.d.ts.map
|
package/dist/events/bus.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bus.d.ts","sourceRoot":"","sources":["../../src/events/bus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAEpD,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"bus.d.ts","sourceRoot":"","sources":["../../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,sCAAuB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene-registry.d.ts","sourceRoot":"","sources":["../../../src/hooks/scene-registry/scene-registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"scene-registry.d.ts","sourceRoot":"","sources":["../../../src/hooks/scene-registry/scene-registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;CAmBzB,CAAC;AAEF,wBAAgB,WAAW,CACzB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,OAAO,aAAa,CAAC,MAAM,EACvC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,QAkBrC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export type { BuildingEvent, CameraControlEvent, EventSuffix, GridEvent, ItemEvent, LevelEvent, NodeEvent, SlabEvent, WallEvent, ZoneEvent, CeilingEvent, RoofEvent, } from './events/bus';
|
|
1
|
+
export type { BuildingEvent, CameraControlEvent, EventSuffix, GridEvent, ItemEvent, LevelEvent, NodeEvent, SiteEvent, SlabEvent, WallEvent, ZoneEvent, CeilingEvent, RoofEvent, } from './events/bus';
|
|
2
2
|
export { emitter, eventSuffixes } from './events/bus';
|
|
3
3
|
export { sceneRegistry, useRegistry, } from './hooks/scene-registry/scene-registry';
|
|
4
4
|
export { initSpatialGridSync, resolveLevelId, } from './hooks/spatial-grid/spatial-grid-sync';
|
|
5
5
|
export { useSpatialQuery } from './hooks/spatial-grid/use-spatial-query';
|
|
6
|
-
export { pointInPolygon } from './hooks/spatial-grid/spatial-grid-manager';
|
|
6
|
+
export { pointInPolygon, spatialGridManager } from './hooks/spatial-grid/spatial-grid-manager';
|
|
7
7
|
export * from './schema';
|
|
8
8
|
export { default as useScene } from './store/use-scene';
|
|
9
9
|
export { CeilingSystem } from './systems/ceiling/ceiling-system';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,YAAY,EACZ,SAAS,GACV,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAErD,OAAO,EACL,aAAa,EACb,WAAW,GACZ,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EACL,mBAAmB,EACnB,cAAc,GACf,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,YAAY,EACZ,SAAS,GACV,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAErD,OAAO,EACL,aAAa,EACb,WAAW,GACZ,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EACL,mBAAmB,EACnB,cAAc,GACf,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AACxE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AAE9F,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAA;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAE7D,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,KAAK,KAAK,EAAE,MAAM,uBAAuB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ export { emitter, eventSuffixes } from './events/bus';
|
|
|
5
5
|
export { sceneRegistry, useRegistry, } from './hooks/scene-registry/scene-registry';
|
|
6
6
|
export { initSpatialGridSync, resolveLevelId, } from './hooks/spatial-grid/spatial-grid-sync';
|
|
7
7
|
export { useSpatialQuery } from './hooks/spatial-grid/use-spatial-query';
|
|
8
|
-
export { pointInPolygon } from './hooks/spatial-grid/spatial-grid-manager';
|
|
8
|
+
export { pointInPolygon, spatialGridManager } from './hooks/spatial-grid/spatial-grid-manager';
|
|
9
9
|
// Schema
|
|
10
10
|
export * from './schema';
|
|
11
11
|
export { default as useScene } from './store/use-scene';
|
|
@@ -7,9 +7,9 @@ declare const assetSchema: z.ZodObject<{
|
|
|
7
7
|
src: z.ZodString;
|
|
8
8
|
dimensions: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
9
9
|
attachTo: z.ZodOptional<z.ZodEnum<{
|
|
10
|
+
ceiling: "ceiling";
|
|
10
11
|
wall: "wall";
|
|
11
12
|
"wall-side": "wall-side";
|
|
12
|
-
ceiling: "ceiling";
|
|
13
13
|
}>>;
|
|
14
14
|
offset: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
15
15
|
rotation: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
@@ -51,9 +51,9 @@ export declare const ItemNode: z.ZodObject<{
|
|
|
51
51
|
src: z.ZodString;
|
|
52
52
|
dimensions: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
53
53
|
attachTo: z.ZodOptional<z.ZodEnum<{
|
|
54
|
+
ceiling: "ceiling";
|
|
54
55
|
wall: "wall";
|
|
55
56
|
"wall-side": "wall-side";
|
|
56
|
-
ceiling: "ceiling";
|
|
57
57
|
}>>;
|
|
58
58
|
offset: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
59
59
|
rotation: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
@@ -76,9 +76,9 @@ export declare const SiteNode: z.ZodObject<{
|
|
|
76
76
|
src: z.ZodString;
|
|
77
77
|
dimensions: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
78
78
|
attachTo: z.ZodOptional<z.ZodEnum<{
|
|
79
|
+
ceiling: "ceiling";
|
|
79
80
|
wall: "wall";
|
|
80
81
|
"wall-side": "wall-side";
|
|
81
|
-
ceiling: "ceiling";
|
|
82
82
|
}>>;
|
|
83
83
|
offset: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
84
84
|
rotation: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
@@ -20,12 +20,12 @@ export const SiteNode = BaseNode.extend({
|
|
|
20
20
|
// Specific props
|
|
21
21
|
polygon: PropertyLineData.optional().default({
|
|
22
22
|
type: 'polygon',
|
|
23
|
-
// Default 30x30 square
|
|
23
|
+
// Default 30x30 square centered at origin
|
|
24
24
|
points: [
|
|
25
|
-
[
|
|
26
|
-
[
|
|
27
|
-
[
|
|
28
|
-
[
|
|
25
|
+
[-15, -15],
|
|
26
|
+
[15, -15],
|
|
27
|
+
[15, 15],
|
|
28
|
+
[-15, 15],
|
|
29
29
|
],
|
|
30
30
|
}),
|
|
31
31
|
// terrain: TerrainData,
|
package/dist/schema/types.d.ts
CHANGED
|
@@ -76,9 +76,9 @@ export declare const AnyNode: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
76
76
|
src: z.ZodString;
|
|
77
77
|
dimensions: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
78
78
|
attachTo: z.ZodOptional<z.ZodEnum<{
|
|
79
|
+
ceiling: "ceiling";
|
|
79
80
|
wall: "wall";
|
|
80
81
|
"wall-side": "wall-side";
|
|
81
|
-
ceiling: "ceiling";
|
|
82
82
|
}>>;
|
|
83
83
|
offset: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
84
84
|
rotation: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
@@ -193,9 +193,9 @@ export declare const AnyNode: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
193
193
|
src: z.ZodString;
|
|
194
194
|
dimensions: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
195
195
|
attachTo: z.ZodOptional<z.ZodEnum<{
|
|
196
|
+
ceiling: "ceiling";
|
|
196
197
|
wall: "wall";
|
|
197
198
|
"wall-side": "wall-side";
|
|
198
|
-
ceiling: "ceiling";
|
|
199
199
|
}>>;
|
|
200
200
|
offset: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
201
201
|
rotation: z.ZodDefault<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-scene.d.ts","sourceRoot":"","sources":["../../src/store/use-scene.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE1C,OAAO,EAAU,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"use-scene.d.ts","sourceRoot":"","sources":["../../src/store/use-scene.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE1C,OAAO,EAAU,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAA;AAKnE,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAIzD,MAAM,MAAM,UAAU,GAAG;IAEvB,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IAGjC,WAAW,EAAE,SAAS,EAAE,CAAA;IAGxB,UAAU,EAAE,GAAG,CAAC,SAAS,CAAC,CAAA;IAG1B,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,UAAU,EAAE,MAAM,IAAI,CAAA;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,IAAI,CAAA;IAE/E,SAAS,EAAE,CAAC,EAAE,EAAE,SAAS,KAAK,IAAI,CAAA;IAClC,UAAU,EAAE,CAAC,EAAE,EAAE,SAAS,KAAK,IAAI,CAAA;IAEnC,UAAU,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,SAAS,KAAK,IAAI,CAAA;IACzD,WAAW,EAAE,CAAC,GAAG,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;KAAE,EAAE,KAAK,IAAI,CAAA;IAErE,UAAU,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;IAC3D,WAAW,EAAE,CAAC,OAAO,EAAE;QAAE,EAAE,EAAE,SAAS,CAAC;QAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;KAAE,EAAE,KAAK,IAAI,CAAA;IAE3E,UAAU,EAAE,CAAC,EAAE,EAAE,SAAS,KAAK,IAAI,CAAA;IACnC,WAAW,EAAE,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,IAAI,CAAA;CACxC,CAAA;AAID,KAAK,aAAa,GAAG,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,GAAG;IACzD,QAAQ,EAAE,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,GAAG,aAAa,CAAC,CAAC,CAAC,CAAA;CAC7E,CAAA;AAED,QAAA,MAAM,QAAQ,EAAE,aA6Jf,CAAA;AAED,eAAe,QAAQ,CAAA"}
|
package/dist/store/use-scene.js
CHANGED
|
@@ -4,6 +4,7 @@ import { create } from 'zustand';
|
|
|
4
4
|
import { persist } from 'zustand/middleware';
|
|
5
5
|
import { BuildingNode } from '../schema';
|
|
6
6
|
import { LevelNode } from '../schema/nodes/level';
|
|
7
|
+
import { SiteNode } from '../schema/nodes/site';
|
|
7
8
|
import { isObject } from '../utils/types';
|
|
8
9
|
import * as nodeActions from './actions/node-actions';
|
|
9
10
|
const useScene = create()(persist(temporal((set, get) => ({
|
|
@@ -40,21 +41,25 @@ const useScene = create()(persist(temporal((set, get) => ({
|
|
|
40
41
|
});
|
|
41
42
|
return; // Scene already loaded
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
-
children: [],
|
|
45
|
-
});
|
|
44
|
+
// Create hierarchy: Site → Building → Level
|
|
46
45
|
const level0 = LevelNode.parse({
|
|
47
46
|
level: 0,
|
|
48
47
|
children: [],
|
|
49
48
|
});
|
|
50
|
-
building.
|
|
49
|
+
const building = BuildingNode.parse({
|
|
50
|
+
children: [level0.id],
|
|
51
|
+
});
|
|
52
|
+
const site = SiteNode.parse({
|
|
53
|
+
children: [building],
|
|
54
|
+
});
|
|
51
55
|
// Define all nodes flat
|
|
52
56
|
const nodes = {
|
|
57
|
+
[site.id]: site,
|
|
53
58
|
[building.id]: building,
|
|
54
59
|
[level0.id]: level0,
|
|
55
60
|
};
|
|
56
|
-
//
|
|
57
|
-
const rootNodeIds = [
|
|
61
|
+
// Site is the root
|
|
62
|
+
const rootNodeIds = [site.id];
|
|
58
63
|
set({ nodes, rootNodeIds });
|
|
59
64
|
},
|
|
60
65
|
markDirty: (id) => {
|
|
@@ -88,14 +93,35 @@ const useScene = create()(persist(temporal((set, get) => ({
|
|
|
88
93
|
}),
|
|
89
94
|
onRehydrateStorage: (state) => {
|
|
90
95
|
console.log('hydrating...');
|
|
91
|
-
// optional
|
|
92
96
|
return (state, error) => {
|
|
93
97
|
if (error) {
|
|
94
98
|
console.log('an error happened during hydration', error);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (!state) {
|
|
102
|
+
console.log('hydration finished - no state');
|
|
103
|
+
return;
|
|
95
104
|
}
|
|
96
|
-
|
|
97
|
-
|
|
105
|
+
// Migration: Wrap old scenes (where root is not a SiteNode) in a SiteNode
|
|
106
|
+
const rootId = state.rootNodeIds?.[0];
|
|
107
|
+
const rootNode = rootId ? state.nodes[rootId] : null;
|
|
108
|
+
if (rootNode && rootNode.type !== 'site') {
|
|
109
|
+
console.log('Migrating old scene: wrapping in SiteNode');
|
|
110
|
+
// Collect existing root nodes (should be BuildingNode or ItemNode)
|
|
111
|
+
const existingRoots = (state.rootNodeIds || [])
|
|
112
|
+
.map(id => state.nodes[id])
|
|
113
|
+
.filter(node => node?.type === 'building' || node?.type === 'item');
|
|
114
|
+
// Create a new SiteNode with existing roots as children
|
|
115
|
+
const site = SiteNode.parse({
|
|
116
|
+
children: existingRoots,
|
|
117
|
+
});
|
|
118
|
+
// Add site to nodes
|
|
119
|
+
state.nodes[site.id] = site;
|
|
120
|
+
// Update root to be the site
|
|
121
|
+
state.rootNodeIds = [site.id];
|
|
122
|
+
console.log('Migration complete: scene now has SiteNode as root');
|
|
98
123
|
}
|
|
124
|
+
console.log('hydration finished');
|
|
99
125
|
};
|
|
100
126
|
},
|
|
101
127
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wall-system.d.ts","sourceRoot":"","sources":["../../../src/systems/wall/wall-system.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"wall-system.d.ts","sourceRoot":"","sources":["../../../src/systems/wall/wall-system.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,OAAO,KAAK,EAAE,OAAO,EAAa,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEhE,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,iBAAiB,CAAA;AAUxB,eAAO,MAAM,UAAU,YAuDtB,CAAA;AA2DD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,OAAO,EAAE,EACxB,SAAS,EAAE,aAAa,EACxB,aAAa,SAAI,oFA8IlB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useFrame } from '@react-three/fiber';
|
|
2
2
|
import * as THREE from 'three';
|
|
3
|
+
import { computeBoundsTree } from 'three-mesh-bvh';
|
|
3
4
|
import { Brush, Evaluator, SUBTRACTION } from 'three-bvh-csg';
|
|
4
5
|
import { sceneRegistry } from '../../hooks/scene-registry/scene-registry';
|
|
5
6
|
import { spatialGridManager } from '../../hooks/spatial-grid/spatial-grid-manager';
|
|
@@ -11,6 +12,7 @@ const csgEvaluator = new Evaluator();
|
|
|
11
12
|
// ============================================================================
|
|
12
13
|
// WALL SYSTEM
|
|
13
14
|
// ============================================================================
|
|
15
|
+
let useFrameNb = 0;
|
|
14
16
|
export const WallSystem = () => {
|
|
15
17
|
const dirtyNodes = useScene((state) => state.dirtyNodes);
|
|
16
18
|
const clearDirty = useScene((state) => state.clearDirty);
|
|
@@ -20,11 +22,11 @@ export const WallSystem = () => {
|
|
|
20
22
|
const nodes = useScene.getState().nodes;
|
|
21
23
|
// Collect dirty walls and their levels
|
|
22
24
|
const dirtyWallsByLevel = new Map();
|
|
25
|
+
useFrameNb += 1;
|
|
23
26
|
dirtyNodes.forEach((id) => {
|
|
24
27
|
const node = nodes[id];
|
|
25
28
|
if (!node || node.type !== 'wall')
|
|
26
29
|
return;
|
|
27
|
-
console.log('wall front/back', node.frontSide, node.backSide);
|
|
28
30
|
const levelId = node.parentId;
|
|
29
31
|
if (!levelId)
|
|
30
32
|
return;
|
|
@@ -210,6 +212,9 @@ export function generateExtrudedWall(wallNode, childrenNodes, miterData, slabEle
|
|
|
210
212
|
return geometry;
|
|
211
213
|
}
|
|
212
214
|
// Create wall brush from geometry
|
|
215
|
+
// Pre-compute BVH with new API to avoid deprecation warning
|
|
216
|
+
geometry.computeBoundsTree = computeBoundsTree;
|
|
217
|
+
geometry.computeBoundsTree({ maxLeafSize: 10 });
|
|
213
218
|
const wallBrush = new Brush(geometry);
|
|
214
219
|
wallBrush.updateMatrixWorld();
|
|
215
220
|
// Subtract each cutout from the wall
|
|
@@ -279,6 +284,9 @@ function collectCutoutBrushes(wallNode, childrenNodes, wallThickness) {
|
|
|
279
284
|
const boxGeo = new THREE.BoxGeometry(width, height, depth);
|
|
280
285
|
// Position box at the center of the cutout
|
|
281
286
|
boxGeo.translate(minX + width / 2, minY + height / 2, 0);
|
|
287
|
+
// Pre-compute BVH with new API to avoid deprecation warning
|
|
288
|
+
boxGeo.computeBoundsTree = computeBoundsTree;
|
|
289
|
+
boxGeo.computeBoundsTree({ maxLeafSize: 10 });
|
|
282
290
|
const brush = new Brush(boxGeo);
|
|
283
291
|
brushes.push(brush);
|
|
284
292
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pascal-app/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "Core library for Pascal 3D building editor",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"mitt": "^3.0.1",
|
|
34
34
|
"nanoid": "^5.1.6",
|
|
35
35
|
"three-bvh-csg": "^0.0.17",
|
|
36
|
+
"three-mesh-bvh": "^0.9.8",
|
|
36
37
|
"zod": "^4.3.5",
|
|
37
38
|
"zundo": "^2.3.0",
|
|
38
39
|
"zustand": "^5"
|