Skip to content

Commit

Permalink
Use LUT loaders from three
Browse files Browse the repository at this point in the history
  • Loading branch information
vanruesc committed Dec 17, 2023
1 parent 8984378 commit 4b72db4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
2 changes: 2 additions & 0 deletions manual/assets/js/libs/vendor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export * from "three";
export * from "three/examples/jsm/loaders/GLTFLoader.js";
export * from "three/examples/jsm/loaders/LUT3dlLoader.js";
export * from "three/examples/jsm/loaders/LUTCubeLoader.js";

export { ControlMode, SpatialControls } from "spatial-controls";
export { Pane } from "tweakpane";
22 changes: 12 additions & 10 deletions manual/assets/js/src/demos/lut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import {
ClampToEdgeWrapping,
LinearFilter,
LoadingManager,
PerspectiveCamera,
PlaneGeometry,
Mesh,
MeshBasicMaterial,
PerspectiveCamera,
PlaneGeometry,
Scene,
SRGBColorSpace,
TextureLoader,
WebGLRenderer,
Texture,
SRGBColorSpace
WebGLRenderer
} from "three";

import {
Expand All @@ -19,12 +19,12 @@ import {
GeometryPass,
LookupTexture,
// LUT3DEffect,
LUT3dlLoader,
LUTCubeLoader,
RawImageData,
RenderPipeline
} from "postprocessing";

import { LUT3dlLoader } from "three/examples/jsm/loaders/LUT3dlLoader.js";
import { LUTCubeLoader } from "three/examples/jsm/loaders/LUTCubeLoader.js";
import { Pane } from "tweakpane";
import * as EssentialsPlugin from "@tweakpane/plugin-essentials";
import { ControlMode, SpatialControls } from "spatial-controls";
Expand Down Expand Up @@ -90,21 +90,23 @@ function load(): Promise<Map<string, unknown>> {

} else if(/.3dl$/im.test(entry[1])) {

lut3dlLoader.load(`${document.baseURI}img/textures/lut/${entry[1]}`, (t) => {
lut3dlLoader.load(`${document.baseURI}img/textures/lut/${entry[1]}`, (data) => {

const t = LookupTexture.from(data.texture3D);
t.name = entry[0];
assets.set(entry[0], t);

}).catch((e) => console.error(e));
});

} else if(/.cube$/im.test(entry[1])) {

lutCubeLoader.load(`${document.baseURI}img/textures/lut/${entry[1]}`, (t) => {
lutCubeLoader.load(`${document.baseURI}img/textures/lut/${entry[1]}`, (data) => {

const t = LookupTexture.from(data.texture3D);
t.name = entry[0];
assets.set(entry[0], t);

}).catch((e) => console.error(e));
});

} else {

Expand Down
2 changes: 2 additions & 0 deletions manual/assets/js/src/shims/require.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export function require(name: string): unknown {

case "three":
case "three/examples/jsm/loaders/GLTFLoader.js":
case "three/examples/jsm/loaders/LUT3dlLoader.js":
case "three/examples/jsm/loaders/LUTCubeLoader.js":
case "tweakpane":
case "spatial-controls":
return window.VENDOR;
Expand Down

0 comments on commit 4b72db4

Please sign in to comment.