aboutsummaryrefslogtreecommitdiff
path: root/web/pw-visualizer/src/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'web/pw-visualizer/src/index.ts')
-rw-r--r--web/pw-visualizer/src/index.ts23
1 files changed, 14 insertions, 9 deletions
diff --git a/web/pw-visualizer/src/index.ts b/web/pw-visualizer/src/index.ts
index 363a1c5..df2c3c2 100644
--- a/web/pw-visualizer/src/index.ts
+++ b/web/pw-visualizer/src/index.ts
@@ -27,6 +27,7 @@ import { VertexBuffer, IndexBuffer } from "./webgl/buffer";
import { VertexBufferLayout, VertexArray } from "./webgl/vertexBufferLayout";
import { defaultLabelFactory, LabelFactory, Align, Label } from "./webgl/text";
import { VoronoiBuilder } from "./voronoi/voronoi";
+import * as assets from "./assets";
// svg-mesh requires global to exist
(window as any).global = window;
@@ -585,34 +586,38 @@ var meshes: Mesh[];
var shaders: Dictionary<ShaderFactory>;
export async function set_instance(source: string): Promise<GameInstance> {
+ // TODO: embed shader programs
if (!meshes || !shaders) {
- const mesh_promises = ["ship.svg", "earth.svg", "mars.svg", "venus.svg"]
- .map((name) => "/static/res/assets/" + name)
- .map(url_to_mesh);
+ const mesh_promises = [
+ assets.shipSvg,
+ assets.earthSvg,
+ assets.marsSvg,
+ assets.venusSvg,
+ ].map(url_to_mesh);
const shader_promies = [
(async () =>
<[string, ShaderFactory]>[
"normal",
await ShaderFactory.create_factory(
- "/static/shaders/frag/simple.glsl",
- "/static/shaders/vert/simple.glsl"
+ assets.simpleFragmentShader,
+ assets.simpleVertexShader,
),
])(),
(async () =>
<[string, ShaderFactory]>[
"vor",
await ShaderFactory.create_factory(
- "/static/shaders/frag/vor.glsl",
- "/static/shaders/vert/vor.glsl"
+ assets.vorFragmentShader,
+ assets.vorVertexShader,
),
])(),
(async () =>
<[string, ShaderFactory]>[
"image",
await ShaderFactory.create_factory(
- "/static/shaders/frag/image.glsl",
- "/static/shaders/vert/simple.glsl"
+ assets.imageFragmentShader,
+ assets.simpleVertexShader,
),
])(),
];