new rendering code, still cant do shit, but its on webgl now so lessgooo gpu and vertices + shaders im coming for you

This commit is contained in:
2026-04-01 18:11:17 +02:00
parent 5c413f4e8b
commit 92418e7e4e
8 changed files with 927 additions and 270 deletions
+550 -37
View File
@@ -1,14 +1,15 @@
{
"name": "svelte-portfolio",
"version": "0.0.1",
"version": "0.0.69",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "svelte-portfolio",
"version": "0.0.1",
"version": "0.0.69",
"dependencies": {
"@lucide/svelte": "^0.548.0",
"gl-matrix": "^3.4.4",
"zod": "^4.3.6"
},
"devDependencies": {
@@ -2371,9 +2372,9 @@
}
},
"node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.3.tgz",
"integrity": "sha512-fy6KJm2RawA5RcHkLa1z/ScpBeA762UF9KmZQxwIbDtRJrgLzM10depAiEQ+CXYcoiqW1/m96OAAoke2nE9EeA==",
"version": "5.0.5",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.5.tgz",
"integrity": "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -2711,9 +2712,9 @@
"license": "MIT"
},
"node_modules/brace-expansion": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz",
"integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -2984,16 +2985,16 @@
"license": "MIT"
},
"node_modules/drizzle-kit": {
"version": "0.31.9",
"resolved": "https://registry.npmjs.org/drizzle-kit/-/drizzle-kit-0.31.9.tgz",
"integrity": "sha512-GViD3IgsXn7trFyBUUHyTFBpH/FsHTxYJ66qdbVggxef4UBPHRYxQaRzYLTuekYnk9i5FIEL9pbBIwMqX/Uwrg==",
"version": "0.31.10",
"resolved": "https://registry.npmjs.org/drizzle-kit/-/drizzle-kit-0.31.10.tgz",
"integrity": "sha512-7OZcmQUrdGI+DUNNsKBn1aW8qSoKuTH7d0mYgSP8bAzdFzKoovxEFnoGQp2dVs82EOJeYycqRtciopszwUf8bw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@drizzle-team/brocli": "^0.10.2",
"@esbuild-kit/esm-loader": "^2.5.5",
"esbuild": "^0.25.4",
"esbuild-register": "^3.5.0"
"tsx": "^4.21.0"
},
"bin": {
"drizzle-kit": "bin.cjs"
@@ -3188,19 +3189,6 @@
"@esbuild/win32-x64": "0.25.12"
}
},
"node_modules/esbuild-register": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/esbuild-register/-/esbuild-register-3.6.0.tgz",
"integrity": "sha512-H2/S7Pm8a9CL1uhp9OvjwrBh5Pvx0H8qVOxNu8Wed9Y7qv56MPtq+GGM8RJpq6glYJn9Wspr8uw7l55uyinNeg==",
"dev": true,
"license": "MIT",
"dependencies": {
"debug": "^4.3.4"
},
"peerDependencies": {
"esbuild": ">=0.12 <1"
}
},
"node_modules/escape-string-regexp": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
@@ -3590,9 +3578,9 @@
}
},
"node_modules/flatted": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.1.tgz",
"integrity": "sha512-IxfVbRFVlV8V/yRaGzk0UVIcsKKHMSfYw66T/u4nTwlWteQePsxe//LjudR1AMX4tZW3WFCh3Zqa/sjlqpbURQ==",
"version": "3.4.2",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz",
"integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==",
"dev": true,
"license": "ISC"
},
@@ -3634,6 +3622,12 @@
"url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"
}
},
"node_modules/gl-matrix": {
"version": "3.4.4",
"resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.4.4.tgz",
"integrity": "sha512-latSnyDNt/8zYUB6VIJ6PCh2jBjJX6gnDsoCZ7LyW7GkqrD51EWwa9qCoGixj8YqBtETQK/xY7OmpTF8xz1DdQ==",
"license": "MIT"
},
"node_modules/glob-parent": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
@@ -4260,9 +4254,9 @@
}
},
"node_modules/micromatch/node_modules/picomatch": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
"integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
"dev": true,
"license": "MIT",
"engines": {
@@ -4482,9 +4476,9 @@
"license": "ISC"
},
"node_modules/picomatch": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz",
"integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
"dev": true,
"license": "MIT",
"engines": {
@@ -4586,9 +4580,9 @@
}
},
"node_modules/postcss-load-config/node_modules/yaml": {
"version": "1.10.2",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
"integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",
"version": "1.10.3",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.3.tgz",
"integrity": "sha512-vIYeF1u3CjlhAFekPPAk2h/Kv4T3mAkMox5OymRiJQB0spDP10LHvt+K7G9Ny6NuuMAb25/6n1qyUjAcGNf/AA==",
"dev": true,
"license": "ISC",
"engines": {
@@ -5367,6 +5361,525 @@
"typescript": ">=4.8.4"
}
},
"node_modules/tsx": {
"version": "4.21.0",
"resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz",
"integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==",
"dev": true,
"license": "MIT",
"dependencies": {
"esbuild": "~0.27.0",
"get-tsconfig": "^4.7.5"
},
"bin": {
"tsx": "dist/cli.mjs"
},
"engines": {
"node": ">=18.0.0"
},
"optionalDependencies": {
"fsevents": "~2.3.3"
}
},
"node_modules/tsx/node_modules/@esbuild/aix-ppc64": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.4.tgz",
"integrity": "sha512-cQPwL2mp2nSmHHJlCyoXgHGhbEPMrEEU5xhkcy3Hs/O7nGZqEpZ2sUtLaL9MORLtDfRvVl2/3PAuEkYZH0Ty8Q==",
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"aix"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/android-arm": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.4.tgz",
"integrity": "sha512-X9bUgvxiC8CHAGKYufLIHGXPJWnr0OCdR0anD2e21vdvgCI8lIfqFbnoeOz7lBjdrAGUhqLZLcQo6MLhTO2DKQ==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/android-arm64": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.4.tgz",
"integrity": "sha512-gdLscB7v75wRfu7QSm/zg6Rx29VLdy9eTr2t44sfTW7CxwAtQghZ4ZnqHk3/ogz7xao0QAgrkradbBzcqFPasw==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/android-x64": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.4.tgz",
"integrity": "sha512-PzPFnBNVF292sfpfhiyiXCGSn9HZg5BcAz+ivBuSsl6Rk4ga1oEXAamhOXRFyMcjwr2DVtm40G65N3GLeH1Lvw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/darwin-arm64": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.4.tgz",
"integrity": "sha512-b7xaGIwdJlht8ZFCvMkpDN6uiSmnxxK56N2GDTMYPr2/gzvfdQN8rTfBsvVKmIVY/X7EM+/hJKEIbbHs9oA4tQ==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/darwin-x64": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.4.tgz",
"integrity": "sha512-sR+OiKLwd15nmCdqpXMnuJ9W2kpy0KigzqScqHI3Hqwr7IXxBp3Yva+yJwoqh7rE8V77tdoheRYataNKL4QrPw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/freebsd-arm64": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.4.tgz",
"integrity": "sha512-jnfpKe+p79tCnm4GVav68A7tUFeKQwQyLgESwEAUzyxk/TJr4QdGog9sqWNcUbr/bZt/O/HXouspuQDd9JxFSw==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/freebsd-x64": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.4.tgz",
"integrity": "sha512-2kb4ceA/CpfUrIcTUl1wrP/9ad9Atrp5J94Lq69w7UwOMolPIGrfLSvAKJp0RTvkPPyn6CIWrNy13kyLikZRZQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-arm": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.4.tgz",
"integrity": "sha512-aBYgcIxX/wd5n2ys0yESGeYMGF+pv6g0DhZr3G1ZG4jMfruU9Tl1i2Z+Wnj9/KjGz1lTLCcorqE2viePZqj4Eg==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-arm64": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.4.tgz",
"integrity": "sha512-7nQOttdzVGth1iz57kxg9uCz57dxQLHWxopL6mYuYthohPKEK0vU0C3O21CcBK6KDlkYVcnDXY099HcCDXd9dA==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-ia32": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.4.tgz",
"integrity": "sha512-oPtixtAIzgvzYcKBQM/qZ3R+9TEUd1aNJQu0HhGyqtx6oS7qTpvjheIWBbes4+qu1bNlo2V4cbkISr8q6gRBFA==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-loong64": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.4.tgz",
"integrity": "sha512-8mL/vh8qeCoRcFH2nM8wm5uJP+ZcVYGGayMavi8GmRJjuI3g1v6Z7Ni0JJKAJW+m0EtUuARb6Lmp4hMjzCBWzA==",
"cpu": [
"loong64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-mips64el": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.4.tgz",
"integrity": "sha512-1RdrWFFiiLIW7LQq9Q2NES+HiD4NyT8Itj9AUeCl0IVCA459WnPhREKgwrpaIfTOe+/2rdntisegiPWn/r/aAw==",
"cpu": [
"mips64el"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-ppc64": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.4.tgz",
"integrity": "sha512-tLCwNG47l3sd9lpfyx9LAGEGItCUeRCWeAx6x2Jmbav65nAwoPXfewtAdtbtit/pJFLUWOhpv0FpS6GQAmPrHA==",
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-riscv64": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.4.tgz",
"integrity": "sha512-BnASypppbUWyqjd1KIpU4AUBiIhVr6YlHx/cnPgqEkNoVOhHg+YiSVxM1RLfiy4t9cAulbRGTNCKOcqHrEQLIw==",
"cpu": [
"riscv64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-s390x": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.4.tgz",
"integrity": "sha512-+eUqgb/Z7vxVLezG8bVB9SfBie89gMueS+I0xYh2tJdw3vqA/0ImZJ2ROeWwVJN59ihBeZ7Tu92dF/5dy5FttA==",
"cpu": [
"s390x"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/linux-x64": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.4.tgz",
"integrity": "sha512-S5qOXrKV8BQEzJPVxAwnryi2+Iq5pB40gTEIT69BQONqR7JH1EPIcQ/Uiv9mCnn05jff9umq/5nqzxlqTOg9NA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/netbsd-arm64": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.4.tgz",
"integrity": "sha512-xHT8X4sb0GS8qTqiwzHqpY00C95DPAq7nAwX35Ie/s+LO9830hrMd3oX0ZMKLvy7vsonee73x0lmcdOVXFzd6Q==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/netbsd-x64": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.4.tgz",
"integrity": "sha512-RugOvOdXfdyi5Tyv40kgQnI0byv66BFgAqjdgtAKqHoZTbTF2QqfQrFwa7cHEORJf6X2ht+l9ABLMP0dnKYsgg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/openbsd-arm64": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.4.tgz",
"integrity": "sha512-2MyL3IAaTX+1/qP0O1SwskwcwCoOI4kV2IBX1xYnDDqthmq5ArrW94qSIKCAuRraMgPOmG0RDTA74mzYNQA9ow==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/openbsd-x64": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.4.tgz",
"integrity": "sha512-u8fg/jQ5aQDfsnIV6+KwLOf1CmJnfu1ShpwqdwC0uA7ZPwFws55Ngc12vBdeUdnuWoQYx/SOQLGDcdlfXhYmXQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/openharmony-arm64": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.4.tgz",
"integrity": "sha512-JkTZrl6VbyO8lDQO3yv26nNr2RM2yZzNrNHEsj9bm6dOwwu9OYN28CjzZkH57bh4w0I2F7IodpQvUAEd1mbWXg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openharmony"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/sunos-x64": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.4.tgz",
"integrity": "sha512-/gOzgaewZJfeJTlsWhvUEmUG4tWEY2Spp5M20INYRg2ZKl9QPO3QEEgPeRtLjEWSW8FilRNacPOg8R1uaYkA6g==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"sunos"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/win32-arm64": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.4.tgz",
"integrity": "sha512-Z9SExBg2y32smoDQdf1HRwHRt6vAHLXcxD2uGgO/v2jK7Y718Ix4ndsbNMU/+1Qiem9OiOdaqitioZwxivhXYg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/win32-ia32": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.4.tgz",
"integrity": "sha512-DAyGLS0Jz5G5iixEbMHi5KdiApqHBWMGzTtMiJ72ZOLhbu/bzxgAe8Ue8CTS3n3HbIUHQz/L51yMdGMeoxXNJw==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/@esbuild/win32-x64": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.4.tgz",
"integrity": "sha512-+knoa0BDoeXgkNvvV1vvbZX4+hizelrkwmGJBdT17t8FNPwG2lKemmuMZlmaNQ3ws3DKKCxpb4zRZEIp3UxFCg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
}
},
"node_modules/tsx/node_modules/esbuild": {
"version": "0.27.4",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.4.tgz",
"integrity": "sha512-Rq4vbHnYkK5fws5NF7MYTU68FPRE1ajX7heQ/8QXXWqNgqqJ/GkmmyxIzUnf2Sr/bakf8l54716CcMGHYhMrrQ==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"bin": {
"esbuild": "bin/esbuild"
},
"engines": {
"node": ">=18"
},
"optionalDependencies": {
"@esbuild/aix-ppc64": "0.27.4",
"@esbuild/android-arm": "0.27.4",
"@esbuild/android-arm64": "0.27.4",
"@esbuild/android-x64": "0.27.4",
"@esbuild/darwin-arm64": "0.27.4",
"@esbuild/darwin-x64": "0.27.4",
"@esbuild/freebsd-arm64": "0.27.4",
"@esbuild/freebsd-x64": "0.27.4",
"@esbuild/linux-arm": "0.27.4",
"@esbuild/linux-arm64": "0.27.4",
"@esbuild/linux-ia32": "0.27.4",
"@esbuild/linux-loong64": "0.27.4",
"@esbuild/linux-mips64el": "0.27.4",
"@esbuild/linux-ppc64": "0.27.4",
"@esbuild/linux-riscv64": "0.27.4",
"@esbuild/linux-s390x": "0.27.4",
"@esbuild/linux-x64": "0.27.4",
"@esbuild/netbsd-arm64": "0.27.4",
"@esbuild/netbsd-x64": "0.27.4",
"@esbuild/openbsd-arm64": "0.27.4",
"@esbuild/openbsd-x64": "0.27.4",
"@esbuild/openharmony-arm64": "0.27.4",
"@esbuild/sunos-x64": "0.27.4",
"@esbuild/win32-arm64": "0.27.4",
"@esbuild/win32-ia32": "0.27.4",
"@esbuild/win32-x64": "0.27.4"
}
},
"node_modules/tsx/node_modules/fsevents": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
+1
View File
@@ -52,6 +52,7 @@
},
"dependencies": {
"@lucide/svelte": "^0.548.0",
"gl-matrix": "^3.4.4",
"zod": "^4.3.6"
}
}
+114
View File
@@ -0,0 +1,114 @@
import type Vector2 from '$lib/vector';
class Renderer {
private gl: WebGL2RenderingContext;
private posBuffer!: WebGLBuffer;
private program!: WebGLProgram;
constructor(canvas: HTMLCanvasElement) {
let context = canvas.getContext('webgl2');
if (!context) throw new Error(`Failed to get webgl2 context from ${canvas}`);
this.gl = context;
}
public async init() {
try {
const vert: WebGLShader = await this.loadShader(
this.gl,
'src/lib/shimeji/renderer/shaders/vertex_shader.vert',
this.gl.VERTEX_SHADER
);
const frag: WebGLShader = await this.loadShader(
this.gl,
'src/lib/shimeji/renderer/shaders/fragment_shader.frag',
this.gl.FRAGMENT_SHADER
);
const program = this.gl.createProgram();
this.program = program;
this.gl.attachShader(program, vert);
this.gl.attachShader(program, frag);
this.gl.linkProgram(program);
if (!this.gl.getProgramParameter(program, this.gl.LINK_STATUS)) {
console.error(this.gl.getProgramInfoLog(program));
this.gl.deleteProgram(program);
throw new Error(`Failed to link program to webgl2 context ${program}`);
}
const pos = this.gl.createBuffer();
this.posBuffer = pos;
this.gl.bindBuffer(this.gl.ARRAY_BUFFER, pos);
this.gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height);
let resUniLoc = this.gl.getUniformLocation(program, 'u_resolution');
this.gl.uniform2f(resUniLoc, this.gl.canvas.width, this.gl.canvas.height);
this.gl.clearColor(0, 0, 0, 0);
this.gl.clear(this.gl.COLOR_BUFFER_BIT);
this.gl.useProgram(program);
this.gl.enableVertexAttribArray(0);
this.gl.bindBuffer(this.gl.ARRAY_BUFFER, pos);
this.gl.vertexAttribPointer(0, 2, this.gl.FLOAT, false, 0, 0);
} catch (error) {
console.log(error);
this.gl.VERTEX_SHADER;
}
}
private async loadShader(
gl: WebGL2RenderingContext,
path: string,
type: typeof gl.VERTEX_SHADER | typeof gl.FRAGMENT_SHADER
) {
const response = await fetch(path);
if (!response.ok) throw new Error(`failed to fetch the shader file ${response}`);
const data = await response.text();
const shader = gl.createShader(type);
if (!shader) throw new Error(`Failed to create the shader ${shader}`);
gl.shaderSource(shader, data);
gl.compileShader(shader);
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
console.error(gl.getShaderInfoLog(shader));
gl.deleteShader(shader);
throw new Error(`Failed to compile the shader ${shader}`);
}
return shader;
}
public UpdateBounds(width: number, height: number): void {
this.gl.viewport(0, 0, width, height);
}
public Draw(pos: Vector2, size: number): void {
let x1 = pos.x - size;
let x2 = pos.x + size;
let y1 = pos.y + size;
let y2 = pos.y - size;
this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.posBuffer);
this.gl.bufferData(
this.gl.ARRAY_BUFFER,
new Float32Array([x1, y1, x2, y1, x2, y2, x1, y1, x1, y2, x2, y2]),
this.gl.STATIC_DRAW
);
var primitiveType = this.gl.TRIANGLES;
var offset = 0;
var count = 6;
this.gl.drawArrays(primitiveType, offset, count);
}
}
export default Renderer;
@@ -0,0 +1,10 @@
#version 300 es
precision mediump float;
out vec4 color;
in vec4 v_color;
void main() {
color = v_color;
}
@@ -0,0 +1,15 @@
#version 300 es
layout ( location = 0 ) in vec2 a_position;
uniform vec2 u_resolution;
out vec4 v_color;
void main() {
vec2 zeroToOne = a_position / u_resolution;
vec2 zeroToTwo = zeroToOne * 2.0;
vec2 clipSpace = zeroToTwo - 1.0;
gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1);
//gl_Position = vec4(a_position, 0, 1);
v_color = vec4(a_position.xyx * 0.5 + 0.5, 1.0);
}
+157 -155
View File
@@ -1,210 +1,212 @@
import Vector2 from "../vector";
import Renderer from '$lib/shimeji/renderer/renderer';
import Vector2 from '../vector';
export class Shimeji {
private element: HTMLElement;
private canvas: HTMLCanvasElement;
private rect: DOMRect;
private element: HTMLElement;
private canvas: HTMLCanvasElement;
private renderer: Renderer;
private rect: DOMRect;
private pos: Vector2 = Vector2.zero;
private vel: Vector2 = Vector2.zero;
private pos: Vector2 = Vector2.zero;
private vel: Vector2 = Vector2.zero;
private mousePos: Vector2 = Vector2.zero;
private mousePos: Vector2 = Vector2.zero;
private pivot: Vector2 = Vector2.zero;
private pivot: Vector2 = Vector2.zero;
private isBeingDragged: boolean = false;
private isBeingDragged: boolean = false;
private rafId: number | null = null;
private prevDeltaTime: number = 0;
private rafId: number | null = null;
private prevDeltaTime: number = 0;
private readonly TIMESCALE: number = 1;
private readonly RESTITUTION: number = 0.4;
private readonly CURSOR_STRENGTH: number = 500;
private readonly DAMPING: number = 1;
private readonly MASS: number = 1;
private readonly FRICTION: number = 0.9;
private readonly GRAVITY: number = 50;
private readonly TIMESCALE: number = 1;
private readonly RESTITUTION: number = 0.4;
private readonly CURSOR_STRENGTH: number = 500;
private readonly DAMPING: number = 1;
private readonly MASS: number = 1;
private readonly FRICTION: number = 0.9;
private readonly GRAVITY: number = 50;
private bounds: { minX: number; minY: number; maxX: number; maxY: number };
private bounds: { minX: number; minY: number; maxX: number; maxY: number };
constructor(element: HTMLElement, canvas: HTMLCanvasElement) {
this.element = element;
this.canvas= canvas;
this.rect = element.getBoundingClientRect();
constructor(element: HTMLElement, canvas: HTMLCanvasElement, renderer: Renderer) {
this.element = element;
this.canvas = canvas;
this.renderer = renderer;
this.rect = element.getBoundingClientRect();
this.bounds = {
minX: 0,
minY: 0,
maxX: window.innerWidth,
maxY: window.innerHeight
};
this.bounds = {
minX: 0,
minY: 0,
maxX: window.innerWidth,
maxY: window.innerHeight
};
this.pos.set(window.innerWidth / 2, window.innerHeight/ 2);
this.pos.set(window.innerWidth / 2, window.innerHeight / 2);
this.updateBounds();
window.addEventListener('resize', () => this.updateBounds());
this.updateBounds();
window.addEventListener('resize', () => this.updateBounds());
console.log(this.element.getBoundingClientRect());
console.log(this.element.getBoundingClientRect());
this.setupDragEvents();
}
this.setupDragEvents();
}
private updateBounds(): void {
this.bounds = {
minX: 0,
minY: 0,
maxX: window.innerWidth,
maxY: window.innerHeight
};
private updateBounds(): void {
this.bounds = {
minX: 0,
minY: 0,
maxX: window.innerWidth,
maxY: window.innerHeight
};
this.canvas.width = window.innerWidth;
this.canvas.height = window.innerHeight;
}
this.canvas.width = window.innerWidth;
this.canvas.height = window.innerHeight;
this.renderer.UpdateBounds(window.innerWidth, window.innerHeight);
}
start(): void {
if (this.rafId !== null) return;
start(): void {
if (this.rafId !== null) return;
const firstFrame = (delta: number) => {
this.prevDeltaTime = delta;
this.rafId = requestAnimationFrame(animate);
}
const firstFrame = (delta: number) => {
this.prevDeltaTime = delta;
this.rafId = requestAnimationFrame(animate);
};
const animate = (delta: number) => {
let dt = (delta - this.prevDeltaTime) / 1000; // seconds
dt = Math.min(dt, 0.05 * this.TIMESCALE); // cap to 50 ms
this.prevDeltaTime = delta;
const animate = (delta: number) => {
let dt = (delta - this.prevDeltaTime) / 1000;
dt = Math.min(dt, 0.05 * this.TIMESCALE);
this.prevDeltaTime = delta;
this.updatePhysics(dt);
this.applyBoundaries();
this.render();
this.rafId = requestAnimationFrame(animate);
};
this.updatePhysics(dt);
this.applyBoundaries();
this.render();
this.rafId = requestAnimationFrame(animate);
};
this.rafId = requestAnimationFrame(firstFrame);
}
this.rafId = requestAnimationFrame(firstFrame);
}
stop(): void {
if (this.rafId !== null) {
cancelAnimationFrame(this.rafId);
this.rafId = null;
}
}
stop(): void {
if (this.rafId !== null) {
cancelAnimationFrame(this.rafId);
this.rafId = null;
}
}
private setupDragEvents(): void {
this.element.addEventListener('mousedown', (e) => {
e.preventDefault();
this.isBeingDragged = true;
this.element.style.cursor = 'grabbing';
private setupDragEvents(): void {
this.element.addEventListener('mousedown', (e) => {
e.preventDefault();
this.isBeingDragged = true;
this.element.style.cursor = 'grabbing';
const parent = this.element.parentElement;
if(parent) parent.style.cursor = 'grabbing';
const parent = this.element.parentElement;
if (parent) parent.style.cursor = 'grabbing';
this.pivot.x = e.offsetX - this.rect.width / 2;
this.pivot.y = e.offsetY - this.rect.height / 2;
this.pivot.x = e.offsetX - this.rect.width / 2;
this.pivot.y = e.offsetY - this.rect.height / 2;
});
});
document.addEventListener('mousemove', (e) => {
this.mousePos.x = e.pageX;
this.mousePos.y = e.pageY;
});
document.addEventListener('mousemove', (e) => {
this.mousePos.x = e.pageX;
this.mousePos.y = e.pageY;
});
document.addEventListener('mouseup', (e) => {
if (this.isBeingDragged) {
this.isBeingDragged = false;
this.element.style.cursor = 'grab';
document.addEventListener('mouseup', (e) => {
if(this.isBeingDragged) {
this.isBeingDragged = false;
this.element.style.cursor = 'grab';
const parent = this.element.parentElement;
if (parent) parent.style.cursor = 'auto';
const parent = this.element.parentElement;
if(parent) parent.style.cursor = 'auto';
this.pivot = Vector2.zero;
}
this.pivot = Vector2.zero;
}
this.canvas.getContext('2d')!.clearRect(0, 0, this.canvas.width, this.canvas.height);
});
this.canvas.getContext('2d')!.clearRect(0, 0, this.canvas.width, this.canvas.height);
});
this.element.addEventListener('dragstart', (e) => {
e.preventDefault();
});
}
this.element.addEventListener('dragstart', (e) => {
e.preventDefault();
});
}
private updatePhysics(dt: number): void {
if (this.isBeingDragged) {
const direction: Vector2 = this.mousePos.sub(this.pivot).sub(this.pos);
private updatePhysics(dt: number): void {
if (this.isBeingDragged) {
const direction: Vector2 = this.mousePos.sub(this.pivot).sub(this.pos);
const force: Vector2 = direction.mul(this.CURSOR_STRENGTH);
const force: Vector2 = direction.mul(this.CURSOR_STRENGTH);
const acceleration: Vector2 = force.div(this.MASS).deadZone(0.001);
const acceleration: Vector2 = force.div(this.MASS).deadZone(0.001);
acceleration.mulEq(dt);
acceleration.mulEq(dt);
this.vel.addEq(acceleration);
this.vel.mulEq(0.8);
}
this.vel.addEq(acceleration);
this.vel.mulEq(0.8);
}
this.vel.y += this.GRAVITY;
this.vel.mulEq(this.DAMPING);
this.vel.y += this.GRAVITY;
this.vel.mulEq(this.DAMPING);
if (this.pos.y + this.rect.width >= this.bounds.maxY) {
this.vel.x *= this.FRICTION;
}
if (this.pos.y + this.rect.width >= this.bounds.maxY) {
this.vel.x *= this.FRICTION;
}
const outVel = this.vel.mul(dt);
this.pos.addEq(outVel);
}
const outVel = this.vel.mul(dt);
this.pos.addEq(outVel);
}
private applyBoundaries(): void {
const leftBound = this.rect.width / 2;
const rightBound = this.bounds.maxX - this.rect.width / 2;
private applyBoundaries(): void {
const leftBound = this.rect.width / 2;
const rightBound = this.bounds.maxX - this.rect.width / 2;
if (this.pos.x < leftBound) {
this.pos.x = leftBound;
this.vel.x = -this.RESTITUTION * this.vel.x;
} else if (this.pos.x > rightBound) {
this.pos.x = rightBound;
this.vel.x = -this.RESTITUTION * this.vel.x;
}
if (this.pos.x < leftBound) {
this.pos.x = leftBound;
this.vel.x = -(this.RESTITUTION) * this.vel.x;
} else if (this.pos.x > rightBound) {
this.pos.x = rightBound;
this.vel.x = -(this.RESTITUTION) * this.vel.x;
}
const topBound = this.rect.height / 2;
const bottomBound = this.bounds.maxY - this.rect.height / 2;
const topBound = this.rect.height / 2;
const bottomBound = this.bounds.maxY - this.rect.height / 2;
if (this.pos.y < topBound) {
this.pos.y = topBound;
this.vel.y = -this.RESTITUTION * this.vel.y;
} else if (this.pos.y > bottomBound) {
this.pos.y = bottomBound;
this.vel.y = -this.RESTITUTION * this.vel.y;
}
}
if (this.pos.y < topBound) {
this.pos.y = topBound;
this.vel.y = -(this.RESTITUTION) * this.vel.y;
} else if (this.pos.y > bottomBound) {
this.pos.y = bottomBound;
this.vel.y = -(this.RESTITUTION) * this.vel.y;
}
}
private drawRay(pos1: { x: number; y: number }, pos2: { x: number; y: number }) {
const ctx = this.canvas.getContext('2d')!;
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
ctx.strokeStyle = 'white';
ctx.lineWidth = 0.1;
ctx.beginPath();
ctx.moveTo(pos1.x, pos1.y);
ctx.lineTo(pos2.x, pos2.y);
ctx.stroke();
}
private drawRay(pos1: {x: number, y: number}, pos2: {x: number, y: number}) {
const ctx = this.canvas.getContext("2d")!;
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
ctx.strokeStyle = "white";
ctx.lineWidth = 0.1
ctx.beginPath();
ctx.moveTo(pos1.x, pos1.y);
ctx.lineTo(pos2.x, pos2.y);
ctx.stroke();
}
private render(): void {
this.element.style.transform = `translate(${this.pos.x}px, ${this.pos.y}px)`;
this.renderer.Draw(this.pos, this.rect.width / 2);
private render(): void {
this.element.style.transform = `translate(${this.pos.x}px, ${this.pos.y}px)`;
/* if(this.isBeingDragged) {
/* if(this.isBeingDragged) {
this.drawRay(
{x: this.mouseX, y: this.mouseY},
{x: this.x + this.pivotX, y: this.y + this.pivotY}
)
} */
}
}
addImpulse(x: number, y: number): void {
this.vel.x += x;
this.vel.y += y;
}
addImpulse(x: number, y: number): void {
this.vel.x += x;
this.vel.y += y;
}
moveTo(pos: number) {
}
moveTo(pos: number) {}
}
+54 -43
View File
@@ -1,58 +1,69 @@
<script lang="ts">
import { Shimeji } from "$lib/stores/shimeji";
import { onMount } from "svelte";
import Renderer from '$lib/shimeji/renderer/renderer';
import { Shimeji } from '$lib/stores/shimeji';
import Vector2 from '$lib/vector';
import { onMount } from 'svelte';
const drag: number = 3;
const speed: number = 2;
const drag: number = 3;
const speed: number = 2;
let shimeji: Shimeji;
let sprite: HTMLElement;
let canvas: HTMLCanvasElement;
let shown: boolean = $state(false);
let shimeji: Shimeji;
let renderer: Renderer;
let sprite: HTMLElement;
let canvas: HTMLCanvasElement;
let shown: boolean = $state(false);
function genRandomPos(min: number, max: number): number{
const out = Math.random() * (max - min) + min;
return out;
}
function genRandomPos(min: number, max: number): number {
const out = Math.random() * (max - min) + min;
return out;
}
onMount(() => {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
async function fetchShader(path: string): Promise<string> {
const response = await fetch(path);
if (!response.ok) throw new Error(`failed to fetch the shader file ${response}`);
return await response.text();
}
shimeji = new Shimeji(sprite, canvas);
shimeji.start();
onMount(async () => {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
shown = true;
const vert = await fetchShader('src/lib/shimeji/renderer/shaders/vertex_shader.vert');
const frag = await fetchShader('src/lib/shimeji/renderer/shaders/fragment_shader.frag');
document.addEventListener('keydown', (e) => {
if(e.key === 'a') {
shimeji.addImpulse(-500, -100);
}
if(e.key === 'd') {
shimeji.addImpulse(500, -100);
}
if(e.key === 'space') {
shimeji.moveTo(genRandomPos(200, window.innerWidth - 200));
}
});
console.log(vert, '\n', frag);
return () => {
shimeji.stop();
};
})
renderer = new Renderer(canvas);
await renderer.init();
renderer.Draw(new Vector2(500, 500), 50);
/* shimeji = new Shimeji(sprite, canvas, renderer);
shimeji.start();
shown = true;
document.addEventListener('keydown', (e) => {
if (e.key === 'a') {
shimeji.addImpulse(-500, -100);
}
if (e.key === 'd') {
shimeji.addImpulse(500, -100);
}
if (e.key === 'space') {
shimeji.moveTo(genRandomPos(200, window.innerWidth - 200));
}
}); */
});
</script>
<div class=" absolute z-20 size-full overflow-clip ">
<canvas bind:this={canvas} style=" stroke-width: 5px;" class=" stroke-red-500 absolute z-2 size-full"></canvas>
<div bind:this={sprite} class=" z-30 cursor-grab origin-center transform-flat -translate-1/2 will-change-transform absolute bg-amber-400 size-20"></div>
<div class=" absolute z-20 size-full overflow-clip">
<canvas
bind:this={canvas}
style=" stroke-width: 5px;"
class=" absolute z-2 size-full stroke-red-500"
></canvas>
<!-- <div
bind:this={sprite}
class=" absolute z-30 size-20 origin-center -translate-1/2 cursor-grab bg-amber-400 opacity-15 will-change-transform transform-flat"
></div> -->
</div>
<style>
</style>
-9
View File
@@ -1,9 +0,0 @@
<script lang="ts">
import Shimeji from "../../modules/Shimeji.svelte";
</script>
<Shimeji />