babylonjs.postProcess.module.d.ts 7.8 KB

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