You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
628 B
33 lines
628 B
6 months ago
|
import TempNode from '../core/TempNode.js';
|
||
|
import { addNodeClass } from '../core/Node.js';
|
||
|
import { addNodeElement, nodeProxy } from '../shadernode/ShaderNode.js';
|
||
|
|
||
|
class PosterizeNode extends TempNode {
|
||
|
|
||
|
constructor( sourceNode, stepsNode ) {
|
||
|
|
||
|
super();
|
||
|
|
||
|
this.sourceNode = sourceNode;
|
||
|
this.stepsNode = stepsNode;
|
||
|
|
||
|
}
|
||
|
|
||
|
setup() {
|
||
|
|
||
|
const { sourceNode, stepsNode } = this;
|
||
|
|
||
|
return sourceNode.mul( stepsNode ).floor().div( stepsNode );
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
export default PosterizeNode;
|
||
|
|
||
|
export const posterize = nodeProxy( PosterizeNode );
|
||
|
|
||
|
addNodeElement( 'posterize', posterize );
|
||
|
|
||
|
addNodeClass( 'PosterizeNode', PosterizeNode );
|