Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
release: SnapCAD Studio 1.0.11 (Mimari BIM & Metraj Studyosu, IFC4 ihraci, canli guncelleme ilerlemesi, YakNet SSO iyilestirmesi)
Build and Push Docker Images / build (push) Canceled after 0s
Desktop Release / Build linux desktop (push) Canceled after 0s
Desktop Release / Build windows desktop (push) Canceled after 0s
Desktop Release / Attach packages to release (push) Canceled after 0s
CI / Typecheck and unit tests (push) Canceled after 0s
Desktop Release / Build macos desktop (push) Canceled after 0s
Build and Push Docker Images / build (push) Canceled after 0s
Desktop Release / Build linux desktop (push) Canceled after 0s
Desktop Release / Build windows desktop (push) Canceled after 0s
Desktop Release / Attach packages to release (push) Canceled after 0s
CI / Typecheck and unit tests (push) Canceled after 0s
Desktop Release / Build macos desktop (push) Canceled after 0s
This commit is contained in:
@@ -1,15 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import React, { useState, useId } from "react";
|
||||
import React, { useState } from "react";
|
||||
import { Mountain, X, Sparkles } from "lucide-react";
|
||||
import {
|
||||
Mountain,
|
||||
X,
|
||||
Sparkles,
|
||||
Layers,
|
||||
Check,
|
||||
Sliders,
|
||||
} from "lucide-react";
|
||||
import { createLocalId } from "@/lib/localIds";
|
||||
generateAdvancedTerrainWithPad,
|
||||
type TerrainTopographyPreset,
|
||||
} from "@/lib/architecturalBimEngine";
|
||||
import type { WorkplaneShape, ArchitecturalTextureId } from "@/types/sketchforge";
|
||||
|
||||
export interface TerrainGeneratorModalProps {
|
||||
@@ -18,131 +14,35 @@ export interface TerrainGeneratorModalProps {
|
||||
onAddShape: (shape: WorkplaneShape) => void;
|
||||
}
|
||||
|
||||
type TerrainPreset = "hills" | "slope" | "terrace" | "valley";
|
||||
|
||||
export const TerrainGeneratorModal: React.FC<TerrainGeneratorModalProps> = ({
|
||||
isOpen,
|
||||
onClose,
|
||||
onAddShape,
|
||||
}) => {
|
||||
const baseId = useId();
|
||||
const [preset, setPreset] = useState<TerrainPreset>("hills");
|
||||
const [preset, setPreset] = useState<TerrainTopographyPreset>("hills");
|
||||
const [width, setWidth] = useState(200);
|
||||
const [depth, setDepth] = useState(200);
|
||||
const [maxHeight, setMaxHeight] = useState(18);
|
||||
const [texture, setTexture] = useState<ArchitecturalTextureId>("grass");
|
||||
const [includeBuildingPad, setIncludeBuildingPad] = useState(true);
|
||||
|
||||
if (!isOpen) return null;
|
||||
|
||||
const previewResult = generateAdvancedTerrainWithPad({
|
||||
preset,
|
||||
width,
|
||||
depth,
|
||||
maxHeight,
|
||||
gridResolution: 16,
|
||||
texture,
|
||||
includeBuildingPad,
|
||||
});
|
||||
|
||||
const handleGenerate = () => {
|
||||
// Generate grid vertices (e.g. 16x16 grid for clean performance)
|
||||
const segments = 16;
|
||||
const halfW = width / 2;
|
||||
const halfD = depth / 2;
|
||||
const positions: number[] = [];
|
||||
const normals: number[] = [];
|
||||
|
||||
// Height function based on preset
|
||||
const getHeight = (u: number, v: number) => {
|
||||
// u, v in [0, 1]
|
||||
if (preset === "hills") {
|
||||
return (
|
||||
Math.sin(u * Math.PI * 2) * Math.cos(v * Math.PI * 2) * maxHeight * 0.5 +
|
||||
Math.sin(u * Math.PI * 4 + v * 2) * (maxHeight * 0.25) +
|
||||
maxHeight * 0.5
|
||||
);
|
||||
}
|
||||
if (preset === "slope") {
|
||||
return u * maxHeight + Math.sin(v * Math.PI * 3) * (maxHeight * 0.15);
|
||||
}
|
||||
if (preset === "valley") {
|
||||
const distFromCenter = Math.abs(u - 0.5) * 2;
|
||||
return distFromCenter * distFromCenter * maxHeight;
|
||||
}
|
||||
// terrace
|
||||
const stepped = Math.floor(u * 4) / 4;
|
||||
return stepped * maxHeight;
|
||||
};
|
||||
|
||||
const getNormal = (u: number, v: number) => {
|
||||
const eps = 0.01;
|
||||
const hL = getHeight(Math.max(0, u - eps), v);
|
||||
const hR = getHeight(Math.min(1, u + eps), v);
|
||||
const hD = getHeight(u, Math.max(0, v - eps));
|
||||
const hU = getHeight(u, Math.min(1, v + eps));
|
||||
const dx = (hR - hL) / (2 * eps * width);
|
||||
const dz = (hU - hD) / (2 * eps * depth);
|
||||
const len = Math.sqrt(dx * dx + 1 + dz * dz);
|
||||
return [-dx / len, 1 / len, -dz / len];
|
||||
};
|
||||
|
||||
// Build triangles
|
||||
for (let i = 0; i < segments; i++) {
|
||||
for (let j = 0; j < segments; j++) {
|
||||
const u0 = i / segments;
|
||||
const u1 = (i + 1) / segments;
|
||||
const v0 = j / segments;
|
||||
const v1 = (j + 1) / segments;
|
||||
|
||||
const x0 = -halfW + u0 * width;
|
||||
const x1 = -halfW + u1 * width;
|
||||
const z0 = -halfD + v0 * depth;
|
||||
const z1 = -halfD + v1 * depth;
|
||||
|
||||
const y00 = getHeight(u0, v0);
|
||||
const y10 = getHeight(u1, v0);
|
||||
const y01 = getHeight(u0, v1);
|
||||
const y11 = getHeight(u1, v1);
|
||||
|
||||
const n00 = getNormal(u0, v0);
|
||||
const n10 = getNormal(u1, v0);
|
||||
const n01 = getNormal(u0, v1);
|
||||
const n11 = getNormal(u1, v1);
|
||||
|
||||
// Triangle 1: (0,0), (1,0), (0,1)
|
||||
positions.push(x0, y00, z0, x1, y10, z0, x0, y01, z1);
|
||||
normals.push(...n00, ...n10, ...n01);
|
||||
|
||||
// Triangle 2: (1,0), (1,1), (0,1)
|
||||
positions.push(x1, y10, z0, x1, y11, z1, x0, y01, z1);
|
||||
normals.push(...n10, ...n11, ...n01);
|
||||
}
|
||||
onAddShape(previewResult.terrainShape);
|
||||
if (previewResult.padShape) {
|
||||
onAddShape(previewResult.padShape);
|
||||
}
|
||||
|
||||
const terrainShape: WorkplaneShape = {
|
||||
id: createLocalId("terrain"),
|
||||
name:
|
||||
preset === "hills"
|
||||
? "Dalgalı Tepe Arazisi"
|
||||
: preset === "slope"
|
||||
? "Eğimli Arsa"
|
||||
: preset === "valley"
|
||||
? "Vadi Arazisi"
|
||||
: "Teraslı Arsa",
|
||||
kind: "mesh",
|
||||
color: texture === "grass" ? "#22c55e" : "#64748b",
|
||||
texture,
|
||||
tag: "Arazi / Topoğrafya",
|
||||
x: 0,
|
||||
z: 0,
|
||||
elevation: 0,
|
||||
size: Math.max(width, depth),
|
||||
width,
|
||||
depth,
|
||||
height: Math.max(5, maxHeight),
|
||||
rotation: 0,
|
||||
importedMesh: {
|
||||
positions,
|
||||
normals,
|
||||
baseWidth: width,
|
||||
baseDepth: depth,
|
||||
baseHeight: maxHeight,
|
||||
triangleCount: positions.length / 9,
|
||||
sourceFormat: "json",
|
||||
},
|
||||
};
|
||||
|
||||
onAddShape(terrainShape);
|
||||
onClose();
|
||||
};
|
||||
|
||||
@@ -168,7 +68,7 @@ export const TerrainGeneratorModal: React.FC<TerrainGeneratorModalProps> = ({
|
||||
Arazi & Topoğrafya Oluşturucu
|
||||
</h2>
|
||||
<p className="text-xs text-slate-500 dark:text-slate-400">
|
||||
Binanızı kot farkı ve eğimli araziye oturtun
|
||||
Simplex-Noise + Delaunator üçgenleme ve bina oturum hafriyat hesabı
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -191,15 +91,16 @@ export const TerrainGeneratorModal: React.FC<TerrainGeneratorModalProps> = ({
|
||||
</label>
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
{[
|
||||
{ id: "hills", label: "Dalgalı Tepe", desc: "Doğal yükseltiler" },
|
||||
{ id: "hills", label: "Dalgalı Tepe", desc: "Simplex doğal yükseltiler" },
|
||||
{ id: "slope", label: "Eğimli Arsa", desc: "Tek yöne meyil" },
|
||||
{ id: "terrace", label: "Teraslı Plato", desc: "Kademeli kotlar" },
|
||||
{ id: "valley", label: "Vadi / Çukur", desc: "Ortası alçak" },
|
||||
{ id: "terrace", label: "Teraslı Plato", desc: "Eşyükselti kademeli kotlar" },
|
||||
{ id: "valley", label: "Vadi / Çukur", desc: "Ortası alçak vadi" },
|
||||
{ id: "coastal-ridge", label: "Kıyı Sırtı", desc: "Yamaç ve sırt hattı" },
|
||||
].map((item) => (
|
||||
<button
|
||||
key={item.id}
|
||||
type="button"
|
||||
onClick={() => setPreset(item.id as TerrainPreset)}
|
||||
onClick={() => setPreset(item.id as TerrainTopographyPreset)}
|
||||
className={`flex flex-col items-start rounded-xl border p-2.5 text-left transition-all ${
|
||||
preset === item.id
|
||||
? "border-emerald-500 bg-emerald-50/70 text-emerald-900 dark:bg-emerald-950/40 dark:text-emerald-200"
|
||||
@@ -246,6 +147,32 @@ export const TerrainGeneratorModal: React.FC<TerrainGeneratorModalProps> = ({
|
||||
onChange={(e) => setMaxHeight(Number(e.target.value))}
|
||||
className="w-full accent-emerald-600"
|
||||
/>
|
||||
|
||||
<label className="flex items-center justify-between pt-2 text-xs font-medium text-slate-700 dark:text-slate-200 cursor-pointer">
|
||||
<span>Bina Oturum Düzlüğü (Tesviye Kotu & Hafriyat)</span>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={includeBuildingPad}
|
||||
onChange={(e) => setIncludeBuildingPad(e.target.checked)}
|
||||
className="h-4 w-4 accent-emerald-600"
|
||||
/>
|
||||
</label>
|
||||
{includeBuildingPad ? (
|
||||
<div className="grid grid-cols-3 gap-2 pt-1 text-center text-[11px]">
|
||||
<div className="rounded-lg bg-white p-1.5 dark:bg-slate-800">
|
||||
<span className="block text-slate-400">Kazı (Hafriyat)</span>
|
||||
<strong className="text-amber-600 dark:text-amber-400">{previewResult.excavationCutVolumeM3} m³</strong>
|
||||
</div>
|
||||
<div className="rounded-lg bg-white p-1.5 dark:bg-slate-800">
|
||||
<span className="block text-slate-400">Dolgu Hacmi</span>
|
||||
<strong className="text-sky-600 dark:text-sky-400">{previewResult.embankmentFillVolumeM3} m³</strong>
|
||||
</div>
|
||||
<div className="rounded-lg bg-white p-1.5 dark:bg-slate-800">
|
||||
<span className="block text-slate-400">Delaunay Ağ</span>
|
||||
<strong className="text-emerald-600 dark:text-emerald-400">{previewResult.triangleCount} üçgen</strong>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{/* Texture */}
|
||||
|
||||
Reference in New Issue
Block a user