ModelNode.js 634 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import Node from '../core/Node.js';
  2. import Matrix4Node from '../inputs/Matrix4Node.js';
  3. import { NodeUpdateType } from '../core/constants.js';
  4. class ModelNode extends Node {
  5. static VIEW = 'view';
  6. constructor( scope = ModelNode.VIEW ) {
  7. super( 'mat4' );
  8. this.scope = scope;
  9. this.updateType = NodeUpdateType.Object;
  10. this._inputNode = new Matrix4Node( null );
  11. }
  12. update( frame ) {
  13. const object = frame.object;
  14. const inputNode = this._inputNode;
  15. inputNode.value = object.modelViewMatrix;
  16. }
  17. generate( builder, output ) {
  18. return this._inputNode.build( builder, output );
  19. }
  20. }
  21. export default ModelNode;