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.
32 lines
548 B
32 lines
548 B
2 years ago
|
import Node from '../core/Node.js';
|
||
|
import {
|
||
|
transformedNormalView, positionViewDirection,
|
||
|
transformDirection, negate, reflect, cameraViewMatrix
|
||
|
} from '../shadernode/ShaderNodeBaseElements.js';
|
||
|
|
||
|
class ReflectVectorNode extends Node {
|
||
|
|
||
|
constructor() {
|
||
|
|
||
|
super( 'vec3' );
|
||
|
|
||
|
}
|
||
|
|
||
|
getHash( /*builder*/ ) {
|
||
|
|
||
|
return 'reflectVector';
|
||
|
|
||
|
}
|
||
|
|
||
|
construct() {
|
||
|
|
||
|
const reflectView = reflect( negate( positionViewDirection ), transformedNormalView );
|
||
|
|
||
|
return transformDirection( reflectView, cameraViewMatrix );
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
export default ReflectVectorNode;
|