Modernize project

This commit is contained in:
2025-11-06 16:32:41 +01:00
parent d28d7896de
commit 501949828d
13 changed files with 55 additions and 30 deletions

View File

@@ -4,8 +4,8 @@
<meta charset="utf-8">
<title>oktaeder example</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="bundle.css">
<script type="module" src="bundle.js"></script>
<link rel="stylesheet" href="style.css">
<script type="module" src="script.ts"></script>
</head>
<body></body>
</html>

View File

@@ -1,10 +1,10 @@
/// <reference types="../node_modules/@webgpu/types" />
/// <reference path="types.d.ts" />
import { Color, Mesh, Node, PerspectiveCamera, PointLight, Quaternion, Scene, Submesh, Vector3 } from "../src/data/index";
import { Renderer, degToRad } from "../src/oktaeder";
import "./style.css";
new EventSource("/esbuild").addEventListener("change", () => location.reload());
import uvmapUrl from "./uvmap.png";
const canvas = document.createElement("canvas");
window.addEventListener("resize", onResize);
@@ -66,7 +66,7 @@ const submesh: Submesh = { start: 0, length: 24 };
const mesh = new Mesh({ vertexBuffer, indexBuffer, submeshes: [submesh] });
const imageBitmap = await loadImageBitmap("/uvmap.png");
const imageBitmap = await loadImageBitmap(uvmapUrl);
const texture = renderer.createTexture({
format: "srgb",

4
example/types.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
declare module "*.png" {
const url: string;
export default url;
}