moved to full client

This commit is contained in:
Andreas Wilms
2026-03-09 16:12:01 +01:00
parent 8a1f133e50
commit 7293839a19
5 changed files with 149 additions and 676 deletions

View File

@@ -49,66 +49,29 @@ export default function XgridsWizard() {
const startPipeline = async () => {
if (!files.length || !workerRef.current) return;
// FIND SPECIFIC ENTRIES
const lciFile = files.find((f) => f.name.toLowerCase() === "collision.lci");
const lccFile = files.find((f) => f.name.toLowerCase().endsWith(".lcc"));
if (!lciFile) {
setStatus("Error: 'collision.lci' not found in folder.");
return;
}
if (!lccFile) {
setStatus("Error: Main '.lcc' scene file not found.");
return;
}
setIsProcessing(true);
setStatus("Preparing files for Worker...");
try {
// --- PHASE 1: Python (Only collision.lci) ---
setStatus("Step 1/2: Converting collision.lci to PLY...");
const formData = new FormData();
formData.append("file", lciFile);
const mainLcc = files.find((f) => f.name.toLowerCase().endsWith(".lcc"));
const pyResponse = await fetch("/api/convert", {
method: "POST",
body: formData,
});
const filesData = await Promise.all(
files.map(async (f) => ({
name: f.name,
buffer: await f.arrayBuffer(),
})),
);
if (!pyResponse.ok) {
const err = await pyResponse.json();
throw new Error(err.error || "Python script failed");
}
const plyBlob = await pyResponse.blob();
downloadFile(plyBlob, "collision_mesh.ply");
// --- PHASE 2: Worker (The whole folder context) ---
setStatus("Step 2/2: Generating Splats and LODs from .lcc...");
const filesData = await Promise.all(
files.map(async (f) => ({
name: f.name,
buffer: await f.arrayBuffer(),
})),
);
const buffersToTransfer = filesData.map((f) => f.buffer);
workerRef.current.postMessage(
{
type: "START_CONVERSION",
filesData,
mainLccName: lccFile.name,
fileName: lccFile.name.replace(".lcc", ""),
},
buffersToTransfer,
);
} catch (error: any) {
console.error(error);
setStatus(`Error: ${error.message}`);
setIsProcessing(false);
}
// Send EVERYTHING to the worker.
// The worker will now handle Collision, Environment, SOG, and LODs.
workerRef.current.postMessage(
{
type: "START_CONVERSION",
filesData,
mainLccName: mainLcc?.name,
fileName: mainLcc?.name.replace(".lcc", ""),
},
filesData.map((f) => f.buffer),
);
};
return (
@@ -161,4 +124,4 @@ export default function XgridsWizard() {
</div>
</main>
);
}
}