(
initialObj: any,
uniformOptions: Partial<TextureOptions> | null | undefined,
uniformKeyName: string
)
| 720 | const textureUnits: Map<WebGLTexture, number> = new Map(); |
| 721 | |
| 722 | const prepareTexture = ( |
| 723 | initialObj: any, |
| 724 | uniformOptions: Partial<TextureOptions> | null | undefined, |
| 725 | uniformKeyName: string |
| 726 | ) => { |
| 727 | let obj = initialObj, |
| 728 | dependency: (Node | Bus) | null = null, |
| 729 | result: |
| 730 | | { |
| 731 | directTexture?: WebGLTexture | null; |
| 732 | directTextureSize?: [number, number] | null; |
| 733 | glNode?: Node; |
| 734 | glNodePickBackbuffer?: boolean; |
| 735 | } |
| 736 | | null = null; |
| 737 | |
| 738 | if (typeof obj === "function") { |
| 739 | obj = (obj as AsyncMixed)(this.redraw); |
| 740 | } |
| 741 | |
| 742 | if (!obj) { |
| 743 | if (obj === undefined) { |
| 744 | console.warn( |
| 745 | `${nodeName}, uniform '${uniformKeyName}' is undefined.` + |
| 746 | "If you explicitely want to clear a texture, set it to null." |
| 747 | ); |
| 748 | } |
| 749 | } else if (isBackbuffer(obj)) { |
| 750 | if (!this.drawProps.backbuffering) { |
| 751 | console.warn( |
| 752 | `${nodeName}, uniform ${uniformKeyName}: you must set \`backbuffering\` on Node when using Backbuffer` |
| 753 | ); |
| 754 | } |
| 755 | result = { glNode: this, glNodePickBackbuffer: true }; |
| 756 | } else if (isBackbufferFrom(obj)) { |
| 757 | invariant( |
| 758 | typeof obj === "object", |
| 759 | "invalid backbufferFromNode. Got: %s", |
| 760 | obj |
| 761 | ); |
| 762 | let node = obj.node; |
| 763 | if (node instanceof Bus) { |
| 764 | node = node.getGLRenderableNode(); |
| 765 | invariant( |
| 766 | node, |
| 767 | "backbufferFromNode(bus) but bus.getGLRenderableNode() is %s", |
| 768 | node |
| 769 | ); |
| 770 | } |
| 771 | invariant( |
| 772 | node instanceof Node, |
| 773 | "invalid backbufferFromNode(obj): obj must be an instanceof Node or Bus. Got: %s", |
| 774 | obj |
| 775 | ); |
| 776 | if (!node.drawProps.backbuffering) { |
| 777 | console.warn( |
| 778 | `${nodeName}, uniform ${uniformKeyName}: you must set \`backbuffering\` on the Node referenced in backbufferFrom(${node.getGLName()})` |
| 779 | ); |
nothing calls this directly
no test coverage detected