@pascal-app/core 0.1.13 → 0.2.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/dist/events/bus.d.ts +14 -2
- package/dist/events/bus.d.ts.map +1 -1
- package/dist/hooks/scene-registry/scene-registry.d.ts +5 -1
- package/dist/hooks/scene-registry/scene-registry.d.ts.map +1 -1
- package/dist/hooks/scene-registry/scene-registry.js +10 -1
- package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts +8 -8
- package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/spatial-grid-manager.js +88 -36
- package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts +1 -1
- package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/spatial-grid-sync.js +16 -8
- package/dist/hooks/spatial-grid/spatial-grid.d.ts +3 -3
- package/dist/hooks/spatial-grid/spatial-grid.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/spatial-grid.js +2 -2
- package/dist/hooks/spatial-grid/use-spatial-query.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/wall-spatial-grid.d.ts +2 -2
- package/dist/hooks/spatial-grid/wall-spatial-grid.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/wall-spatial-grid.js +2 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/lib/space-detection.d.ts.map +1 -1
- package/dist/lib/space-detection.js +1 -1
- package/dist/schema/collections.d.ts +11 -0
- package/dist/schema/collections.d.ts.map +1 -0
- package/dist/schema/collections.js +2 -0
- package/dist/schema/index.d.ts +11 -8
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +11 -7
- package/dist/schema/nodes/door.d.ts +78 -0
- package/dist/schema/nodes/door.d.ts.map +1 -0
- package/dist/schema/nodes/door.js +67 -0
- package/dist/schema/nodes/item.d.ts +234 -0
- package/dist/schema/nodes/item.d.ts.map +1 -1
- package/dist/schema/nodes/item.js +65 -1
- package/dist/schema/nodes/level.d.ts.map +1 -1
- package/dist/schema/nodes/level.js +11 -1
- package/dist/schema/nodes/roof-segment.d.ts +51 -0
- package/dist/schema/nodes/roof-segment.d.ts.map +1 -0
- package/dist/schema/nodes/roof-segment.js +36 -0
- package/dist/schema/nodes/roof.d.ts +1 -4
- package/dist/schema/nodes/roof.d.ts.map +1 -1
- package/dist/schema/nodes/roof.js +9 -16
- package/dist/schema/nodes/site.d.ts +46 -0
- package/dist/schema/nodes/site.d.ts.map +1 -1
- package/dist/schema/types.d.ts +191 -4
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/types.js +4 -0
- package/dist/store/actions/node-actions.d.ts.map +1 -1
- package/dist/store/actions/node-actions.js +23 -4
- package/dist/store/use-interactive.d.ts +18 -0
- package/dist/store/use-interactive.d.ts.map +1 -0
- package/dist/store/use-interactive.js +50 -0
- package/dist/store/use-scene.d.ts +10 -1
- package/dist/store/use-scene.d.ts.map +1 -1
- package/dist/store/use-scene.js +180 -57
- package/dist/systems/ceiling/ceiling-system.d.ts.map +1 -1
- package/dist/systems/ceiling/ceiling-system.js +5 -0
- package/dist/systems/door/door-system.d.ts +2 -0
- package/dist/systems/door/door-system.d.ts.map +1 -0
- package/dist/systems/door/door-system.js +211 -0
- package/dist/systems/item/item-system.js +3 -2
- package/dist/systems/roof/roof-system.d.ts +11 -3
- package/dist/systems/roof/roof-system.d.ts.map +1 -1
- package/dist/systems/roof/roof-system.js +705 -210
- package/dist/systems/slab/slab-system.js +3 -3
- package/dist/systems/wall/wall-mitering.js +2 -2
- package/dist/systems/wall/wall-system.d.ts.map +1 -1
- package/dist/systems/wall/wall-system.js +6 -6
- package/dist/systems/window/window-system.js +3 -3
- package/package.json +6 -6
|
@@ -24,7 +24,7 @@ export const SlabSystem = () => {
|
|
|
24
24
|
}
|
|
25
25
|
// If mesh not found, keep it dirty for next frame
|
|
26
26
|
});
|
|
27
|
-
});
|
|
27
|
+
}, 1);
|
|
28
28
|
return null;
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
@@ -63,8 +63,8 @@ function outsetPolygon(polygon, amount) {
|
|
|
63
63
|
offEdges.push([polygon[i][0], polygon[i][1], dx, dz]);
|
|
64
64
|
continue;
|
|
65
65
|
}
|
|
66
|
-
const nx = (s * dz / len) * amount;
|
|
67
|
-
const nz = (s * -dx / len) * amount;
|
|
66
|
+
const nx = ((s * dz) / len) * amount;
|
|
67
|
+
const nz = ((s * -dx) / len) * amount;
|
|
68
68
|
offEdges.push([polygon[i][0] + nx, polygon[i][1] + nz, dx, dz]);
|
|
69
69
|
}
|
|
70
70
|
// Intersect consecutive offset edges to get new vertices
|
|
@@ -52,11 +52,11 @@ function findJunctions(walls) {
|
|
|
52
52
|
if (!junctions.has(keyStart)) {
|
|
53
53
|
junctions.set(keyStart, { meetingPoint: startPt, connectedWalls: [] });
|
|
54
54
|
}
|
|
55
|
-
junctions.get(keyStart)
|
|
55
|
+
junctions.get(keyStart)?.connectedWalls.push({ wall, endType: 'start' });
|
|
56
56
|
if (!junctions.has(keyEnd)) {
|
|
57
57
|
junctions.set(keyEnd, { meetingPoint: endPt, connectedWalls: [] });
|
|
58
58
|
}
|
|
59
|
-
junctions.get(keyEnd)
|
|
59
|
+
junctions.get(keyEnd)?.connectedWalls.push({ wall, endType: 'end' });
|
|
60
60
|
}
|
|
61
61
|
// Second pass: detect T-junctions (walls passing through junction points)
|
|
62
62
|
for (const [_key, junction] of junctions.entries()) {
|
|
@@ -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;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;
|
|
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;AA0DD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,OAAO,EAAE,EACxB,SAAS,EAAE,aAAa,EACxB,aAAa,SAAI,oFA4IlB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useFrame } from '@react-three/fiber';
|
|
2
2
|
import * as THREE from 'three';
|
|
3
|
-
import { computeBoundsTree } from 'three-mesh-bvh';
|
|
4
3
|
import { Brush, Evaluator, SUBTRACTION } from 'three-bvh-csg';
|
|
4
|
+
import { computeBoundsTree } from 'three-mesh-bvh';
|
|
5
5
|
import { sceneRegistry } from '../../hooks/scene-registry/scene-registry';
|
|
6
6
|
import { spatialGridManager } from '../../hooks/spatial-grid/spatial-grid-manager';
|
|
7
7
|
import { resolveLevelId } from '../../hooks/spatial-grid/spatial-grid-sync';
|
|
@@ -33,7 +33,7 @@ export const WallSystem = () => {
|
|
|
33
33
|
if (!dirtyWallsByLevel.has(levelId)) {
|
|
34
34
|
dirtyWallsByLevel.set(levelId, new Set());
|
|
35
35
|
}
|
|
36
|
-
dirtyWallsByLevel.get(levelId)
|
|
36
|
+
dirtyWallsByLevel.get(levelId)?.add(id);
|
|
37
37
|
});
|
|
38
38
|
// Process each level that has dirty walls
|
|
39
39
|
for (const [levelId, dirtyWallIds] of dirtyWallsByLevel) {
|
|
@@ -59,7 +59,7 @@ export const WallSystem = () => {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
});
|
|
62
|
+
}, 4);
|
|
63
63
|
return null;
|
|
64
64
|
};
|
|
65
65
|
/**
|
|
@@ -247,7 +247,7 @@ function collectCutoutBrushes(wallNode, childrenNodes, wallThickness) {
|
|
|
247
247
|
wallMesh.updateMatrixWorld();
|
|
248
248
|
const wallMatrixInverse = wallMesh.matrixWorld.clone().invert();
|
|
249
249
|
for (const child of childrenNodes) {
|
|
250
|
-
if (child.type !== 'item' && child.type !== 'window')
|
|
250
|
+
if (child.type !== 'item' && child.type !== 'window' && child.type !== 'door')
|
|
251
251
|
continue;
|
|
252
252
|
const childMesh = sceneRegistry.nodes.get(child.id);
|
|
253
253
|
if (!childMesh)
|
|
@@ -262,8 +262,8 @@ function collectCutoutBrushes(wallNode, childrenNodes, wallThickness) {
|
|
|
262
262
|
continue;
|
|
263
263
|
// Calculate bounds in wall-local space
|
|
264
264
|
const v3 = new THREE.Vector3();
|
|
265
|
-
let minX =
|
|
266
|
-
let minY =
|
|
265
|
+
let minX = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY;
|
|
266
|
+
let minY = Number.POSITIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY;
|
|
267
267
|
for (let i = 0; i < positions.count; i++) {
|
|
268
268
|
v3.fromBufferAttribute(positions, i);
|
|
269
269
|
v3.applyMatrix4(cutoutMesh.matrixWorld);
|
|
@@ -42,7 +42,7 @@ export const WindowSystem = () => {
|
|
|
42
42
|
useScene.getState().dirtyNodes.add(node.parentId);
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
|
-
});
|
|
45
|
+
}, 3);
|
|
46
46
|
return null;
|
|
47
47
|
};
|
|
48
48
|
function addBox(parent, material, w, h, d, x, y, z) {
|
|
@@ -83,8 +83,8 @@ function updateWindowMesh(node, mesh) {
|
|
|
83
83
|
const usableH = innerH - (numRows - 1) * rowDividerThickness;
|
|
84
84
|
const colSum = columnRatios.reduce((a, b) => a + b, 0);
|
|
85
85
|
const rowSum = rowRatios.reduce((a, b) => a + b, 0);
|
|
86
|
-
const colWidths = columnRatios.map(r => (r / colSum) * usableW);
|
|
87
|
-
const rowHeights = rowRatios.map(r => (r / rowSum) * usableH);
|
|
86
|
+
const colWidths = columnRatios.map((r) => (r / colSum) * usableW);
|
|
87
|
+
const rowHeights = rowRatios.map((r) => (r / rowSum) * usableH);
|
|
88
88
|
// Compute column x-centers starting from left edge of inner area
|
|
89
89
|
const colXCenters = [];
|
|
90
90
|
let cx = -innerW / 2;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pascal-app/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Core library for Pascal 3D building editor",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,24 +25,24 @@
|
|
|
25
25
|
"@react-three/drei": "^10",
|
|
26
26
|
"@react-three/fiber": "^9",
|
|
27
27
|
"react": "^18 || ^19",
|
|
28
|
-
"three": "^0.
|
|
28
|
+
"three": "^0.183"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"dedent": "^1.7.1",
|
|
32
32
|
"idb-keyval": "^6.2.2",
|
|
33
33
|
"mitt": "^3.0.1",
|
|
34
34
|
"nanoid": "^5.1.6",
|
|
35
|
-
"three-bvh-csg": "^0.0.
|
|
35
|
+
"three-bvh-csg": "^0.0.18",
|
|
36
36
|
"three-mesh-bvh": "^0.9.8",
|
|
37
37
|
"zod": "^4.3.5",
|
|
38
38
|
"zundo": "^2.3.0",
|
|
39
39
|
"zustand": "^5"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@
|
|
42
|
+
"@pascal/typescript-config": "*",
|
|
43
43
|
"@types/react": "^19.2.2",
|
|
44
|
-
"typescript": "5.9.
|
|
45
|
-
"@types/three": "^0.
|
|
44
|
+
"typescript": "5.9.3",
|
|
45
|
+
"@types/three": "^0.183.0"
|
|
46
46
|
},
|
|
47
47
|
"keywords": [
|
|
48
48
|
"3d",
|