SceneNode.js 931 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import Node from '../core/Node.js';
  2. import { addNodeClass } from '../core/Node.js';
  3. import { nodeImmutable } from '../shadernode/ShaderNode.js';
  4. import { reference } from './ReferenceNode.js';
  5. class SceneNode extends Node {
  6. constructor( scope = SceneNode.BACKGROUND_BLURRINESS, scene = null ) {
  7. super();
  8. this.scope = scope;
  9. this.scene = scene;
  10. }
  11. construct( builder ) {
  12. const scope = this.scope;
  13. const scene = this.scene !== null ? this.scene : builder.scene;
  14. let output;
  15. if ( scope === SceneNode.BACKGROUND_BLURRINESS ) {
  16. output = reference( 'backgroundBlurriness', 'float', scene );
  17. } else {
  18. console.error( 'THREE.SceneNode: Unknown scope:', scope );
  19. }
  20. return output;
  21. }
  22. }
  23. SceneNode.BACKGROUND_BLURRINESS = 'backgroundBlurriness';
  24. export default SceneNode;
  25. export const backgroundBlurriness = nodeImmutable( SceneNode, SceneNode.BACKGROUND_BLURRINESS );
  26. addNodeClass( SceneNode );