preact
This commit is contained in:
parent
6acf267d48
commit
b7614eb3f8
4794 changed files with 1280808 additions and 1546 deletions
57
frontend/node_modules/three/examples/jsm/nodes/lighting/LightNode.js
generated
vendored
Normal file
57
frontend/node_modules/three/examples/jsm/nodes/lighting/LightNode.js
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import Node, { addNodeClass } from '../core/Node.js';
|
||||
import { nodeProxy } from '../shadernode/ShaderNode.js';
|
||||
import { objectPosition } from '../accessors/Object3DNode.js';
|
||||
import { cameraViewMatrix } from '../accessors/CameraNode.js';
|
||||
|
||||
class LightNode extends Node {
|
||||
|
||||
constructor( scope = LightNode.TARGET_DIRECTION, light = null ) {
|
||||
|
||||
super();
|
||||
|
||||
this.scope = scope;
|
||||
this.light = light;
|
||||
|
||||
}
|
||||
|
||||
setup() {
|
||||
|
||||
const { scope, light } = this;
|
||||
|
||||
let output = null;
|
||||
|
||||
if ( scope === LightNode.TARGET_DIRECTION ) {
|
||||
|
||||
output = cameraViewMatrix.transformDirection( objectPosition( light ).sub( objectPosition( light.target ) ) );
|
||||
|
||||
}
|
||||
|
||||
return output;
|
||||
|
||||
}
|
||||
|
||||
serialize( data ) {
|
||||
|
||||
super.serialize( data );
|
||||
|
||||
data.scope = this.scope;
|
||||
|
||||
}
|
||||
|
||||
deserialize( data ) {
|
||||
|
||||
super.deserialize( data );
|
||||
|
||||
this.scope = data.scope;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LightNode.TARGET_DIRECTION = 'targetDirection';
|
||||
|
||||
export default LightNode;
|
||||
|
||||
export const lightTargetDirection = nodeProxy( LightNode, LightNode.TARGET_DIRECTION );
|
||||
|
||||
addNodeClass( 'LightNode', LightNode );
|
||||
Loading…
Add table
Add a link
Reference in a new issue