babylonjs.postProcess.d.ts 7.7 KB

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