[290] Linux-App: Plan-Schatten mit Soll-Deckkraft (Szene liess Flächen-opacity weg), 3D zeichnet nur auf Anforderung (höchstens einmal je Frame), WebGPU-Adapter in Log und Über-Dialog
This commit is contained in:
16 files changed
+414
-26
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describeAdapter, isSoftwareAdapter, summarizeAdapter } from "./gpuAdapterInfo";
|
||||
|
||||
describe("[290] WebGPU-Adapter", () => {
|
||||
it("SwiftShader/llvmpipe/Fallback gelten als Software", () => {
|
||||
expect(isSoftwareAdapter({ vendor: "google", architecture: "swiftshader" })).toBe(true);
|
||||
expect(isSoftwareAdapter({ vendor: "mesa", description: "llvmpipe (LLVM 15.0.7, 256 bits)" })).toBe(true);
|
||||
expect(isSoftwareAdapter({ vendor: "amd", architecture: "rdna-3" }, true)).toBe(true);
|
||||
expect(isSoftwareAdapter({ vendor: "amd", architecture: "rdna-3", description: "AMD Radeon RX 7800 XT" })).toBe(false);
|
||||
});
|
||||
|
||||
it("Kurztext", () => {
|
||||
expect(describeAdapter(summarizeAdapter({ vendor: "amd", architecture: "rdna-3", description: "AMD Radeon RX 7800 XT" }))).toBe("amd rdna-3 (AMD Radeon RX 7800 XT)");
|
||||
expect(describeAdapter(summarizeAdapter({ vendor: "apple", architecture: "metal-3" }))).toBe("apple metal-3");
|
||||
expect(describeAdapter(summarizeAdapter({}))).toBe("");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,75 @@
|
||||
// [290] Welcher WebGPU-Adapter zeichnet? Unter Linux/Electron (und im Browser) kann Chromium ohne Vulkan-Freigabe oder
|
||||
// bei gesperrtem Treiber auf SwiftShader (Software, CPU) ausweichen — dann läuft das 3D auf dem Prozessor und der Rechner
|
||||
// „schwitzt“. Einmal beim Start abgefragt, in die Konsole geschrieben und im Über-Dialog gezeigt.
|
||||
|
||||
export interface GpuAdapterSummary {
|
||||
vendor: string;
|
||||
architecture: string;
|
||||
device: string;
|
||||
description: string;
|
||||
/** Software-Adapter (SwiftShader, llvmpipe, Fallback): 3D auf der CPU. */
|
||||
software: boolean;
|
||||
}
|
||||
|
||||
interface AdapterInfoLike {
|
||||
vendor?: string;
|
||||
architecture?: string;
|
||||
device?: string;
|
||||
description?: string;
|
||||
isFallbackAdapter?: boolean;
|
||||
}
|
||||
|
||||
/** Software-Rasterer erkennen (Chromium meldet SwiftShader als vendor „google“, architecture „swiftshader“). */
|
||||
export function isSoftwareAdapter(info: AdapterInfoLike, fallback = false): boolean {
|
||||
if (fallback || info.isFallbackAdapter) return true;
|
||||
const s = `${info.vendor ?? ""} ${info.architecture ?? ""} ${info.device ?? ""} ${info.description ?? ""}`.toLowerCase();
|
||||
return /swiftshader|llvmpipe|lavapipe|softpipe|software|microsoft basic render/.test(s);
|
||||
}
|
||||
|
||||
export function summarizeAdapter(info: AdapterInfoLike, fallback = false): GpuAdapterSummary {
|
||||
return {
|
||||
vendor: info.vendor ?? "",
|
||||
architecture: info.architecture ?? "",
|
||||
device: info.device ?? "",
|
||||
description: info.description ?? "",
|
||||
software: isSoftwareAdapter(info, fallback),
|
||||
};
|
||||
}
|
||||
|
||||
/** Kurzer Text wie „amd rdna-3 (AMD Radeon RX 7800 XT)“; leer, wenn der Browser nichts verrät. */
|
||||
export function describeAdapter(a: GpuAdapterSummary): string {
|
||||
const head = [a.vendor, a.architecture].filter(Boolean).join(" ");
|
||||
const detail = a.description || a.device;
|
||||
return detail && detail !== head ? (head ? `${head} (${detail})` : detail) : head;
|
||||
}
|
||||
|
||||
let cached: Promise<GpuAdapterSummary | null> | null = null;
|
||||
|
||||
/** Adapter der Seite (einmal abgefragt); `null` ohne WebGPU. */
|
||||
export function gpuAdapterSummary(): Promise<GpuAdapterSummary | null> {
|
||||
if (cached) return cached;
|
||||
cached = (async () => {
|
||||
try {
|
||||
const gpu = (navigator as Navigator & { gpu?: { requestAdapter(o?: unknown): Promise<unknown> } }).gpu;
|
||||
if (!gpu) return null;
|
||||
const adapter = (await gpu.requestAdapter({ powerPreference: "high-performance" })) as
|
||||
| { info?: AdapterInfoLike; isFallbackAdapter?: boolean; requestAdapterInfo?: () => Promise<AdapterInfoLike> }
|
||||
| null;
|
||||
if (!adapter) return null;
|
||||
const info = adapter.info ?? (await adapter.requestAdapterInfo?.()) ?? {};
|
||||
return summarizeAdapter(info, !!adapter.isFallbackAdapter);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
})();
|
||||
return cached;
|
||||
}
|
||||
|
||||
/** Beim Start einmal in die Konsole (Electron gibt die Renderer-Konsole nicht aus; Über-Dialog zeigt es auch). */
|
||||
export function logGpuAdapter(): void {
|
||||
void gpuAdapterSummary().then((a) => {
|
||||
if (!a) console.warn("[dossier] WebGPU: kein Adapter — 2D/3D über Ersatzwege");
|
||||
else if (a.software) console.warn(`[dossier] WebGPU-Adapter: ${describeAdapter(a)} — SOFTWARE (CPU), 3D belastet den Prozessor`);
|
||||
else console.info(`[dossier] WebGPU-Adapter: ${describeAdapter(a)}`);
|
||||
});
|
||||
}
|
||||
@@ -3397,6 +3397,9 @@ export const de = {
|
||||
"about.title": "Über dossier",
|
||||
"about.version": "Version",
|
||||
"about.build": "Build",
|
||||
"about.gpu": "Grafik (WebGPU):",
|
||||
"about.gpuSoftware": "Software/CPU – 3D belastet den Prozessor",
|
||||
"about.gpuNone": "kein WebGPU",
|
||||
"status.build.title": "Interne Buildnummer (JJMMTT.N) — bei jeder Fehlermeldung angeben",
|
||||
"about.desc": "Open Source Computer Aided Architecture Design — 2D-Vektordesign sowie normgerechte Pläne aus einem semantischen Gebäudemodell.",
|
||||
"about.copyright": "© 2026 Karim Gabriele Varano",
|
||||
|
||||
@@ -3384,6 +3384,9 @@ export const en: Record<TranslationKey, string> = {
|
||||
"about.title": "About dossier",
|
||||
"about.version": "Version",
|
||||
"about.build": "Build",
|
||||
"about.gpu": "Graphics (WebGPU):",
|
||||
"about.gpuSoftware": "software/CPU – 3D loads the processor",
|
||||
"about.gpuNone": "no WebGPU",
|
||||
"status.build.title": "Internal build number (YYMMDD.N) — include it with every bug report",
|
||||
"about.desc": "Open Source Computer Aided Architecture Design — 2D vector design plus standards-compliant drawings from a semantic building model.",
|
||||
"about.copyright": "© 2026 Karim Gabriele Varano",
|
||||
|
||||
@@ -14,6 +14,7 @@ import { RenderWindowApp } from "./native/RenderWindowApp";
|
||||
import { ErrorBoundary } from "./ui/ErrorBoundary";
|
||||
import { LanguageRoot } from "./i18n/LanguageRoot";
|
||||
import { initCore } from "./core";
|
||||
import { logGpuAdapter } from "./engine/gpuAdapterInfo";
|
||||
import { applyLanguagePref, getLanguage, getStoredLanguagePref, setLanguage } from "./i18n";
|
||||
import type { Language } from "./i18n";
|
||||
import { applyThemeMode, getStoredThemeMode } from "./theme/themeMode";
|
||||
@@ -106,6 +107,7 @@ const root = createRoot(document.getElementById("root")!);
|
||||
const testHooks = new URLSearchParams(window.location.search).has("dossierTest")
|
||||
? import("./state/testHooks").then((m) => m.installTestHooks())
|
||||
: Promise.resolve();
|
||||
if (!windowKind) logGpuAdapter(); // [290] tatsächlicher WebGPU-Adapter (Hardware oder Software/CPU) in die Konsole
|
||||
initCore()
|
||||
.then(() => testHooks)
|
||||
.then(() =>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
import { platformName } from "../state/platform";
|
||||
import { setAboutDialogOpener } from "../state/aboutDialogHook";
|
||||
import { describeAdapter, gpuAdapterSummary } from "../engine/gpuAdapterInfo";
|
||||
import { TEXT_FONTS } from "../text/fontList";
|
||||
import { t } from "../i18n";
|
||||
import { useModalFocus } from "./modalFocus";
|
||||
@@ -922,6 +923,11 @@ function AboutDialog({ onClose }: { onClose: () => void }) {
|
||||
useEffect(() => {
|
||||
void getRunningVersion().then(setRunningVersion);
|
||||
}, []);
|
||||
// [290] Tatsächlicher WebGPU-Adapter: zeigt, ob 3D auf der Grafikkarte oder in Software (CPU) läuft.
|
||||
const [gpu, setGpu] = useState<string | null>(null);
|
||||
useEffect(() => {
|
||||
void gpuAdapterSummary().then((a) => setGpu(!a ? t("about.gpuNone") : `${describeAdapter(a) || "?"}${a.software ? ` — ${t("about.gpuSoftware")}` : ""}`));
|
||||
}, []);
|
||||
const dialogRef = useModalFocus({});
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
@@ -953,6 +959,11 @@ function AboutDialog({ onClose }: { onClose: () => void }) {
|
||||
<div className="about-version">
|
||||
{t("about.version")} {formatBuildInfo({ ...BUILD_INFO, version: runningVersion ?? APP_VERSION }, t("about.build"))}
|
||||
</div>
|
||||
{gpu && (
|
||||
<div className="about-version" data-testid="about-gpu">
|
||||
{t("about.gpu")} {gpu}
|
||||
</div>
|
||||
)}
|
||||
<p className="about-desc">{t("about.desc")}</p>
|
||||
<div className="about-meta">
|
||||
<div>{t("about.copyright")}</div>
|
||||
|
||||
@@ -141,6 +141,22 @@ interface Grip {
|
||||
pos: Vec3;
|
||||
}
|
||||
|
||||
/** [290] Gleiche Griff-Bildschirmpositionen (Art, Ziel, Index, Pixel)? Dann bleibt der React-Zustand stehen. */
|
||||
function sameGripScreens(a: readonly { grip: Grip; x: number; y: number }[], b: readonly { grip: Grip; x: number; y: number }[]): boolean {
|
||||
if (a.length !== b.length) return false;
|
||||
for (let i = 0; i < a.length; i++) {
|
||||
const p = a[i];
|
||||
const q = b[i];
|
||||
const t = p.grip.target;
|
||||
const u = q.grip.target;
|
||||
if (p.x !== q.x || p.y !== q.y || p.grip.kind !== q.grip.kind || p.grip.index !== q.grip.index || p.grip.index2 !== q.grip.index2) return false;
|
||||
if (t.wallId !== u.wallId || t.drawingId !== u.drawingId || t.ceilingId !== u.ceilingId || t.roofId !== u.roofId) return false;
|
||||
const [x, y, z] = p.grip.pos;
|
||||
if (x !== q.grip.pos[0] || y !== q.grip.pos[1] || z !== q.grip.pos[2]) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Gauben-Griffe: erster Index (Kern `grips.rs::DORMER_GRIP_BASE`). */
|
||||
const DORMER_GRIP_BASE = 1000;
|
||||
|
||||
@@ -981,7 +997,8 @@ export function Wasm3DViewport({
|
||||
const p = worldToScreen(cam, g.pos, rect.width, rect.height);
|
||||
if (p) next.push({ grip: g, x: p.x, y: p.y });
|
||||
}
|
||||
setGripScreens(next);
|
||||
// [290] Nur bei Änderung setzen: sonst rendert React den ganzen Viewport in jedem Frame neu, solange Griffe aktiv sind.
|
||||
setGripScreens((prev) => (sameGripScreens(prev, next) ? prev : next));
|
||||
}
|
||||
}
|
||||
raf = requestAnimationFrame(tick);
|
||||
@@ -1033,7 +1050,7 @@ export function Wasm3DViewport({
|
||||
const planeY = drag && "planeY" in drag ? drag.planeY : groundElevationRef.current;
|
||||
const world: Vec3 = [hud.at.x, planeY, hud.at.y];
|
||||
const p = worldToScreen(cam, world, rect.width, rect.height);
|
||||
setDraftHudScreen(p);
|
||||
setDraftHudScreen((prev) => (prev && p && prev.x === p.x && prev.y === p.y ? prev : p)); // [290] nur bei Änderung
|
||||
}
|
||||
} else {
|
||||
setDraftHudScreen(null);
|
||||
@@ -1053,7 +1070,8 @@ export function Wasm3DViewport({
|
||||
axis === "x" ? [anchor.x + EXTEND, planeY, anchor.y] : [anchor.x, planeY, anchor.y + EXTEND];
|
||||
const p1 = worldToScreen(cam, a, rect.width, rect.height);
|
||||
const p2 = worldToScreen(cam, b, rect.width, rect.height);
|
||||
setAxisLockGuideScreen(p1 && p2 ? { x1: p1.x, y1: p1.y, x2: p2.x, y2: p2.y, axis } : null);
|
||||
const g = p1 && p2 ? { x1: p1.x, y1: p1.y, x2: p2.x, y2: p2.y, axis } : null;
|
||||
setAxisLockGuideScreen((prev) => (prev && g && prev.x1 === g.x1 && prev.y1 === g.y1 && prev.x2 === g.x2 && prev.y2 === g.y2 && prev.axis === g.axis ? prev : g));
|
||||
}
|
||||
} else {
|
||||
setAxisLockGuideScreen(null);
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { FrameScheduler, countFrame, frameCounters } from "./renderOnDemand";
|
||||
|
||||
function fakeRaf() {
|
||||
const q = new Map<number, (t: number) => void>();
|
||||
let next = 1;
|
||||
return {
|
||||
raf: (cb: (t: number) => void) => {
|
||||
q.set(next, cb);
|
||||
return next++;
|
||||
},
|
||||
caf: (id: number) => void q.delete(id),
|
||||
tick() {
|
||||
const cbs = [...q.values()];
|
||||
q.clear();
|
||||
for (const cb of cbs) cb(0);
|
||||
},
|
||||
get size() {
|
||||
return q.size;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
describe("[290] FrameScheduler: zeichnen nur auf Anforderung", () => {
|
||||
it("viele Anforderungen im selben Bildschirm-Frame zeichnen einmal", () => {
|
||||
const f = fakeRaf();
|
||||
let n = 0;
|
||||
const s = new FrameScheduler(() => n++, f.raf, f.caf);
|
||||
for (let i = 0; i < 1000; i++) s.request(); // z. B. 1000-Hz-Maus beim Drehen
|
||||
expect(s.pending).toBe(true);
|
||||
f.tick();
|
||||
expect(n).toBe(1);
|
||||
expect(s.pending).toBe(false);
|
||||
});
|
||||
|
||||
it("ohne Anforderung keine Schleife und keine Frames", () => {
|
||||
const f = fakeRaf();
|
||||
let n = 0;
|
||||
const s = new FrameScheduler(() => n++, f.raf, f.caf);
|
||||
s.request();
|
||||
f.tick();
|
||||
for (let i = 0; i < 10; i++) f.tick();
|
||||
expect(n).toBe(1);
|
||||
expect(f.size).toBe(0);
|
||||
});
|
||||
|
||||
it("flush zeichnet sofort, cancel verwirft", () => {
|
||||
const f = fakeRaf();
|
||||
let n = 0;
|
||||
const s = new FrameScheduler(() => n++, f.raf, f.caf);
|
||||
s.flush();
|
||||
expect(n).toBe(0);
|
||||
s.request();
|
||||
s.flush();
|
||||
expect(n).toBe(1);
|
||||
f.tick();
|
||||
expect(n).toBe(1);
|
||||
s.request();
|
||||
s.cancel();
|
||||
f.tick();
|
||||
expect(n).toBe(1);
|
||||
});
|
||||
|
||||
it("Frame-Zähler", () => {
|
||||
const before = frameCounters()["3d"];
|
||||
countFrame("3d");
|
||||
expect(frameCounters()["3d"]).toBe(before + 1);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,61 @@
|
||||
// [290] Zeichnen nur auf Anforderung: Jede Änderung (Kamera, Modell, Sonne, Hervorhebung …) MELDET einen Frame an,
|
||||
// gezeichnet wird höchstens einmal je Bildschirm-Frame (requestAnimationFrame). Vorher zeichnete der 3D-Viewport bei
|
||||
// jedem Aufruf sofort — eine Maus mit 1000 Hz Abtastrate löste beim Drehen bis zu 1000 GPU-Frames je Sekunde aus, und
|
||||
// eine Änderung, die mehrere Effekte berührt, zeichnete mehrfach hintereinander. Ohne Anforderung läuft keine Schleife;
|
||||
// im Hintergrund/minimiert ruft der Browser rAF nicht auf, es wird also auch nicht gezeichnet.
|
||||
|
||||
type Raf = (cb: (t: number) => void) => number;
|
||||
type Caf = (id: number) => void;
|
||||
|
||||
/** Gezeichnete Frames je Ansicht — Prüf-Hook für e2e (`window.__dossierFrames`), keine Logik hängt daran. */
|
||||
export interface FrameCounters {
|
||||
"3d": number;
|
||||
"2d": number;
|
||||
}
|
||||
|
||||
export function frameCounters(): FrameCounters {
|
||||
const g = globalThis as unknown as { __dossierFrames?: FrameCounters };
|
||||
if (!g.__dossierFrames) g.__dossierFrames = { "3d": 0, "2d": 0 };
|
||||
return g.__dossierFrames;
|
||||
}
|
||||
|
||||
export function countFrame(kind: keyof FrameCounters): void {
|
||||
frameCounters()[kind] += 1;
|
||||
}
|
||||
|
||||
export class FrameScheduler {
|
||||
private id: number | null = null;
|
||||
|
||||
constructor(
|
||||
private readonly draw: () => void,
|
||||
private readonly raf: Raf = (cb) => requestAnimationFrame(cb),
|
||||
private readonly caf: Caf = (id) => cancelAnimationFrame(id),
|
||||
) {}
|
||||
|
||||
/** Ist ein Frame angemeldet, aber noch nicht gezeichnet? */
|
||||
get pending(): boolean {
|
||||
return this.id !== null;
|
||||
}
|
||||
|
||||
/** Einen Frame anmelden; mehrere Anmeldungen vor dem nächsten Bildschirm-Frame ergeben EINEN Zeichenaufruf. */
|
||||
request(): void {
|
||||
if (this.id !== null) return;
|
||||
this.id = this.raf(() => {
|
||||
this.id = null;
|
||||
this.draw();
|
||||
});
|
||||
}
|
||||
|
||||
/** Angemeldeten Frame sofort zeichnen (wer gleich danach die Leinwand ausliest, z. B. Vorschaubild). */
|
||||
flush(): void {
|
||||
if (this.id === null) return;
|
||||
this.caf(this.id);
|
||||
this.id = null;
|
||||
this.draw();
|
||||
}
|
||||
|
||||
cancel(): void {
|
||||
if (this.id !== null) this.caf(this.id);
|
||||
this.id = null;
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import { decodeImageToRgba } from "../io/swissImage";
|
||||
import { planPointCloudSync } from "./pointCloudSync";
|
||||
import { PT_EXPORT_MAX_PIXELS, clampImageSize, exportSamples, isBlankImage, matteFromBlackWhite, renderPathtraceChunks, type ExportProgress } from "./imageExport";
|
||||
import type { PointCloudSyncItem, UploadedPointCloud } from "./pointCloudSync";
|
||||
import { FrameScheduler, countFrame } from "./renderOnDemand";
|
||||
|
||||
/** Fertige Kamera für einen Frame (world-Meter, Y-up — wie render3d::types::Camera). */
|
||||
export interface Camera3d {
|
||||
@@ -707,6 +708,7 @@ export function useWasm3dRenderer(
|
||||
const canvas = canvasRef.current;
|
||||
if (!canvas || !rendererRef.current || canvas.width < 1 || canvas.height < 1) return null;
|
||||
draw();
|
||||
schedulerRef.current?.flush(); // [290] angemeldeten Frame jetzt zeichnen, gleich danach wird ausgelesen
|
||||
const k = Math.min(1, Math.max(16, maxEdge) / Math.max(canvas.width, canvas.height));
|
||||
const w = Math.max(1, Math.round(canvas.width * k));
|
||||
const h = Math.max(1, Math.round(canvas.height * k));
|
||||
@@ -829,22 +831,47 @@ export function useWasm3dRenderer(
|
||||
* ein `set_camera` hier würde das freie Orbit-Ergebnis darüberschreiben und
|
||||
* die orthografische Projektion der Presets zunichtemachen).
|
||||
*/
|
||||
// [290] Gezeichnet wird höchstens einmal je Bildschirm-Frame (s. `renderOnDemand.ts`); die Kamera geht sofort an
|
||||
// Rust (Reihenfolge mit `applyViewPreset`/`render(null)` bleibt, `readRustCamera` sieht sie gleich).
|
||||
const drawNow = useCallback(() => {
|
||||
const r = rendererRef.current;
|
||||
const canvas = canvasRef.current;
|
||||
if (!r || !canvas || exportingRef.current) return;
|
||||
const rect = canvas.getBoundingClientRect();
|
||||
const dpr = window.devicePixelRatio || 1;
|
||||
const w = Math.max(1, Math.round(rect.width * dpr));
|
||||
const h = Math.max(1, Math.round(rect.height * dpr));
|
||||
if (canvas.width !== w || canvas.height !== h) {
|
||||
canvas.width = w;
|
||||
canvas.height = h;
|
||||
}
|
||||
try {
|
||||
r.resize(w, h);
|
||||
r.render();
|
||||
countFrame("3d");
|
||||
} catch (e) {
|
||||
console.warn("render3d render fehlgeschlagen:", e);
|
||||
}
|
||||
}, [canvasRef]);
|
||||
const schedulerRef = useRef<FrameScheduler | null>(null);
|
||||
if (!schedulerRef.current) schedulerRef.current = new FrameScheduler(() => drawNowRef.current());
|
||||
const drawNowRef = useRef(drawNow);
|
||||
drawNowRef.current = drawNow;
|
||||
useEffect(() => () => schedulerRef.current?.cancel(), []);
|
||||
|
||||
/**
|
||||
* Einen Frame anmelden (Canvas-Größe + DPR abgleichen beim Zeichnen). `cam` = null lässt
|
||||
* die zuletzt in Rust gesetzte Kamera unverändert — Fall für `render(null)`
|
||||
* direkt nach `applyViewPreset` (die Kamera kommt dann aus `preset_camera`,
|
||||
* ein `set_camera` hier würde das freie Orbit-Ergebnis darüberschreiben und
|
||||
* die orthografische Projektion der Presets zunichtemachen).
|
||||
*/
|
||||
const render = useCallback(
|
||||
(cam: Camera3d | null) => {
|
||||
const r = rendererRef.current;
|
||||
const canvas = canvasRef.current;
|
||||
if (!r || !canvas || exportingRef.current) return;
|
||||
const rect = canvas.getBoundingClientRect();
|
||||
const dpr = window.devicePixelRatio || 1;
|
||||
const w = Math.max(1, Math.round(rect.width * dpr));
|
||||
const h = Math.max(1, Math.round(rect.height * dpr));
|
||||
if (canvas.width !== w || canvas.height !== h) {
|
||||
canvas.width = w;
|
||||
canvas.height = h;
|
||||
}
|
||||
try {
|
||||
r.resize(w, h);
|
||||
if (cam) {
|
||||
if (!r || !canvasRef.current || exportingRef.current) return;
|
||||
if (cam) {
|
||||
try {
|
||||
r.set_camera(
|
||||
cam.eye[0],
|
||||
cam.eye[1],
|
||||
@@ -859,11 +886,11 @@ export function useWasm3dRenderer(
|
||||
cam.fovY,
|
||||
cam.orthoHalfHeight,
|
||||
);
|
||||
} catch (e) {
|
||||
console.warn("render3d set_camera fehlgeschlagen:", e);
|
||||
}
|
||||
r.render();
|
||||
} catch (e) {
|
||||
console.warn("render3d render fehlgeschlagen:", e);
|
||||
}
|
||||
schedulerRef.current?.request();
|
||||
},
|
||||
[canvasRef],
|
||||
);
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
*/
|
||||
|
||||
import { GpuRecovery, gpuRecovery, isRendererAbort } from "../../engine/gpuRecovery";
|
||||
import { countFrame } from "../../viewport/renderOnDemand";
|
||||
|
||||
/** Was die Sitzung vom wasm-bindgen-Objekt `WebPlanRenderer` braucht. */
|
||||
export interface WebPlanRendererLike {
|
||||
@@ -344,6 +345,7 @@ export class WasmPlanRendererSession<S> {
|
||||
r.set_dash_scale?.(f.dashScaleN ?? 0);
|
||||
r.set_view_box(f.viewBox.x, f.viewBox.y, f.viewBox.w, f.viewBox.h);
|
||||
r.render();
|
||||
countFrame("2d"); // [290] Prüf-Hook: gezeichnete Plan-Frames
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
Reference in new issue
Block a user