Newer
Older
HuangJiPC / public / static / three / examples / jsm / nodes / accessors / ReflectVectorNode.js
@zhangdeliang zhangdeliang on 21 Jun 548 bytes update
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;