Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LUT Loaders: Add support for FloatType and add docs #745

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}