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", "name": "svelte-portfolio",
"version": "0.0.1", "version": "0.0.69",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "svelte-portfolio", "name": "svelte-portfolio",
"version": "0.0.1", "version": "0.0.69",
"dependencies": { "dependencies": {
"@lucide/svelte": "^0.548.0", "@lucide/svelte": "^0.548.0",
"gl-matrix": "^3.4.4",
"zod": "^4.3.6" "zod": "^4.3.6"
}, },
"devDependencies": { "devDependencies": {
@@ -2371,9 +2372,9 @@
} }
}, },
"node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": {
"version": "5.0.3", "version": "5.0.5",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.3.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.5.tgz",
"integrity": "sha512-fy6KJm2RawA5RcHkLa1z/ScpBeA762UF9KmZQxwIbDtRJrgLzM10depAiEQ+CXYcoiqW1/m96OAAoke2nE9EeA==", "integrity": "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -2711,9 +2712,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/brace-expansion": { "node_modules/brace-expansion": {
"version": "1.1.12", "version": "1.1.13",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz",
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -2984,16 +2985,16 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/drizzle-kit": { "node_modules/drizzle-kit": {
"version": "0.31.9", "version": "0.31.10",
"resolved": "https://registry.npmjs.org/drizzle-kit/-/drizzle-kit-0.31.9.tgz", "resolved": "https://registry.npmjs.org/drizzle-kit/-/drizzle-kit-0.31.10.tgz",
"integrity": "sha512-GViD3IgsXn7trFyBUUHyTFBpH/FsHTxYJ66qdbVggxef4UBPHRYxQaRzYLTuekYnk9i5FIEL9pbBIwMqX/Uwrg==", "integrity": "sha512-7OZcmQUrdGI+DUNNsKBn1aW8qSoKuTH7d0mYgSP8bAzdFzKoovxEFnoGQp2dVs82EOJeYycqRtciopszwUf8bw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@drizzle-team/brocli": "^0.10.2", "@drizzle-team/brocli": "^0.10.2",
"@esbuild-kit/esm-loader": "^2.5.5", "@esbuild-kit/esm-loader": "^2.5.5",
"esbuild": "^0.25.4", "esbuild": "^0.25.4",
"esbuild-register": "^3.5.0" "tsx": "^4.21.0"
}, },
"bin": { "bin": {
"drizzle-kit": "bin.cjs" "drizzle-kit": "bin.cjs"
@@ -3188,19 +3189,6 @@
"@esbuild/win32-x64": "0.25.12" "@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": { "node_modules/escape-string-regexp": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
@@ -3590,9 +3578,9 @@
} }
}, },
"node_modules/flatted": { "node_modules/flatted": {
"version": "3.4.1", "version": "3.4.2",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.1.tgz", "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz",
"integrity": "sha512-IxfVbRFVlV8V/yRaGzk0UVIcsKKHMSfYw66T/u4nTwlWteQePsxe//LjudR1AMX4tZW3WFCh3Zqa/sjlqpbURQ==", "integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==",
"dev": true, "dev": true,
"license": "ISC" "license": "ISC"
}, },
@@ -3634,6 +3622,12 @@
"url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" "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": { "node_modules/glob-parent": {
"version": "6.0.2", "version": "6.0.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
@@ -4260,9 +4254,9 @@
} }
}, },
"node_modules/micromatch/node_modules/picomatch": { "node_modules/micromatch/node_modules/picomatch": {
"version": "2.3.1", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@@ -4482,9 +4476,9 @@
"license": "ISC" "license": "ISC"
}, },
"node_modules/picomatch": { "node_modules/picomatch": {
"version": "4.0.3", "version": "4.0.4",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz",
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@@ -4586,9 +4580,9 @@
} }
}, },
"node_modules/postcss-load-config/node_modules/yaml": { "node_modules/postcss-load-config/node_modules/yaml": {
"version": "1.10.2", "version": "1.10.3",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.3.tgz",
"integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", "integrity": "sha512-vIYeF1u3CjlhAFekPPAk2h/Kv4T3mAkMox5OymRiJQB0spDP10LHvt+K7G9Ny6NuuMAb25/6n1qyUjAcGNf/AA==",
"dev": true, "dev": true,
"license": "ISC", "license": "ISC",
"engines": { "engines": {
@@ -5367,6 +5361,525 @@
"typescript": ">=4.8.4" "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": { "node_modules/type-check": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
+1
View File
@@ -52,6 +52,7 @@
}, },
"dependencies": { "dependencies": {
"@lucide/svelte": "^0.548.0", "@lucide/svelte": "^0.548.0",
"gl-matrix": "^3.4.4",
"zod": "^4.3.6" "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);
}
+24 -22
View File
@@ -1,8 +1,10 @@
import Vector2 from "../vector"; import Renderer from '$lib/shimeji/renderer/renderer';
import Vector2 from '../vector';
export class Shimeji { export class Shimeji {
private element: HTMLElement; private element: HTMLElement;
private canvas: HTMLCanvasElement; private canvas: HTMLCanvasElement;
private renderer: Renderer;
private rect: DOMRect; private rect: DOMRect;
private pos: Vector2 = Vector2.zero; private pos: Vector2 = Vector2.zero;
@@ -27,9 +29,10 @@ export class Shimeji {
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) { constructor(element: HTMLElement, canvas: HTMLCanvasElement, renderer: Renderer) {
this.element = element; this.element = element;
this.canvas= canvas; this.canvas = canvas;
this.renderer = renderer;
this.rect = element.getBoundingClientRect(); this.rect = element.getBoundingClientRect();
this.bounds = { this.bounds = {
@@ -39,7 +42,7 @@ export class Shimeji {
maxY: window.innerHeight maxY: window.innerHeight
}; };
this.pos.set(window.innerWidth / 2, window.innerHeight/ 2); this.pos.set(window.innerWidth / 2, window.innerHeight / 2);
this.updateBounds(); this.updateBounds();
window.addEventListener('resize', () => this.updateBounds()); window.addEventListener('resize', () => this.updateBounds());
@@ -59,6 +62,7 @@ export class Shimeji {
this.canvas.width = window.innerWidth; this.canvas.width = window.innerWidth;
this.canvas.height = window.innerHeight; this.canvas.height = window.innerHeight;
this.renderer.UpdateBounds(window.innerWidth, window.innerHeight);
} }
start(): void { start(): void {
@@ -67,11 +71,11 @@ export class Shimeji {
const firstFrame = (delta: number) => { const firstFrame = (delta: number) => {
this.prevDeltaTime = delta; this.prevDeltaTime = delta;
this.rafId = requestAnimationFrame(animate); this.rafId = requestAnimationFrame(animate);
} };
const animate = (delta: number) => { const animate = (delta: number) => {
let dt = (delta - this.prevDeltaTime) / 1000; // seconds let dt = (delta - this.prevDeltaTime) / 1000;
dt = Math.min(dt, 0.05 * this.TIMESCALE); // cap to 50 ms dt = Math.min(dt, 0.05 * this.TIMESCALE);
this.prevDeltaTime = delta; this.prevDeltaTime = delta;
this.updatePhysics(dt); this.updatePhysics(dt);
@@ -97,11 +101,10 @@ export class Shimeji {
this.element.style.cursor = 'grabbing'; this.element.style.cursor = 'grabbing';
const parent = this.element.parentElement; const parent = this.element.parentElement;
if(parent) parent.style.cursor = 'grabbing'; if (parent) parent.style.cursor = 'grabbing';
this.pivot.x = e.offsetX - this.rect.width / 2; this.pivot.x = e.offsetX - this.rect.width / 2;
this.pivot.y = e.offsetY - this.rect.height / 2; this.pivot.y = e.offsetY - this.rect.height / 2;
}); });
document.addEventListener('mousemove', (e) => { document.addEventListener('mousemove', (e) => {
@@ -110,12 +113,12 @@ export class Shimeji {
}); });
document.addEventListener('mouseup', (e) => { document.addEventListener('mouseup', (e) => {
if(this.isBeingDragged) { if (this.isBeingDragged) {
this.isBeingDragged = false; this.isBeingDragged = false;
this.element.style.cursor = 'grab'; this.element.style.cursor = 'grab';
const parent = this.element.parentElement; const parent = this.element.parentElement;
if(parent) parent.style.cursor = 'auto'; if (parent) parent.style.cursor = 'auto';
this.pivot = Vector2.zero; this.pivot = Vector2.zero;
} }
@@ -159,10 +162,10 @@ export class Shimeji {
if (this.pos.x < leftBound) { if (this.pos.x < leftBound) {
this.pos.x = leftBound; this.pos.x = leftBound;
this.vel.x = -(this.RESTITUTION) * this.vel.x; this.vel.x = -this.RESTITUTION * this.vel.x;
} else if (this.pos.x > rightBound) { } else if (this.pos.x > rightBound) {
this.pos.x = rightBound; this.pos.x = rightBound;
this.vel.x = -(this.RESTITUTION) * this.vel.x; this.vel.x = -this.RESTITUTION * this.vel.x;
} }
const topBound = this.rect.height / 2; const topBound = this.rect.height / 2;
@@ -170,18 +173,18 @@ export class Shimeji {
if (this.pos.y < topBound) { if (this.pos.y < topBound) {
this.pos.y = topBound; this.pos.y = topBound;
this.vel.y = -(this.RESTITUTION) * this.vel.y; this.vel.y = -this.RESTITUTION * this.vel.y;
} else if (this.pos.y > bottomBound) { } else if (this.pos.y > bottomBound) {
this.pos.y = bottomBound; this.pos.y = bottomBound;
this.vel.y = -(this.RESTITUTION) * this.vel.y; this.vel.y = -this.RESTITUTION * this.vel.y;
} }
} }
private drawRay(pos1: {x: number, y: number}, pos2: {x: number, y: number}) { private drawRay(pos1: { x: number; y: number }, pos2: { x: number; y: number }) {
const ctx = this.canvas.getContext("2d")!; const ctx = this.canvas.getContext('2d')!;
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
ctx.strokeStyle = "white"; ctx.strokeStyle = 'white';
ctx.lineWidth = 0.1 ctx.lineWidth = 0.1;
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(pos1.x, pos1.y); ctx.moveTo(pos1.x, pos1.y);
ctx.lineTo(pos2.x, pos2.y); ctx.lineTo(pos2.x, pos2.y);
@@ -190,6 +193,7 @@ export class Shimeji {
private render(): void { private render(): void {
this.element.style.transform = `translate(${this.pos.x}px, ${this.pos.y}px)`; this.element.style.transform = `translate(${this.pos.x}px, ${this.pos.y}px)`;
this.renderer.Draw(this.pos, this.rect.width / 2);
/* if(this.isBeingDragged) { /* if(this.isBeingDragged) {
this.drawRay( this.drawRay(
@@ -204,7 +208,5 @@ export class Shimeji {
this.vel.y += y; this.vel.y += y;
} }
moveTo(pos: number) { moveTo(pos: number) {}
}
} }
+37 -26
View File
@@ -1,58 +1,69 @@
<script lang="ts"> <script lang="ts">
import { Shimeji } from "$lib/stores/shimeji"; import Renderer from '$lib/shimeji/renderer/renderer';
import { onMount } from "svelte"; import { Shimeji } from '$lib/stores/shimeji';
import Vector2 from '$lib/vector';
import { onMount } from 'svelte';
const drag: number = 3; const drag: number = 3;
const speed: number = 2; const speed: number = 2;
let shimeji: Shimeji; let shimeji: Shimeji;
let renderer: Renderer;
let sprite: HTMLElement; let sprite: HTMLElement;
let canvas: HTMLCanvasElement; let canvas: HTMLCanvasElement;
let shown: boolean = $state(false); let shown: boolean = $state(false);
function genRandomPos(min: number, max: number): number{ function genRandomPos(min: number, max: number): number {
const out = Math.random() * (max - min) + min; const out = Math.random() * (max - min) + min;
return out; return out;
} }
onMount(() => { 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();
}
onMount(async () => {
canvas.width = window.innerWidth; canvas.width = window.innerWidth;
canvas.height = window.innerHeight; canvas.height = window.innerHeight;
shimeji = new Shimeji(sprite, canvas); const vert = await fetchShader('src/lib/shimeji/renderer/shaders/vertex_shader.vert');
const frag = await fetchShader('src/lib/shimeji/renderer/shaders/fragment_shader.frag');
console.log(vert, '\n', frag);
renderer = new Renderer(canvas);
await renderer.init();
renderer.Draw(new Vector2(500, 500), 50);
/* shimeji = new Shimeji(sprite, canvas, renderer);
shimeji.start(); shimeji.start();
shown = true; shown = true;
document.addEventListener('keydown', (e) => { document.addEventListener('keydown', (e) => {
if(e.key === 'a') { if (e.key === 'a') {
shimeji.addImpulse(-500, -100); shimeji.addImpulse(-500, -100);
} }
if(e.key === 'd') { if (e.key === 'd') {
shimeji.addImpulse(500, -100); shimeji.addImpulse(500, -100);
} }
if(e.key === 'space') { if (e.key === 'space') {
shimeji.moveTo(genRandomPos(200, window.innerWidth - 200)); shimeji.moveTo(genRandomPos(200, window.innerWidth - 200));
} }
}); */
}); });
return () => {
shimeji.stop();
};
})
</script> </script>
<div class=" absolute z-20 size-full overflow-clip "> <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> <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> 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> </div>
<style>
</style>
-9
View File
@@ -1,9 +0,0 @@
<script lang="ts">
import Shimeji from "../../modules/Shimeji.svelte";
</script>
<Shimeji />