Skip to content

Commit

Permalink
chore: fix invalid url in vite examples
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoiver committed Sep 26, 2023
1 parent 70ccb30 commit e251d03
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ node_modules
es
lib
dist
examples/dist
rust/target
coverage

Expand Down
21 changes: 13 additions & 8 deletions examples/demos/cubemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ import {
cubePositionOffset,
cubeUVOffset,
} from '../meshes/cube';
// @ts-ignore
import posx from '../public/images/posx.jpg';
// @ts-ignore
import negx from '../public/images/negx.jpg';
// @ts-ignore
import posy from '../public/images/posy.jpg';
// @ts-ignore
import negy from '../public/images/negy.jpg';
// @ts-ignore
import posz from '../public/images/posz.jpg';
// @ts-ignore
import negz from '../public/images/negz.jpg';

/**
* @see https://webgpu.github.io/webgpu-samples/samples/texturedCube
Expand Down Expand Up @@ -91,14 +103,7 @@ void main() {

// The order of the array layers is [+X, -X, +Y, -Y, +Z, -Z]
const imageBitmaps = await Promise.all(
[
'/images/posx.jpg',
'/images/negx.jpg',
'/images/posy.jpg',
'/images/negy.jpg',
'/images/posz.jpg',
'/images/negz.jpg',
].map(async (src) => loadImage(src)),
[posx, negx, posy, negy, posz, negz].map(async (src) => loadImage(src)),
);

const texture = device.createTexture({
Expand Down
6 changes: 5 additions & 1 deletion examples/demos/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ export async function initExample(
onContextLost: () => {},
onContextRestored(e) {},
});
const shaderCompilerPath = new URL(
'../public/glsl_wgsl_compiler_bg.wasm',
import.meta.url,
).href;
const deviceContributionWebGPU = new WebGPUDeviceContribution({
shaderCompilerPath: '/glsl_wgsl_compiler_bg.wasm',
shaderCompilerPath,
});

let disposeCallback;
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"scripts": {
"dev": "vite dev",
"deploy": "vite build",
"preview": "vite preview",
"build": "rollup -c",
"clean": "rimraf dist",
"eslint": "eslint --ext .ts,.js ./src --quiet",
Expand Down

0 comments on commit e251d03

Please sign in to comment.