diff --git a/src/lib/extrude-svg.ts b/src/lib/extrude-svg.ts deleted file mode 100644 index 48b097c..0000000 --- a/src/lib/extrude-svg.ts +++ /dev/null @@ -1,45 +0,0 @@ -import type * as THREE from 'three'; -import { SVGLoader } from 'three/examples/jsm/loaders/SVGLoader'; -import type { SVGResult, SVGResultPaths } from 'three/examples/jsm/loaders/SVGLoader'; - -import { Mesh } from 'three/src/objects/Mesh'; -import { Group } from 'three/src/objects/Group'; -import { MeshNormalMaterial } from 'three/src/materials/MeshNormalMaterial'; -import { ExtrudeGeometry } from 'three/src/geometries/ExtrudeGeometry'; - -/** - * Parses the provided SVG markup and extrudes it into a 3D model using THREE.js. - * @param svgMarkup - SVG markup to extrude. - * @return Group containing all of the extruded SVG paths. - * @throws Error If the SVG markup is empty. - */ -export function extrudeSvg(svgMarkup: string): Group { - if (!svgMarkup) { - throw new Error('SVG markup is empty'); - } - - const svgData: SVGResult = new SVGLoader().parse(svgMarkup); - const material: MeshNormalMaterial = new MeshNormalMaterial(); - - const svgGroup: Mesh[][] = svgData.paths.map(createShapeFromPath); - - const group = new Group(); - svgGroup.flat().forEach(mesh => group.add(mesh)); - - return group; - - function createShapeFromPath(path: SVGResultPaths): Mesh[] { - const shapes: THREE.Shape[] = path.toShapes(true); - - return shapes.map(shape => extrudeShape(shape, material)); - } - - function extrudeShape(shape: THREE.Shape, material: MeshNormalMaterial): Mesh { - const geometry = new ExtrudeGeometry(shape, { - depth: 20, - bevelEnabled: false - }); - - return new Mesh(geometry, material); - } -} diff --git a/src/routes/tools/+page.svelte b/src/routes/tools/+page.svelte index 21076dd..095f4da 100644 --- a/src/routes/tools/+page.svelte +++ b/src/routes/tools/+page.svelte @@ -1,7 +1,9 @@ @@ -11,7 +13,51 @@

Tools

- - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/lib/components/gltf/Github3d.svelte b/src/routes/tools/Github.svelte similarity index 82% rename from src/lib/components/gltf/Github3d.svelte rename to src/routes/tools/Github.svelte index f0e1d97..8997011 100644 --- a/src/lib/components/gltf/Github3d.svelte +++ b/src/routes/tools/Github.svelte @@ -1,17 +1,16 @@ - - diff --git a/src/routes/tools/Scene.svelte b/src/routes/tools/Scene.svelte deleted file mode 100644 index 1fd418d..0000000 --- a/src/routes/tools/Scene.svelte +++ /dev/null @@ -1,48 +0,0 @@ - - - - { - ref.lookAt(0, 1, 0); - }} -/> - - - - scale.set(1.5)} - on:pointerleave={() => scale.set(1)} - on:click={() => scale.set(3)} -> - - - - - - scale.set(1.5)} - on:pointerleave={() => scale.set(1)} - on:click={() => scale.set(3)} -> - - diff --git a/static/github-transformed.glb b/static/github-transformed.glb deleted file mode 100644 index 743764f..0000000 Binary files a/static/github-transformed.glb and /dev/null differ diff --git a/static/github.glb b/static/github.glb new file mode 100644 index 0000000..e297dce Binary files /dev/null and b/static/github.glb differ