ReflectVectorNode.js 548 B

12345678910111213141516171819202122232425262728293031
  1. import Node from '../core/Node.js';
  2. import {
  3. transformedNormalView, positionViewDirection,
  4. transformDirection, negate, reflect, cameraViewMatrix
  5. } from '../shadernode/ShaderNodeBaseElements.js';
  6. class ReflectVectorNode extends Node {
  7. constructor() {
  8. super( 'vec3' );
  9. }
  10. getHash( /*builder*/ ) {
  11. return 'reflectVector';
  12. }
  13. construct() {
  14. const reflectView = reflect( negate( positionViewDirection ), transformedNormalView );
  15. return transformDirection( reflectView, cameraViewMatrix );
  16. }
  17. }
  18. export default ReflectVectorNode;