feat: change default template
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 2m0s
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 2m0s
This commit is contained in:
@@ -13,6 +13,16 @@
|
||||
|
||||
const threlte = useThrelte();
|
||||
|
||||
export let fps: number[] = [];
|
||||
let renderer = threlte.renderer;
|
||||
let rendererRender = renderer.render;
|
||||
renderer.render = function (scene, camera) {
|
||||
const a = performance.now();
|
||||
rendererRender.call(renderer, scene, camera);
|
||||
fps.push(performance.now() - a);
|
||||
fps = fps.slice(-100);
|
||||
};
|
||||
|
||||
export const invalidate = function () {
|
||||
if (scene) {
|
||||
geometries = scene.children
|
||||
|
||||
@@ -7,10 +7,12 @@
|
||||
import { decodeFloat, splitNestedArray } from "@nodes/utils";
|
||||
import type { PerformanceStore } from "$lib/performance";
|
||||
import { AppSettings } from "$lib/settings/app-settings";
|
||||
import SmallPerformanceViewer from "$lib/performance/SmallPerformanceViewer.svelte";
|
||||
|
||||
export let centerCamera: boolean = true;
|
||||
export let perf: PerformanceStore;
|
||||
export let scene: Group;
|
||||
let fps: number[] = [];
|
||||
|
||||
let lines: Vector3[][] = [];
|
||||
|
||||
@@ -59,6 +61,10 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
{#if $AppSettings.showPerformancePanel}
|
||||
<SmallPerformanceViewer {fps} store={perf} />
|
||||
{/if}
|
||||
|
||||
<Canvas>
|
||||
<Scene bind:scene bind:invalidate {lines} {centerCamera} />
|
||||
<Scene bind:scene bind:invalidate {lines} {centerCamera} bind:fps />
|
||||
</Canvas>
|
||||
|
||||
Reference in New Issue
Block a user