Skip to content

Commit

Permalink
split cpu, gpu versions into folders and change vite setting
Browse files Browse the repository at this point in the history
  • Loading branch information
olimot committed Oct 12, 2024
1 parent b36ae2b commit d618666
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 17 deletions.
14 changes: 5 additions & 9 deletions src/cpu.ts → src/cpu/cpu.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { mat4, vec3 } from "gl-matrix";
import { up } from "./config";
import { listenInputEvents } from "./input";
import polygonize from "./marching-cubes";
import { moveXY, pinchOrbit, rotateOrbit } from "./orbital";
import rawURL from "./u8-mri-200x160x160.raw?url";
import triTableURL from "./u8-tri-table-256x16.bin?url";
import { up } from "../config";
import { listenInputEvents } from "../input";
import polygonize from "../marching-cubes";
import { moveXY, pinchOrbit, rotateOrbit } from "../orbital";
import rawURL from "../u8-mri-200x160x160.raw?url";

const projection = mat4.create();
const target = vec3.fromValues(100, 80, 80);
Expand All @@ -18,9 +17,6 @@ const field = {
depth: 160,
src: new Uint8Array(original.length),
};
export const triTable = await fetch(triTableURL).then(async (res) => {
return new Uint8Array(await res.arrayBuffer());
});

for (let z = 0; z < field.depth; z += 1) {
for (let y = 0; y < field.height; y += 1) {
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions src/gpu.ts → src/gpu/gpu.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { mat4, vec3 } from "gl-matrix";
import { up } from "./config";
import { listenInputEvents } from "./input";
import { up } from "../config";
import { listenInputEvents } from "../input";
import vertSrc from "./marching-cubes.vert?raw";
import { moveXY, pinchOrbit, rotateOrbit } from "./orbital";
import rawURL from "./u8-mri-200x160x160.raw?url";
import triTableURL from "./u8-tri-table-256x16.bin?url";
import { moveXY, pinchOrbit, rotateOrbit } from "../orbital";
import rawURL from "../u8-mri-200x160x160.raw?url";
import triTableURL from "../u8-tri-table-256x16.bin?url";

const projection = mat4.create();
const target = vec3.fromValues(100, 80, 80);
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
<body>
<h1>Marching Cubes</h1>
<p>
<a href="cpu.html">CPU version (typescript)</a>
<a href="cpu">CPU version (typescript)</a>
</p>
<p>
<a href="gpu.html">GPU version (webgl2)</a>
<a href="gpu">GPU version (webgl2)</a>
</p>
</body>
</html>
9 changes: 8 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@ export default defineConfig({
base: "/marching-cubes/",
root: "src",
build: {
target: 'esnext',
target: "esnext",
outDir: "../dist",
emptyOutDir: true,
rollupOptions: {
input: {
main: "src/index.html",
cpu: "src/cpu/index.html",
gpu: "src/gpu/index.html",
},
},
},
});

0 comments on commit d618666

Please sign in to comment.