NodeBuilderState.js 883 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. class NodeBuilderState {
  2. constructor( vertexShader, fragmentShader, computeShader, nodeAttributes, bindings, updateNodes, updateBeforeNodes, updateAfterNodes, transforms = [] ) {
  3. this.vertexShader = vertexShader;
  4. this.fragmentShader = fragmentShader;
  5. this.computeShader = computeShader;
  6. this.transforms = transforms;
  7. this.nodeAttributes = nodeAttributes;
  8. this.bindings = bindings;
  9. this.updateNodes = updateNodes;
  10. this.updateBeforeNodes = updateBeforeNodes;
  11. this.updateAfterNodes = updateAfterNodes;
  12. this.usedTimes = 0;
  13. }
  14. createBindings() {
  15. const bindingsArray = [];
  16. for ( const instanceBinding of this.bindings ) {
  17. let binding = instanceBinding;
  18. if ( instanceBinding.shared !== true ) {
  19. binding = instanceBinding.clone();
  20. }
  21. bindingsArray.push( binding );
  22. }
  23. return bindingsArray;
  24. }
  25. }
  26. export default NodeBuilderState;