添加关照、全局等高线、修改图层问题

This commit is contained in:
2025-07-17 18:54:05 +08:00
parent c781d38c0c
commit b274b62671
4594 changed files with 791769 additions and 4921 deletions

View File

@ -0,0 +1,42 @@
import Node, { addNodeClass } from '../core/Node.js';
import { float, addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js';
class RemapNode extends Node {
constructor( node, inLowNode, inHighNode, outLowNode = float( 0 ), outHighNode = float( 1 ) ) {
super();
this.node = node;
this.inLowNode = inLowNode;
this.inHighNode = inHighNode;
this.outLowNode = outLowNode;
this.outHighNode = outHighNode;
this.doClamp = true;
}
setup() {
const { node, inLowNode, inHighNode, outLowNode, outHighNode, doClamp } = this;
let t = node.sub( inLowNode ).div( inHighNode.sub( inLowNode ) );
if ( doClamp === true ) t = t.clamp();
return t.mul( outHighNode.sub( outLowNode ) ).add( outLowNode );
}
}
export default RemapNode;
export const remap = nodeProxy( RemapNode, null, null, { doClamp: false } );
export const remapClamp = nodeProxy( RemapNode );
addNodeElement( 'remap', remap );
addNodeElement( 'remapClamp', remapClamp );
addNodeClass( 'RemapNode', RemapNode );