v0.4.14: schuin dak met loodrechte kopse kanten, import met naadwanden, weergave Vloerplan

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Machiel
2026-09-30 17:24:38 +02:00
co-authored by Claude Opus 5.5
parent 94a5215f82
commit 7d91416004
5 changed files with 55 additions and 13 deletions
+24 -4
View File
@@ -322,6 +322,12 @@ function mountHouseEditor(container, callbacks) {
// Opgeslagen camerastand gaat voor; anders eenmalig passend maken.
let cameraFitted = CameraMemory.restore(overviewCamKey, camera, controls);
let beplatingVisible = true, lampenVisible = true;
// Vloerplan: alle wanden afgesneden op VLOERPLAN_CUT_MM boven het loopvlak
// (clipping-vlak, doorsnede blijft open); dak en lampen uit.
const VLOERPLAN_CUT_MM = 500;
let vloerplan = false;
const cutPlane = new THREE.Plane(new THREE.Vector3(0, -1, 0), 0);
renderer.localClippingEnabled = true;
let fullRender = false;
let skyMode = Skybox.getMode();
const skyEnv = Skybox.createEnvironment(scene);
@@ -331,11 +337,13 @@ function mountHouseEditor(container, callbacks) {
createViewFilter(document.getElementById('ho-toolbar-3d'), [
{ key: 'beplating', label: 'Beplating' },
{ key: 'dak', label: 'Dak' },
{ key: 'lampen', label: 'Lampen' }
{ key: 'lampen', label: 'Lampen' },
{ key: 'vloerplan', label: 'Vloerplan', checked: false }
], (v) => {
beplatingVisible = v.beplating;
dakVisible = v.dak;
lampenVisible = v.lampen;
vloerplan = v.vloerplan;
refresh({ keepProps: true });
});
@@ -354,7 +362,7 @@ function mountHouseEditor(container, callbacks) {
if (lightsGroup) { scene.remove(lightsGroup); lightsGroup = null; }
// De nep-lichtbundels (kegels) alleen zonder echte lampen.
if (parts && parts.lightingGroup) parts.lightingGroup.traverse(o => { if (o.userData.beam) o.visible = !lampsOn; });
if (lampsOn && parts && lampenVisible) {
if (lampsOn && parts && lampenVisible && !vloerplan) {
const edge = dakVisible ? parts.roofEdge : null;
lightsGroup = LightingModel.buildLights3D(parts.lighting.lamps, edge ? edge.spots : [], edge ? edge.top - edge.fasciaHeight : 0, parts.lighting.indoor, {
outdoorFactor: skyMode === 'night' ? 1 : LightingModel.DAY_OUTDOOR_FACTOR
@@ -919,12 +927,24 @@ function mountHouseEditor(container, callbacks) {
u.floorGroup.position.set(u.rect.cx * toM, 0, u.rect.cz * toM);
houseGroup.add(u.floorGroup);
});
// Vloerplan: snijvlak op het (hoogste) loopvlak + VLOERPLAN_CUT_MM. De
// wandmaterialen worden gedeeld, dus altijd zetten (ook weer uit).
cutPlane.constant = (Math.max(...parts.units.map(u => u.layout.floorTop)) + VLOERPLAN_CUT_MM) * toM;
const clip = vloerplan ? [cutPlane] : [];
HouseModel.allWallPieces(parts).forEach(p => {
p.group.rotation.y = p.place.rotY;
p.group.position.set(p.place.cx * toM, p.place.floorTop * toM, p.place.cz * toM);
p.group.traverse(o => {
if (!o.material) return;
(Array.isArray(o.material) ? o.material : [o.material]).forEach(m => {
if (m.clippingPlanes && m.clippingPlanes.length === clip.length) return;
m.clippingPlanes = clip;
m.needsUpdate = true;
});
});
houseGroup.add(p.group);
});
if (dakVisible) {
if (dakVisible && !vloerplan) {
parts.units.forEach(u => {
u.roof.group.position.set(u.roof.rect.cx * toM, u.roof.base * toM, u.roof.rect.cz * toM);
houseGroup.add(u.roof.group);
@@ -932,7 +952,7 @@ function mountHouseEditor(container, callbacks) {
if (parts.roofEdgeGroup) houseGroup.add(parts.roofEdgeGroup);
}
if (parts.sandwichGroup) houseGroup.add(parts.sandwichGroup);
if (parts.lightingGroup) houseGroup.add(parts.lightingGroup);
if (parts.lightingGroup && !vloerplan) houseGroup.add(parts.lightingGroup);
scene.add(houseGroup);
const bx0 = Math.min(...parts.rects.map(r => r.x0)), bx1 = Math.max(...parts.rects.map(r => r.x1));