Skip to content

Commit

Permalink
Moved images to assets folder
Browse files Browse the repository at this point in the history
  • Loading branch information
cmhhelgeson committed Oct 27, 2023
1 parent f623eb8 commit 02a942d
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 6 deletions.
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
File renamed without changes
3 changes: 3 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ module.exports = {
basePath: BASE_PATH,
compress: true,
reactStrictMode: true,
eslint: {
ignoreDuringBuilds: true,
},
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
config.module.rules.push({
test: /\.(png|jpe?g|gif|webm)$/i,
Expand Down
4 changes: 2 additions & 2 deletions src/sample/normalMap/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import normalMapWGSL from './normalMap.wgsl';
import { createMeshRenderable } from '../../meshes/mesh';
import { createBoxMeshWithTangents } from '../../meshes/box';
import {
PBRDescriptor,
createPBRDescriptor,
createBindGroupDescriptor,
create3DRenderPipeline,
createPBRDescriptor,
PBRDescriptor,
} from './utils';

const MAT4X4_BYTES = 64;
Expand Down
8 changes: 4 additions & 4 deletions src/sample/normalMap/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export const createPBRDescriptor = async (
device: GPUDevice,
urls: string[]
): Promise<PBRDescriptor> => {
const imgAssetPrepend = '/img/';
const imgAssetPrepend = '../../../assets/img/';
const loads = urls.map((url) => {
const splits = url.split('_');
const ttype = splits[splits.length - 1].split('.')[0];
Expand All @@ -234,11 +234,11 @@ export const createPBRDescriptor = async (
console.log(loads);
const pbr: PBRDescriptor = {};
for (let i = 0; i < loads.length; i++) {
console.log(loads[i].url);
console.log(import.meta.url);
let texture: GPUTexture;
{
const response = await fetch(loads[i].url);
const url = new URL(loads[i].url, import.meta.url).toString();
console.log(url);
const response = await fetch(url);
const imageBitmap = await createImageBitmap(await response.blob());
texture = createTextureFromImage(device, imageBitmap);
}
Expand Down
5 changes: 5 additions & 0 deletions src/sample/texturedCube/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ const init: SampleInit = async ({ canvas, pageState }) => {
// Fetch the image and upload it into a GPUTexture.
let cubeTexture: GPUTexture;
{
const url = new URL(
'../../../assets/img/Di-3d.png',
import.meta.url
).toString();
console.log(url);
const response = await fetch(
new URL('../../../assets/img/Di-3d.png', import.meta.url).toString()
);
Expand Down

0 comments on commit 02a942d

Please sign in to comment.