@pascal-app/core 0.1.11 → 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/index.d.ts +1 -1
- 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/types.d.ts +2 -2
- 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/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ 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,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,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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>>;
|
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":"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"
|