babylonjs.postProcess.module.d.ts 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. declare module 'babylonjs-post-process' {
  2. export = BABYLON;
  3. }
  4. declare module BABYLON {
  5. /**
  6. * AsciiArtFontTexture is the helper class used to easily create your ascii art font texture.
  7. *
  8. * It basically takes care rendering the font front the given font size to a texture.
  9. * This is used later on in the postprocess.
  10. */
  11. class AsciiArtFontTexture extends BaseTexture {
  12. private _font;
  13. private _text;
  14. private _charSize;
  15. /**
  16. * Gets the size of one char in the texture (each char fits in size * size space in the texture).
  17. */
  18. readonly charSize: number;
  19. /**
  20. * Create a new instance of the Ascii Art FontTexture class
  21. * @param name the name of the texture
  22. * @param font the font to use, use the W3C CSS notation
  23. * @param text the caracter set to use in the rendering.
  24. * @param scene the scene that owns the texture
  25. */
  26. constructor(name: string, font: string, text: string, scene?: Nullable<Scene>);
  27. /**
  28. * Gets the max char width of a font.
  29. * @param font the font to use, use the W3C CSS notation
  30. * @return the max char width
  31. */
  32. private getFontWidth(font);
  33. /**
  34. * Gets the max char height of a font.
  35. * @param font the font to use, use the W3C CSS notation
  36. * @return the max char height
  37. */
  38. private getFontHeight(font);
  39. /**
  40. * Clones the current AsciiArtTexture.
  41. * @return the clone of the texture.
  42. */
  43. clone(): AsciiArtFontTexture;
  44. /**
  45. * Parses a json object representing the texture and returns an instance of it.
  46. * @param source the source JSON representation
  47. * @param scene the scene to create the texture for
  48. * @return the parsed texture
  49. */
  50. static Parse(source: any, scene: Scene): AsciiArtFontTexture;
  51. }
  52. /**
  53. * Option available in the Ascii Art Post Process.
  54. */
  55. interface IAsciiArtPostProcessOptions {
  56. /**
  57. * The font to use following the w3c font definition.
  58. */
  59. font?: string;
  60. /**
  61. * The character set to use in the postprocess.
  62. */
  63. characterSet?: string;
  64. /**
  65. * This defines the amount you want to mix the "tile" or caracter space colored in the ascii art.
  66. * This number is defined between 0 and 1;
  67. */
  68. mixToTile?: number;
  69. /**
  70. * This defines the amount you want to mix the normal rendering pass in the ascii art.
  71. * This number is defined between 0 and 1;
  72. */
  73. mixToNormal?: number;
  74. }
  75. /**
  76. * AsciiArtPostProcess helps rendering everithing in Ascii Art.
  77. *
  78. * Simmply add it to your scene and let the nerd that lives in you have fun.
  79. * Example usage: var pp = new AsciiArtPostProcess("myAscii", "20px Monospace", camera);
  80. */
  81. class AsciiArtPostProcess extends PostProcess {
  82. /**
  83. * The font texture used to render the char in the post process.
  84. */
  85. private _asciiArtFontTexture;
  86. /**
  87. * This defines the amount you want to mix the "tile" or caracter space colored in the ascii art.
  88. * This number is defined between 0 and 1;
  89. */
  90. mixToTile: number;
  91. /**
  92. * This defines the amount you want to mix the normal rendering pass in the ascii art.
  93. * This number is defined between 0 and 1;
  94. */
  95. mixToNormal: number;
  96. /**
  97. * Instantiates a new Ascii Art Post Process.
  98. * @param name the name to give to the postprocess
  99. * @camera the camera to apply the post process to.
  100. * @param options can either be the font name or an option object following the IAsciiArtPostProcessOptions format
  101. */
  102. constructor(name: string, camera: Camera, options?: string | IAsciiArtPostProcessOptions);
  103. }
  104. }
  105. declare module BABYLON {
  106. /**
  107. * DigitalRainFontTexture is the helper class used to easily create your digital rain font texture.
  108. *
  109. * It basically takes care rendering the font front the given font size to a texture.
  110. * This is used later on in the postprocess.
  111. */
  112. class DigitalRainFontTexture extends BaseTexture {
  113. private _font;
  114. private _text;
  115. private _charSize;
  116. /**
  117. * Gets the size of one char in the texture (each char fits in size * size space in the texture).
  118. */
  119. readonly charSize: number;
  120. /**
  121. * Create a new instance of the Digital Rain FontTexture class
  122. * @param name the name of the texture
  123. * @param font the font to use, use the W3C CSS notation
  124. * @param text the caracter set to use in the rendering.
  125. * @param scene the scene that owns the texture
  126. */
  127. constructor(name: string, font: string, text: string, scene?: Nullable<Scene>);
  128. /**
  129. * Gets the max char width of a font.
  130. * @param font the font to use, use the W3C CSS notation
  131. * @return the max char width
  132. */
  133. private getFontWidth(font);
  134. /**
  135. * Gets the max char height of a font.
  136. * @param font the font to use, use the W3C CSS notation
  137. * @return the max char height
  138. */
  139. private getFontHeight(font);
  140. /**
  141. * Clones the current DigitalRainFontTexture.
  142. * @return the clone of the texture.
  143. */
  144. clone(): DigitalRainFontTexture;
  145. /**
  146. * Parses a json object representing the texture and returns an instance of it.
  147. * @param source the source JSON representation
  148. * @param scene the scene to create the texture for
  149. * @return the parsed texture
  150. */
  151. static Parse(source: any, scene: Scene): DigitalRainFontTexture;
  152. }
  153. /**
  154. * Option available in the Digital Rain Post Process.
  155. */
  156. interface IDigitalRainPostProcessOptions {
  157. /**
  158. * The font to use following the w3c font definition.
  159. */
  160. font?: string;
  161. /**
  162. * This defines the amount you want to mix the "tile" or caracter space colored in the digital rain.
  163. * This number is defined between 0 and 1;
  164. */
  165. mixToTile?: number;
  166. /**
  167. * This defines the amount you want to mix the normal rendering pass in the digital rain.
  168. * This number is defined between 0 and 1;
  169. */
  170. mixToNormal?: number;
  171. }
  172. /**
  173. * DigitalRainPostProcess helps rendering everithing in digital rain.
  174. *
  175. * Simmply add it to your scene and let the nerd that lives in you have fun.
  176. * Example usage: var pp = new DigitalRainPostProcess("digitalRain", "20px Monospace", camera);
  177. */
  178. class DigitalRainPostProcess extends PostProcess {
  179. /**
  180. * The font texture used to render the char in the post process.
  181. */
  182. private _digitalRainFontTexture;
  183. /**
  184. * This defines the amount you want to mix the "tile" or caracter space colored in the digital rain.
  185. * This number is defined between 0 and 1;
  186. */
  187. mixToTile: number;
  188. /**
  189. * This defines the amount you want to mix the normal rendering pass in the digital rain.
  190. * This number is defined between 0 and 1;
  191. */
  192. mixToNormal: number;
  193. /**
  194. * Instantiates a new Digital Rain Post Process.
  195. * @param name the name to give to the postprocess
  196. * @camera the camera to apply the post process to.
  197. * @param options can either be the font name or an option object following the IDigitalRainPostProcessOptions format
  198. */
  199. constructor(name: string, camera: Camera, options?: string | IDigitalRainPostProcessOptions);
  200. }
  201. }