nodeMaterialBuildState.d.ts 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. import { NodeMaterialBlockConnectionPointTypes } from "./Enums/nodeMaterialBlockConnectionPointTypes";
  2. import { NodeMaterialBlockTargets } from "./Enums/nodeMaterialBlockTargets";
  3. import type { NodeMaterialBuildStateSharedData } from "./nodeMaterialBuildStateSharedData";
  4. /**
  5. * Class used to store node based material build state
  6. */
  7. export declare class NodeMaterialBuildState {
  8. /** Gets or sets a boolean indicating if the current state can emit uniform buffers */
  9. supportUniformBuffers: boolean;
  10. /**
  11. * Gets the list of emitted attributes
  12. */
  13. attributes: string[];
  14. /**
  15. * Gets the list of emitted uniforms
  16. */
  17. uniforms: string[];
  18. /**
  19. * Gets the list of emitted constants
  20. */
  21. constants: string[];
  22. /**
  23. * Gets the list of emitted samplers
  24. */
  25. samplers: string[];
  26. /**
  27. * Gets the list of emitted functions
  28. */
  29. functions: {
  30. [key: string]: string;
  31. };
  32. /**
  33. * Gets the list of emitted extensions
  34. */
  35. extensions: {
  36. [key: string]: string;
  37. };
  38. /**
  39. * Gets the list of emitted prePass outputs - if using the prepass
  40. */
  41. prePassOutput: {
  42. [key: string]: string;
  43. };
  44. /**
  45. * Gets the target of the compilation state
  46. */
  47. target: NodeMaterialBlockTargets;
  48. /**
  49. * Gets the list of emitted counters
  50. */
  51. counters: {
  52. [key: string]: number;
  53. };
  54. /**
  55. * Shared data between multiple NodeMaterialBuildState instances
  56. */
  57. sharedData: NodeMaterialBuildStateSharedData;
  58. /** @internal */
  59. _vertexState: NodeMaterialBuildState;
  60. /** @internal */
  61. _attributeDeclaration: string;
  62. /** @internal */
  63. _uniformDeclaration: string;
  64. /** @internal */
  65. _constantDeclaration: string;
  66. /** @internal */
  67. _samplerDeclaration: string;
  68. /** @internal */
  69. _varyingTransfer: string;
  70. /** @internal */
  71. _injectAtEnd: string;
  72. private _repeatableContentAnchorIndex;
  73. /** @internal */
  74. _builtCompilationString: string;
  75. /**
  76. * Gets the emitted compilation strings
  77. */
  78. compilationString: string;
  79. /**
  80. * Finalize the compilation strings
  81. * @param state defines the current compilation state
  82. */
  83. finalize(state: NodeMaterialBuildState): void;
  84. /** @internal */
  85. get _repeatableContentAnchor(): string;
  86. /**
  87. * @internal
  88. */
  89. _getFreeVariableName(prefix: string): string;
  90. /**
  91. * @internal
  92. */
  93. _getFreeDefineName(prefix: string): string;
  94. /**
  95. * @internal
  96. */
  97. _excludeVariableName(name: string): void;
  98. /**
  99. * @internal
  100. */
  101. _emit2DSampler(name: string): void;
  102. /**
  103. * @internal
  104. */
  105. _emit2DArraySampler(name: string): void;
  106. /**
  107. * @internal
  108. */
  109. _getGLType(type: NodeMaterialBlockConnectionPointTypes): string;
  110. /**
  111. * @internal
  112. */
  113. _emitExtension(name: string, extension: string, define?: string): void;
  114. /**
  115. * @internal
  116. */
  117. _emitFunction(name: string, code: string, comments: string): void;
  118. /**
  119. * @internal
  120. */
  121. _emitCodeFromInclude(includeName: string, comments: string, options?: {
  122. replaceStrings?: {
  123. search: RegExp;
  124. replace: string;
  125. }[];
  126. repeatKey?: string;
  127. substitutionVars?: string;
  128. }): string;
  129. /**
  130. * @internal
  131. */
  132. _emitFunctionFromInclude(includeName: string, comments: string, options?: {
  133. repeatKey?: string;
  134. substitutionVars?: string;
  135. removeAttributes?: boolean;
  136. removeUniforms?: boolean;
  137. removeVaryings?: boolean;
  138. removeIfDef?: boolean;
  139. replaceStrings?: {
  140. search: RegExp;
  141. replace: string;
  142. }[];
  143. }, storeKey?: string): void;
  144. /**
  145. * @internal
  146. */
  147. _registerTempVariable(name: string): boolean;
  148. /**
  149. * @internal
  150. */
  151. _emitVaryingFromString(name: string, type: string, define?: string, notDefine?: boolean): boolean;
  152. /**
  153. * @internal
  154. */
  155. _emitUniformFromString(name: string, type: string, define?: string, notDefine?: boolean): void;
  156. /**
  157. * @internal
  158. */
  159. _emitFloat(value: number): string;
  160. }