threepipe
Version:
A modern 3D viewer framework built on top of three.js, written in TypeScript, designed to make creating high-quality, modular, and extensible 3D experiences on the web simple and enjoyable.
54 lines • 4.01 kB
TypeScript
import { ValOrArr, ValOrFunc } from 'ts-browser-helpers';
/**
*
* @param uniforms - object for setting uniform value (like ShaderMaterial.uniforms
* @param propKey - uniform name
* @param thisTarget - if `this` is the uniform (because uniforms = this wont work). It also adds _ in front of the name
*/
export declare function uniform({ uniforms, propKey, thisTarget, onChange }?: {
uniforms?: any;
propKey?: string | symbol;
thisTarget?: boolean;
onChange?: (...args: any[]) => any;
}): PropertyDecorator;
/**
* Decorator to create a three.js style define in this.material or this and bind to a property.
* see also - {@link matDefineBool}
* @param key - define name
* @param customDefines - object for setting define value (like ShaderMaterial.defines), otherwise this.material.defines is taken
* @param thisMat - access this.defines instead of this.material.defines
* @param onChange - function to call when the value changes. The function is called with the following parameters: [key, newVal]. Note: needsUpdate is set to true for this/material if onChange is not provided.
* @param processVal - function that processes the value before setting it.
* @param invProcessVal - function that processes the value before returning it.
*/
export declare function matDefine(key?: string | symbol, customDefines?: any, thisMat?: boolean, onChange?: (...args: any[]) => any, processVal?: (newVal: any) => any, invProcessVal?: (val: any) => any): PropertyDecorator;
/**
* Same as {@link matDefine} but for boolean values. It sets the value to '1' or '0'/undefined.
* @param key - define name
* @param customDefines - object for setting define value (like ShaderMaterial.defines), otherwise this.material.defines is taken
* @param thisMat - access this.defines instead of this.material.defines
* @param onChange - function to call when the value changes. If a string, it is used as a property name in `this` and called. If a function, it is called. The function is called with the following parameters: key, newVal
* @param deleteOnFalse - sets to undefined instead of '0' when false. Note deleteOnFalse doesn't work with tweakpane ui because the value will be undefined.
*/
export declare function matDefineBool(key?: string | symbol, customDefines?: any, thisMat?: boolean, onChange?: (...args: any[]) => any, deleteOnFalse?: boolean): PropertyDecorator;
/**
* Binds a property to a value in an object. If the object is a string, it is used as a property name in `this`.
*
* @param obj - object to bind to. If a string, it is used as a property name in `this`. If a function, it is called and the result is used as the object/string.
* @param key - key to bind to. If a string, it is used as a property name in `this`. If a function, it is called and the result is used as the key/string.
* @param onChange - function to call when the value changes. If a string, it is used as a property name in `this` and called. If a function, it is called. The function is called with the following parameters: key, newVal
* @param onChangeParams - if true, the parameters passed to the onChange function are [key, newVal]. If false, no parameters are passed. Default = `true`
* @param processVal - function that processes the value before setting it.
* @param invProcessVal - function that processes the value before returning it.
* @param allowUndefined - if `false` - when setting the value to `undefined`, the property will be `delete`d. (this could throw an error if it cant be deleted, set to `true` then).
*/
export declare function bindToValue({ obj, key, processVal, invProcessVal, onChange, onChangeParams, allowUndefined }: {
obj?: ValOrFunc<any>;
key?: ValOrFunc<ValOrArr<string | symbol>>;
onChange?: ((...args: any[]) => any) | string;
processVal?: (newVal: any) => any;
invProcessVal?: (val: any) => any;
onChangeParams?: boolean;
allowUndefined?: boolean;
}): PropertyDecorator;
//# sourceMappingURL=../../src/three/utils/decorators.d.ts.map