Skip to content

Commit

Permalink
LUT Loaders: Add support for FloatType and add docs (#745)
Browse files Browse the repository at this point in the history
  • Loading branch information
Methuselah96 authored Jan 16, 2024
1 parent 373ada1 commit 3c808f7
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 4 deletions.
31 changes: 29 additions & 2 deletions types/three/examples/jsm/loaders/LUT3dlLoader.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,40 @@
import { Loader, LoadingManager, DataTexture, Data3DTexture } from '../../../src/Three.js';
import { Loader, LoadingManager, DataTexture, Data3DTexture, UnsignedByteType, FloatType } from '../../../src/Three.js';

export interface LUT3dlResult {
size: number;
texture: DataTexture;
texture3D: Data3DTexture;
}

/**
* A 3D LUT loader that supports the .3dl file format.
*
* Based on the following references:
*
* http://download.autodesk.com/us/systemdocs/help/2011/lustre/index.html?url=./files/WSc4e151a45a3b785a24c3d9a411df9298473-7ffd.htm,topicNumber=d0e9492
* https://community.foundry.com/discuss/topic/103636/format-spec-for-3dl?mode=Post&postID=895258
*/
export class LUT3dlLoader extends Loader<LUT3dlResult> {
type: typeof UnsignedByteType | typeof FloatType;

/**
* Creates a new {@link LUT3dlLoader}.
* @param manager The LoadingManager to use. Defaults to {@link DefaultLoadingManager}
*/
constructor(manager?: LoadingManager);

parse(data: string): LUT3dlResult;
/**
* Sets the desired texture type. Only {@link THREE.UnsignedByteType} and {@link THREE.FloatType} are supported. The
* default is {@link THREE.UnsignedByteType}.
* @param type The texture type. See the Textures texture constants page for details.
*/
setType(type: typeof UnsignedByteType | typeof FloatType): this;

/**
* Parse a 3dl data string and fire {@link onLoad} callback when complete. The argument to {@link onLoad} will be an
* object containing the following LUT data: {@link LUT3dlResult.size}, {@link LUT3dlResult.texture} and
* {@link LUT3dlResult.texture3D}.
* @param input The 3dl data string.
*/
parse(input: string): LUT3dlResult;
}
39 changes: 37 additions & 2 deletions types/three/examples/jsm/loaders/LUTCubeLoader.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { Loader, LoadingManager, Vector3, DataTexture, Data3DTexture } from '../../../src/Three.js';
import {
Loader,
LoadingManager,
Vector3,
DataTexture,
Data3DTexture,
UnsignedByteType,
FloatType,
} from '../../../src/Three.js';

export interface LUTCubeResult {
title: string;
Expand All @@ -9,8 +17,35 @@ export interface LUTCubeResult {
texture3D: Data3DTexture;
}

/**
* A 3D LUT loader that supports the .cube file format.
*
* Based on the following reference:
*
* https://wwwimages2.adobe.com/content/dam/acom/en/products/speedgrade/cc/pdfs/cube-lut-specification-1.0.pdf
*/
export class LUTCubeLoader extends Loader<LUTCubeResult> {
type: typeof UnsignedByteType | typeof FloatType;

/**
* Creates a new {@link LUTCubeLoader}.
* @param manager The LoadingManager to use. Defaults to {@link DefaultLoadingManager}
*/
constructor(manager?: LoadingManager);

parse(data: string): LUTCubeResult;
/**
* Sets the desired texture type. Only {@link THREE.UnsignedByteType} and {@link THREE.FloatType} are supported. The
* default is {@link THREE.UnsignedByteType}.
* @param type The texture type. See the Textures texture constants page for details.
*/
setType(type: typeof UnsignedByteType | typeof FloatType): this;

/**
* Parse a cube data string and fire {@link onLoad} callback when complete. The argument to {@link onLoad} will be
* an object containing the following LUT data: {@link LUTCubeResult.title}, {@link LUTCubeResult.size},
* {@link LUTCubeResult.domainMin}, {@link LUTCubeResult.domainMax}, {@link LUTCubeResult.texture} and
* {@link LUTCubeResult.texture3D}.
* @param input The cube data string.
*/
parse(input: string): LUTCubeResult;
}

0 comments on commit 3c808f7

Please sign in to comment.