preact
This commit is contained in:
parent
6acf267d48
commit
b7614eb3f8
4794 changed files with 1280808 additions and 1546 deletions
42
frontend/node_modules/three/examples/jsm/nodes/utils/RemapNode.js
generated
vendored
Normal file
42
frontend/node_modules/three/examples/jsm/nodes/utils/RemapNode.js
generated
vendored
Normal 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 );
|
||||
Loading…
Add table
Add a link
Reference in a new issue