mirror of
https://github.com/Theaninova/Bampy.git
synced 2025-12-11 03:56:17 +00:00
performance improvements
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
</Canvas>
|
||||
|
||||
<div class="controls">
|
||||
<input type="range" min="0" max="1" step="0.01" bind:value={showSlices} orient="vertical" />
|
||||
<input type="range" min="0" max="1" step="0.001" bind:value={showSlices} orient="vertical" />
|
||||
</div>
|
||||
|
||||
{#if $progress !== undefined}
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
<style lang="scss">
|
||||
input[type='range'] {
|
||||
height: 80%;
|
||||
}
|
||||
|
||||
.controls {
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
Mesh,
|
||||
DoubleSide,
|
||||
Color,
|
||||
BufferGeometryLoader
|
||||
BufferGeometryLoader,
|
||||
ConeGeometry
|
||||
} from 'three';
|
||||
import { writable } from 'svelte/store';
|
||||
import { onDestroy, onMount } from 'svelte';
|
||||
@@ -63,7 +64,6 @@
|
||||
export let maxNonPlanarAngle = MathUtils.degToRad(20);
|
||||
export let bedNormal = new Vector3(0, 0, 1);
|
||||
|
||||
let mesh: Mesh;
|
||||
let layers = writable<Layer[]>([]);
|
||||
|
||||
const stl: AsyncWritable<BufferGeometry> = useLoader(STLLoader).load('/benchy.stl');
|
||||
@@ -113,8 +113,8 @@
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
{#if $stl && false}
|
||||
<T.Mesh geometry={$stl} bind:ref={mesh}>
|
||||
{#if $stl}
|
||||
<T.Mesh geometry={$stl} position.y={40}>
|
||||
<T.MeshNormalMaterial />
|
||||
</T.Mesh>
|
||||
{/if}
|
||||
|
||||
@@ -153,14 +153,14 @@ function slice({
|
||||
const positions: number[] = [];
|
||||
for (let i = 0; i < nonPlanarSurfaces.length; i++) {
|
||||
if (consumedNonPlanarSurfaces[i]) continue;
|
||||
if (nonPlanarSurfaces[i].geometry.boundingBox!.min.z > layer) {
|
||||
if (layer >= nonPlanarSurfaces[i].geometry.boundingBox!.min.z) {
|
||||
consumedNonPlanarSurfaces[i] = true;
|
||||
activeNonPlanarSurfaces.push([i, nonPlanarSurfaces[i]]);
|
||||
}
|
||||
}
|
||||
deactivate: for (let i = 0; i < activeNonPlanarSurfaces.length; i++) {
|
||||
const [index, surface] = activeNonPlanarSurfaces[i];
|
||||
if (surface.geometry.boundingBox!.max.z <= layer) {
|
||||
if (layer > surface.geometry.boundingBox!.max.z) {
|
||||
activeNonPlanarSurfaces.splice(i, 1);
|
||||
i--;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user