update some build/telemetry stuff

This commit is contained in:
41666 2023-10-13 16:59:46 -04:00
parent 51f9f820d8
commit 0a67ccb040
25 changed files with 336 additions and 217 deletions

View file

@ -27,6 +27,8 @@ const results = await Bun.build({
".wgsl": "text",
".vert": "text",
".frag": "text",
".html": "text",
".md": "text",
},
minify: process.env.MINIFY === "false" ? false : true,
plugins: [glslPlugin],

View file

@ -214,42 +214,32 @@ export const convertMeshes = async () => {
: [];
const facesArray: number[] = faces.flatMap((f) => [f.a, f.b, f.c]);
const facesMaxValue = facesArray.reduce(
(acc, face) => (face > acc ? face : acc),
0
);
const facesBitDepth =
facesMaxValue <= 0xff ? 8 : facesMaxValue <= 0xffff ? 16 : 32;
const outFile = file.replace(".ply", ".ts");
const outString = `
import { Mesh } from "../renderer/mesh";
const outString = `import { Mesh } from "../renderer/mesh";
// prettier-ignore
const positions = new Float32Array(${JSON.stringify(positions)});
// prettier-ignore
const colors = ${
vertexConfig.colors ? `new Uint8Array(${JSON.stringify(colors)})` : "null"
};
// prettier-ignore
const uvs = ${
vertexConfig.uvs ? `new Float32Array(${JSON.stringify(uvs)})` : "null"
};
// prettier-ignore
const normals = ${
vertexConfig.normals
? `new Float32Array(${JSON.stringify(normals)})`
: "null"
};
// prettier-ignore
const faces = new Uint32Array(${JSON.stringify(facesArray)});
export default new Mesh({
colors,
faces,
colors: ${
vertexConfig.colors ? `new Uint8Array(${JSON.stringify(colors)})` : "null"
},
faces: new Uint${facesBitDepth}Array(${JSON.stringify(facesArray)}),
name: ${JSON.stringify(file)},
normals,
positions,
uvs,
normals: ${
vertexConfig.normals
? `new Float32Array(${JSON.stringify(normals)})`
: "null"
},
positions: new Float32Array(${JSON.stringify(positions)}),
uvs: ${
vertexConfig.uvs ? `new Float32Array(${JSON.stringify(uvs)})` : "null"
},
vertexCount: ${vertexCount}
});
`;

View file

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<meta charset="utf-8" />
<title>com.mekanoe.art // ##name##</title>
<style>
@ -9,6 +9,7 @@
overflow: hidden;
background-color: black;
color: white;
font-family: Atkinson Hyperlegible, sans-serif;
}
main {
display: flex;
@ -21,8 +22,7 @@
<main>
<canvas id="canvas" width="1280" height="720"></canvas>
<div id="telemetry">XX.X FPS (XX.X ms)</div>
<nav>
##nav##
</nav>
<div id="loading" class="loading-active"><div id="loading-text">[noeidelon] [stage 1]<br />bootstrapping...<span id="stage1-error"><br />this is taking a while...</span><span id="stage1-error2"><br />[panic] <span style="color: red">heck wtf</span></span></div></div>
<nav>##nav##</nav>
</main>
<script src="/##name##/main.js" type="module"></script>