shaderCodeNode.ts 602 B

123456789101112131415161718192021222324252627
  1. /** @hidden */
  2. export class ShaderCodeNode {
  3. line: string;
  4. children: ShaderCodeNode[] = [];
  5. isValid(preprocessors: { [key: string]: string }): boolean {
  6. return true;
  7. }
  8. process(preprocessors: { [key: string]: string }): string {
  9. if (!this.isValid(preprocessors)) {
  10. return "";
  11. }
  12. let result = "";
  13. if (this.line) {
  14. result += this.line + "\r\n";
  15. }
  16. this.children.forEach(child => {
  17. result += child.process(preprocessors);
  18. });
  19. return result;
  20. }
  21. }