Skip to content

Commit

Permalink
Adopt importmaps in WebGPU examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Feb 26, 2021
1 parent 8514f00 commit 494b342
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/jsm/renderers/webgpu/WebGPUBackground.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GPULoadOp } from './constants.js';
import { Color } from '../../../../build/three.module.js';
import { Color } from 'three';

let _clearAlpha;
const _clearColor = new Color();
Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/renderers/webgpu/WebGPURenderPipelines.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
NoBlending, NormalBlending, AdditiveBlending, SubtractiveBlending, MultiplyBlending, CustomBlending,
AddEquation, SubtractEquation, ReverseSubtractEquation, MinEquation, MaxEquation,
ZeroFactor, OneFactor, SrcColorFactor, OneMinusSrcColorFactor, SrcAlphaFactor, OneMinusSrcAlphaFactor, DstAlphaFactor, OneMinusDstAlphaFactor, DstColorFactor, OneMinusDstColorFactor, SrcAlphaSaturateFactor
} from '../../../../build/three.module.js';
} from 'three';

class WebGPURenderPipelines {

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/renderers/webgpu/WebGPURenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import WebGPUNodes from './nodes/WebGPUNodes.js';

import glslang from '../../libs/glslang.js';

import { Frustum, Matrix4, Vector3, Color } from '../../../../build/three.module.js';
import { Frustum, Matrix4, Vector3, Color } from 'three';

console.info( 'THREE.WebGPURenderer: Modified Matrix4.makePerspective() and Matrix4.makeOrtographic() to work with WebGPU, see https://github.com/mrdoob/three.js/issues/20276.' );

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/renderers/webgpu/WebGPUTextureRenderer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WebGLRenderTarget } from '../../../../build/three.module.js';
import { WebGLRenderTarget } from 'three';

class WebGPUTextureRenderer {

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/renderers/webgpu/WebGPUTextures.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GPUTextureFormat, GPUAddressMode, GPUFilterMode, GPUTextureDimension } from './constants.js';
import { CubeTexture, Texture, NearestFilter, NearestMipmapNearestFilter, NearestMipmapLinearFilter, LinearFilter, RepeatWrapping, MirroredRepeatWrapping,
RGBFormat, RGBAFormat, RedFormat, RGFormat, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, UnsignedByteType, FloatType, HalfFloatType, sRGBEncoding
} from '../../../../build/three.module.js';
} from 'three';
import WebGPUTextureUtils from './WebGPUTextureUtils.js';

class WebGPUTextures {
Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/renderers/webgpu/WebGPUUniform.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Color, Matrix3, Matrix4, Vector2, Vector3, Vector4 } from '../../../../build/three.module.js';
import { Color, Matrix3, Matrix4, Vector2, Vector3, Vector4 } from 'three';

class WebGPUUniform {

Expand Down
9 changes: 8 additions & 1 deletion examples/webgpu_compute.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,16 @@
<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> WebGPU - Compute<br/>(Chrome Canary with flag: --enable-unsafe-webgpu)
</div>

<script type="importmap">
{
"imports": {
"three": "../build/three.module.js"
}
}
</script>
<script type="module">

import * as THREE from '../build/three.module.js';
import * as THREE from 'three';

import WebGPURenderer from './jsm/renderers/webgpu/WebGPURenderer.js';
import WebGPU from './jsm/renderers/webgpu/WebGPU.js';
Expand Down
9 changes: 8 additions & 1 deletion examples/webgpu_instance_uniform.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@
<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - webgpu materials
</div>

<script type="importmap">
{
"imports": {
"three": "../build/three.module.js"
}
}
</script>
<script type="module">

import * as THREE from '../build/three.module.js';
import * as THREE from 'three';

import WebGPURenderer from './jsm/renderers/webgpu/WebGPURenderer.js';
import WebGPU from './jsm/renderers/webgpu/WebGPU.js';
Expand Down
9 changes: 8 additions & 1 deletion examples/webgpu_materials.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@
<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - webgpu materials
</div>

<script type="importmap">
{
"imports": {
"three": "../build/three.module.js"
}
}
</script>
<script type="module">

import * as THREE from '../build/three.module.js';
import * as THREE from 'three';

import WebGPURenderer from './jsm/renderers/webgpu/WebGPURenderer.js';
import WebGPU from './jsm/renderers/webgpu/WebGPU.js';
Expand Down
9 changes: 8 additions & 1 deletion examples/webgpu_rtt.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,16 @@
<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> WebGPU - RTT<br/>(Chrome Canary with flag: --enable-unsafe-webgpu)
</div>

<script type="importmap">
{
"imports": {
"three": "../build/three.module.js"
}
}
</script>
<script type="module">

import * as THREE from '../build/three.module.js';
import * as THREE from 'three';

import WebGPURenderer from './jsm/renderers/webgpu/WebGPURenderer.js';
import WebGPUTextureRenderer from './jsm/renderers/webgpu/WebGPUTextureRenderer.js';
Expand Down
9 changes: 8 additions & 1 deletion examples/webgpu_sandbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,16 @@
<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> WebGPU - sandbox<br/>(Chrome Canary with flag: --enable-unsafe-webgpu)
</div>

<script type="importmap">
{
"imports": {
"three": "../build/three.module.js"
}
}
</script>
<script type="module">

import * as THREE from '../build/three.module.js';
import * as THREE from 'three';

import { DDSLoader } from './jsm/loaders/DDSLoader.js';

Expand Down

0 comments on commit 494b342

Please sign in to comment.