babylon.digitalRainPostProcess.d.ts 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /// <reference path="../../../dist/preview release/babylon.d.ts" />
  2. declare module BABYLON {
  3. /**
  4. * DigitalRainFontTexture is the helper class used to easily create your digital rain font texture.
  5. *
  6. * It basically takes care rendering the font front the given font size to a texture.
  7. * This is used later on in the postprocess.
  8. */
  9. class DigitalRainFontTexture extends BaseTexture {
  10. private _font;
  11. private _text;
  12. private _charSize;
  13. /**
  14. * Gets the size of one char in the texture (each char fits in size * size space in the texture).
  15. */
  16. charSize: number;
  17. /**
  18. * Create a new instance of the Digital Rain FontTexture class
  19. * @param name the name of the texture
  20. * @param font the font to use, use the W3C CSS notation
  21. * @param text the caracter set to use in the rendering.
  22. * @param scene the scene that owns the texture
  23. */
  24. constructor(name: string, font: string, text: string, scene: Scene);
  25. /**
  26. * Gets the max char width of a font.
  27. * @param font the font to use, use the W3C CSS notation
  28. * @return the max char width
  29. */
  30. private getFontWidth(font);
  31. /**
  32. * Gets the max char height of a font.
  33. * @param font the font to use, use the W3C CSS notation
  34. * @return the max char height
  35. */
  36. private getFontHeight(font);
  37. /**
  38. * Clones the current DigitalRainFontTexture.
  39. * @return the clone of the texture.
  40. */
  41. clone(): DigitalRainFontTexture;
  42. /**
  43. * Parses a json object representing the texture and returns an instance of it.
  44. * @param source the source JSON representation
  45. * @param scene the scene to create the texture for
  46. * @return the parsed texture
  47. */
  48. static Parse(source: any, scene: Scene): DigitalRainFontTexture;
  49. }
  50. /**
  51. * Option available in the Digital Rain Post Process.
  52. */
  53. interface IDigitalRainPostProcessOptions {
  54. /**
  55. * The font to use following the w3c font definition.
  56. */
  57. font?: string;
  58. /**
  59. * This defines the amount you want to mix the "tile" or caracter space colored in the digital rain.
  60. * This number is defined between 0 and 1;
  61. */
  62. mixToTile?: number;
  63. /**
  64. * This defines the amount you want to mix the normal rendering pass in the digital rain.
  65. * This number is defined between 0 and 1;
  66. */
  67. mixToNormal?: number;
  68. }
  69. /**
  70. * DigitalRainPostProcess helps rendering everithing in digital rain.
  71. *
  72. * Simmply add it to your scene and let the nerd that lives in you have fun.
  73. * Example usage: var pp = new DigitalRainPostProcess("digitalRain", "20px Monospace", camera);
  74. */
  75. class DigitalRainPostProcess extends PostProcess {
  76. /**
  77. * The font texture used to render the char in the post process.
  78. */
  79. private _digitalRainFontTexture;
  80. /**
  81. * This defines the amount you want to mix the "tile" or caracter space colored in the digital rain.
  82. * This number is defined between 0 and 1;
  83. */
  84. mixToTile: number;
  85. /**
  86. * This defines the amount you want to mix the normal rendering pass in the digital rain.
  87. * This number is defined between 0 and 1;
  88. */
  89. mixToNormal: number;
  90. /**
  91. * Instantiates a new Digital Rain Post Process.
  92. * @param name the name to give to the postprocess
  93. * @camera the camera to apply the post process to.
  94. * @param options can either be the font name or an option object following the IDigitalRainPostProcessOptions format
  95. */
  96. constructor(name: string, camera: Camera, options?: string | IDigitalRainPostProcessOptions);
  97. }
  98. }