Skip to content

Make an Export to X option #560

@greggman

Description

@greggman

It's nice to be able to edit the sample easily so consider making an [Export to X] where X is any service that supports multiple files.

The biggest issue is that the files need to URLs changed when uploaded.

Example:

import { mat4 } from 'wgpu-matrix';

import sampleCubemapWGSL from './sampleCubemap.wgsl';
import { quitIfWebGPUNotAvailableOrMissingFeatures } from '../util';

...

let cubemapTexture: GPUTexture;
{
  // The order of the array layers is [+X, -X, +Y, -Y, +Z, -Z]
  const imgSrcs = [
    '../../assets/img/cubemap/posx.jpg',
    '../../assets/img/cubemap/negx.jpg',
    '../../assets/img/cubemap/posy.jpg',
    '../../assets/img/cubemap/negy.jpg',
    '../../assets/img/cubemap/posz.jpg',
    '../../assets/img/cubemap/negz.jpg',
  ];
  const promises = imgSrcs.map(async (src) => {

Need to change to

import { mat4 } from 'https://unpkg.com/wgpu-matrix@latest/dist/3.x/wgpu-matrix.module.js';  // <- CHANGED

import sampleCubemapWGSL from './sampleCubemap.wgsl';
import { quitIfWebGPUNotAvailableOrMissingFeatures } from '../util';  // <- CHANGE?

...

let cubemapTexture: GPUTexture;
{
  // The order of the array layers is [+X, -X, +Y, -Y, +Z, -Z]
  const imgSrcs = [
    'https://webgpu.github.io/webgpu-samples/assets/img/cubemap/posx.jpg',  // <- CHANGED
    'https://webgpu.github.io/webgpu-samples/assets/img/cubemap/negx.jpg',  // <- CHANGED
    'https://webgpu.github.io/webgpu-samples/assets/img/cubemap/posy.jpg',  // <- CHANGED
    'https://webgpu.github.io/webgpu-samples/assets/img/cubemap/negy.jpg',  // <- CHANGED
    'https://webgpu.github.io/webgpu-samples/assets/img/cubemap/posz.jpg',  // <- CHANGED
    'https://webgpu.github.io/webgpu-samples/assets/img/cubemap/negz.jpg',  // <- CHANGED
  ];
  const promises = imgSrcs.map(async (src) => {

Of course you could just import the entire repo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions