IPipelineContext.d.ts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. import type { Nullable } from "../types";
  2. import type { Effect } from "../Materials/effect";
  3. import type { IMatrixLike, IVector2Like, IVector3Like, IVector4Like, IColor3Like, IColor4Like, IQuaternionLike } from "../Maths/math.like";
  4. /**
  5. * Class used to store and describe the pipeline context associated with an effect
  6. */
  7. export interface IPipelineContext {
  8. /**
  9. * Gets a boolean indicating that this pipeline context is supporting asynchronous creating
  10. */
  11. readonly isAsync: boolean;
  12. /**
  13. * Gets a boolean indicating that the context is ready to be used (like shaders / pipelines are compiled and ready for instance)
  14. */
  15. readonly isReady: boolean;
  16. /** @internal */
  17. _name?: string;
  18. /** @internal */
  19. _getVertexShaderCode(): string | null;
  20. /** @internal */
  21. _getFragmentShaderCode(): string | null;
  22. /** @internal */
  23. _handlesSpectorRebuildCallback?(onCompiled: (compiledObject: any) => void): void;
  24. /** @internal */
  25. _fillEffectInformation(effect: Effect, uniformBuffersNames: {
  26. [key: string]: number;
  27. }, uniformsNames: string[], uniforms: {
  28. [key: string]: Nullable<WebGLUniformLocation>;
  29. }, samplerList: string[], samplers: {
  30. [key: string]: number;
  31. }, attributesNames: string[], attributes: number[]): void;
  32. /** Releases the resources associated with the pipeline. */
  33. dispose(): void;
  34. /**
  35. * Sets an integer value on a uniform variable.
  36. * @param uniformName Name of the variable.
  37. * @param value Value to be set.
  38. */
  39. setInt(uniformName: string, value: number): void;
  40. /**
  41. * Sets an int2 value on a uniform variable.
  42. * @param uniformName Name of the variable.
  43. * @param x First int in int2.
  44. * @param y Second int in int2.
  45. */
  46. setInt2(uniformName: string, x: number, y: number): void;
  47. /**
  48. * Sets an int3 value on a uniform variable.
  49. * @param uniformName Name of the variable.
  50. * @param x First int in int3.
  51. * @param y Second int in int3.
  52. * @param z Third int in int3.
  53. */
  54. setInt3(uniformName: string, x: number, y: number, z: number): void;
  55. /**
  56. * Sets an int4 value on a uniform variable.
  57. * @param uniformName Name of the variable.
  58. * @param x First int in int4.
  59. * @param y Second int in int4.
  60. * @param z Third int in int4.
  61. * @param w Fourth int in int4.
  62. */
  63. setInt4(uniformName: string, x: number, y: number, z: number, w: number): void;
  64. /**
  65. * Sets an int array on a uniform variable.
  66. * @param uniformName Name of the variable.
  67. * @param array array to be set.
  68. */
  69. setIntArray(uniformName: string, array: Int32Array): void;
  70. /**
  71. * Sets an int array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)
  72. * @param uniformName Name of the variable.
  73. * @param array array to be set.
  74. */
  75. setIntArray2(uniformName: string, array: Int32Array): void;
  76. /**
  77. * Sets an int array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)
  78. * @param uniformName Name of the variable.
  79. * @param array array to be set.
  80. */
  81. setIntArray3(uniformName: string, array: Int32Array): void;
  82. /**
  83. * Sets an int array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)
  84. * @param uniformName Name of the variable.
  85. * @param array array to be set.
  86. */
  87. setIntArray4(uniformName: string, array: Int32Array): void;
  88. /**
  89. * Sets an unsigned integer value on a uniform variable.
  90. * @param uniformName Name of the variable.
  91. * @param value Value to be set.
  92. */
  93. setUInt(uniformName: string, value: number): void;
  94. /**
  95. * Sets an unsigned int2 value on a uniform variable.
  96. * @param uniformName Name of the variable.
  97. * @param x First unsigned int in uint2.
  98. * @param y Second unsigned int in uint2.
  99. */
  100. setUInt2(uniformName: string, x: number, y: number): void;
  101. /**
  102. * Sets an unsigned int3 value on a uniform variable.
  103. * @param uniformName Name of the variable.
  104. * @param x First unsigned int in uint3.
  105. * @param y Second unsigned int in uint3.
  106. * @param z Third unsigned int in uint3.
  107. */
  108. setUInt3(uniformName: string, x: number, y: number, z: number): void;
  109. /**
  110. * Sets an unsigned int4 value on a uniform variable.
  111. * @param uniformName Name of the variable.
  112. * @param x First unsigned int in uint4.
  113. * @param y Second unsigned int in uint4.
  114. * @param z Third unsigned int in uint4.
  115. * @param w Fourth unsigned int in uint4.
  116. */
  117. setUInt4(uniformName: string, x: number, y: number, z: number, w: number): void;
  118. /**
  119. * Sets an unsigned int array on a uniform variable.
  120. * @param uniformName Name of the variable.
  121. * @param array array to be set.
  122. */
  123. setUIntArray(uniformName: string, array: Uint32Array): void;
  124. /**
  125. * Sets an unsigned int array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)
  126. * @param uniformName Name of the variable.
  127. * @param array array to be set.
  128. */
  129. setUIntArray2(uniformName: string, array: Uint32Array): void;
  130. /**
  131. * Sets an unsigned int array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)
  132. * @param uniformName Name of the variable.
  133. * @param array array to be set.
  134. */
  135. setUIntArray3(uniformName: string, array: Uint32Array): void;
  136. /**
  137. * Sets an unsigned int array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)
  138. * @param uniformName Name of the variable.
  139. * @param array array to be set.
  140. */
  141. setUIntArray4(uniformName: string, array: Uint32Array): void;
  142. /**
  143. * Sets an array on a uniform variable.
  144. * @param uniformName Name of the variable.
  145. * @param array array to be set.
  146. */
  147. setArray(uniformName: string, array: number[] | Float32Array): void;
  148. /**
  149. * Sets an array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)
  150. * @param uniformName Name of the variable.
  151. * @param array array to be set.
  152. */
  153. setArray2(uniformName: string, array: number[] | Float32Array): void;
  154. /**
  155. * Sets an array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)
  156. * @param uniformName Name of the variable.
  157. * @param array array to be set.
  158. */
  159. setArray3(uniformName: string, array: number[] | Float32Array): void;
  160. /**
  161. * Sets an array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)
  162. * @param uniformName Name of the variable.
  163. * @param array array to be set.
  164. */
  165. setArray4(uniformName: string, array: number[] | Float32Array): void;
  166. /**
  167. * Sets matrices on a uniform variable.
  168. * @param uniformName Name of the variable.
  169. * @param matrices matrices to be set.
  170. */
  171. setMatrices(uniformName: string, matrices: Float32Array): void;
  172. /**
  173. * Sets matrix on a uniform variable.
  174. * @param uniformName Name of the variable.
  175. * @param matrix matrix to be set.
  176. */
  177. setMatrix(uniformName: string, matrix: IMatrixLike): void;
  178. /**
  179. * Sets a 3x3 matrix on a uniform variable. (Specified as [1,2,3,4,5,6,7,8,9] will result in [1,2,3][4,5,6][7,8,9] matrix)
  180. * @param uniformName Name of the variable.
  181. * @param matrix matrix to be set.
  182. */
  183. setMatrix3x3(uniformName: string, matrix: Float32Array): void;
  184. /**
  185. * Sets a 2x2 matrix on a uniform variable. (Specified as [1,2,3,4] will result in [1,2][3,4] matrix)
  186. * @param uniformName Name of the variable.
  187. * @param matrix matrix to be set.
  188. */
  189. setMatrix2x2(uniformName: string, matrix: Float32Array): void;
  190. /**
  191. * Sets a float on a uniform variable.
  192. * @param uniformName Name of the variable.
  193. * @param value value to be set.
  194. */
  195. setFloat(uniformName: string, value: number): void;
  196. /**
  197. * Sets a Vector2 on a uniform variable.
  198. * @param uniformName Name of the variable.
  199. * @param vector2 vector2 to be set.
  200. */
  201. setVector2(uniformName: string, vector2: IVector2Like): void;
  202. /**
  203. * Sets a float2 on a uniform variable.
  204. * @param uniformName Name of the variable.
  205. * @param x First float in float2.
  206. * @param y Second float in float2.
  207. */
  208. setFloat2(uniformName: string, x: number, y: number): void;
  209. /**
  210. * Sets a Vector3 on a uniform variable.
  211. * @param uniformName Name of the variable.
  212. * @param vector3 Value to be set.
  213. */
  214. setVector3(uniformName: string, vector3: IVector3Like): void;
  215. /**
  216. * Sets a float3 on a uniform variable.
  217. * @param uniformName Name of the variable.
  218. * @param x First float in float3.
  219. * @param y Second float in float3.
  220. * @param z Third float in float3.
  221. */
  222. setFloat3(uniformName: string, x: number, y: number, z: number): void;
  223. /**
  224. * Sets a Vector4 on a uniform variable.
  225. * @param uniformName Name of the variable.
  226. * @param vector4 Value to be set.
  227. */
  228. setVector4(uniformName: string, vector4: IVector4Like): void;
  229. /**
  230. * Sets a Quaternion on a uniform variable.
  231. * @param uniformName Name of the variable.
  232. * @param quaternion Value to be set.
  233. */
  234. setQuaternion(uniformName: string, quaternion: IQuaternionLike): void;
  235. /**
  236. * Sets a float4 on a uniform variable.
  237. * @param uniformName Name of the variable.
  238. * @param x First float in float4.
  239. * @param y Second float in float4.
  240. * @param z Third float in float4.
  241. * @param w Fourth float in float4.
  242. */
  243. setFloat4(uniformName: string, x: number, y: number, z: number, w: number): void;
  244. /**
  245. * Sets a Color3 on a uniform variable.
  246. * @param uniformName Name of the variable.
  247. * @param color3 Value to be set.
  248. */
  249. setColor3(uniformName: string, color3: IColor3Like): void;
  250. /**
  251. * Sets a Color4 on a uniform variable.
  252. * @param uniformName Name of the variable.
  253. * @param color3 Value to be set.
  254. * @param alpha Alpha value to be set.
  255. */
  256. setColor4(uniformName: string, color3: IColor3Like, alpha: number): void;
  257. /**
  258. * Sets a Color4 on a uniform variable
  259. * @param uniformName defines the name of the variable
  260. * @param color4 defines the value to be set
  261. */
  262. setDirectColor4(uniformName: string, color4: IColor4Like): void;
  263. }