@three3d/effect
Version:
@three3d/effect 提供了 ThreeJS 的特效
66 lines • 2.98 kB
TypeScript
import type { Material, Shader } from "three";
import { type OnBeforeCompile, type ModifiedMaterial } from "../onBeforeCompile";
/**
* lengthDrawRange 增加的 uniforms
*/
export declare const lengthDrawRange_uniforms: {
invert: boolean;
enableStart: boolean;
enableEnd: boolean;
startLength: number;
endLength: number;
};
/**
* 针对于一切带有 lineDistance attribute 的几何体的材质的顶点着色器增加的代码
* @remarks
* 对于除 LineDashedMaterial 之外的材质的顶点着色器增加的代码
*/
export declare const lengthDrawRange_vertex_mainReplace = "\nattribute float lineDistance;\nvarying float vLineDistance;\nvoid main() {\n vLineDistance = lineDistance;\n";
/**
* 针对于一切带有 lineDistance attribute 的几何体的材质的片元着色器增加的代码片段
* @remarks
* 对于除 LineDashedMaterial 之外的材质的顶点着色器增加的代码
*/
export declare const lengthDrawRange_fragment_pars_mainReplace = "\nvarying float vLineDistance;\n";
/**
* lengthDrawRange 的片元着色器中增加的核心代码
*/
export declare const lengthDrawRange_fragment_mainReplace = "\nuniform bool invert;\nuniform bool enableStart;\nuniform bool enableEnd;\n\nuniform float startLength;\nuniform float endLength;\nvoid main() {\n bool startDiscard = enableStart && vLineDistance < startLength;\n bool endDiscard = enableEnd && vLineDistance > endLength;\n bool isDiscard = startDiscard || endDiscard;\n if (invert){\n isDiscard = !isDiscard;\n }\n if (isDiscard) discard;\n";
/**
* 针对于一切带有 lineDistance attribute 的几何体的材质的 shader 的修改器
* @remarks
* Mender 都是用于 `createOnBeforeCompile` 方法的
* 对于除 LineDashedMaterial 之外的材质的顶点着色器增加的代码
* @param shader
*/
export declare function lengthDrawRange_Mender(shader: Shader): void;
/**
* 针对于 LineDashedMaterial 材质的 shader 的修改器
* @remarks
* Mender 都是用于 `createOnBeforeCompile` 方法的
* @param shader
*/
export declare function lineDashedLengthDrawRange_Mender(shader: Shader): void;
/**
* 针对于一切带有 lineDistance attribute 的几何体的材质的 onBeforeCompile 函数
*/
export declare const lengthDrawRange_onBeforeCompile: OnBeforeCompile;
/**
* 针对于 LineDashedMaterial 材质的 onBeforeCompile 函数
*/
export declare const lineDashedLengthDrawRange_onBeforeCompile: OnBeforeCompile;
/**
* 用于一切带有 lineDistance attribute 的几何体的材质的长度范围渲染的材质修改器
* @remarks
* 材质被修改后可具备设置渲染指定长度范围内的线的功能
* @param material
* @returns
*/
export declare function lengthDrawRangeModifier<M extends Material>(material: M): ModifiedMaterial<M, {
invert: boolean;
enableStart: boolean;
enableEnd: boolean;
startLength: number;
endLength: number;
}>;
//# sourceMappingURL=lengthDrawRange.d.ts.map