babylonjs.postProcess.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. var babylonDependency; try { babylonDependency = BABYLON || (typeof require !== 'undefined' && require("../babylon.max")); } catch (e) { babylonDependency = BABYLON || (typeof require !== 'undefined' && require("babylonjs")); }
  2. var BABYLON = babylonDependency;
  3. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  4. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  5. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  6. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  7. return c > 3 && r && Object.defineProperty(target, key, r), r;
  8. };
  9. var __extends = (this && this.__extends) || (function () {
  10. var extendStatics = Object.setPrototypeOf ||
  11. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  12. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  13. return function (d, b) {
  14. extendStatics(d, b);
  15. function __() { this.constructor = d; }
  16. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  17. };
  18. })();
  19. var BABYLON;
  20. (function (BABYLON) {
  21. /**
  22. * AsciiArtFontTexture is the helper class used to easily create your ascii art font texture.
  23. *
  24. * It basically takes care rendering the font front the given font size to a texture.
  25. * This is used later on in the postprocess.
  26. */
  27. var AsciiArtFontTexture = (function (_super) {
  28. __extends(AsciiArtFontTexture, _super);
  29. /**
  30. * Create a new instance of the Ascii Art FontTexture class
  31. * @param name the name of the texture
  32. * @param font the font to use, use the W3C CSS notation
  33. * @param text the caracter set to use in the rendering.
  34. * @param scene the scene that owns the texture
  35. */
  36. function AsciiArtFontTexture(name, font, text, scene) {
  37. var _this = _super.call(this, scene) || this;
  38. _this.name = name;
  39. _this._text == text;
  40. _this._font == font;
  41. _this.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
  42. _this.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
  43. //this.anisotropicFilteringLevel = 1;
  44. // Get the font specific info.
  45. var maxCharHeight = _this.getFontHeight(font);
  46. var maxCharWidth = _this.getFontWidth(font);
  47. _this._charSize = Math.max(maxCharHeight.height, maxCharWidth);
  48. // This is an approximate size, but should always be able to fit at least the maxCharCount.
  49. var textureWidth = Math.ceil(_this._charSize * text.length);
  50. var textureHeight = _this._charSize;
  51. // Create the texture that will store the font characters.
  52. _this._texture = scene.getEngine().createDynamicTexture(textureWidth, textureHeight, false, BABYLON.Texture.NEAREST_SAMPLINGMODE);
  53. //scene.getEngine().setclamp
  54. var textureSize = _this.getSize();
  55. // Create a canvas with the final size: the one matching the texture.
  56. var canvas = document.createElement("canvas");
  57. canvas.width = textureSize.width;
  58. canvas.height = textureSize.height;
  59. var context = canvas.getContext("2d");
  60. context.textBaseline = "top";
  61. context.font = font;
  62. context.fillStyle = "white";
  63. context.imageSmoothingEnabled = false;
  64. // Sets the text in the texture.
  65. for (var i = 0; i < text.length; i++) {
  66. context.fillText(text[i], i * _this._charSize, -maxCharHeight.offset);
  67. }
  68. // Flush the text in the dynamic texture.
  69. _this.getScene().getEngine().updateDynamicTexture(_this._texture, canvas, false, true);
  70. return _this;
  71. }
  72. Object.defineProperty(AsciiArtFontTexture.prototype, "charSize", {
  73. /**
  74. * Gets the size of one char in the texture (each char fits in size * size space in the texture).
  75. */
  76. get: function () {
  77. return this._charSize;
  78. },
  79. enumerable: true,
  80. configurable: true
  81. });
  82. /**
  83. * Gets the max char width of a font.
  84. * @param font the font to use, use the W3C CSS notation
  85. * @return the max char width
  86. */
  87. AsciiArtFontTexture.prototype.getFontWidth = function (font) {
  88. var fontDraw = document.createElement("canvas");
  89. var ctx = fontDraw.getContext('2d');
  90. ctx.fillStyle = 'white';
  91. ctx.font = font;
  92. return ctx.measureText("W").width;
  93. };
  94. // More info here: https://videlais.com/2014/03/16/the-many-and-varied-problems-with-measuring-font-height-for-html5-canvas/
  95. /**
  96. * Gets the max char height of a font.
  97. * @param font the font to use, use the W3C CSS notation
  98. * @return the max char height
  99. */
  100. AsciiArtFontTexture.prototype.getFontHeight = function (font) {
  101. var fontDraw = document.createElement("canvas");
  102. var ctx = fontDraw.getContext('2d');
  103. ctx.fillRect(0, 0, fontDraw.width, fontDraw.height);
  104. ctx.textBaseline = 'top';
  105. ctx.fillStyle = 'white';
  106. ctx.font = font;
  107. ctx.fillText('jH|', 0, 0);
  108. var pixels = ctx.getImageData(0, 0, fontDraw.width, fontDraw.height).data;
  109. var start = -1;
  110. var end = -1;
  111. for (var row = 0; row < fontDraw.height; row++) {
  112. for (var column = 0; column < fontDraw.width; column++) {
  113. var index = (row * fontDraw.width + column) * 4;
  114. if (pixels[index] === 0) {
  115. if (column === fontDraw.width - 1 && start !== -1) {
  116. end = row;
  117. row = fontDraw.height;
  118. break;
  119. }
  120. continue;
  121. }
  122. else {
  123. if (start === -1) {
  124. start = row;
  125. }
  126. break;
  127. }
  128. }
  129. }
  130. return { height: (end - start) + 1, offset: start - 1 };
  131. };
  132. /**
  133. * Clones the current AsciiArtTexture.
  134. * @return the clone of the texture.
  135. */
  136. AsciiArtFontTexture.prototype.clone = function () {
  137. return new AsciiArtFontTexture(this.name, this._font, this._text, this.getScene());
  138. };
  139. /**
  140. * Parses a json object representing the texture and returns an instance of it.
  141. * @param source the source JSON representation
  142. * @param scene the scene to create the texture for
  143. * @return the parsed texture
  144. */
  145. AsciiArtFontTexture.Parse = function (source, scene) {
  146. var texture = BABYLON.SerializationHelper.Parse(function () { return new AsciiArtFontTexture(source.name, source.font, source.text, scene); }, source, scene, null);
  147. return texture;
  148. };
  149. __decorate([
  150. BABYLON.serialize("font")
  151. ], AsciiArtFontTexture.prototype, "_font", void 0);
  152. __decorate([
  153. BABYLON.serialize("text")
  154. ], AsciiArtFontTexture.prototype, "_text", void 0);
  155. return AsciiArtFontTexture;
  156. }(BABYLON.BaseTexture));
  157. BABYLON.AsciiArtFontTexture = AsciiArtFontTexture;
  158. /**
  159. * AsciiArtPostProcess helps rendering everithing in Ascii Art.
  160. *
  161. * Simmply add it to your scene and let the nerd that lives in you have fun.
  162. * Example usage: var pp = new AsciiArtPostProcess("myAscii", "20px Monospace", camera);
  163. */
  164. var AsciiArtPostProcess = (function (_super) {
  165. __extends(AsciiArtPostProcess, _super);
  166. /**
  167. * Instantiates a new Ascii Art Post Process.
  168. * @param name the name to give to the postprocess
  169. * @camera the camera to apply the post process to.
  170. * @param options can either be the font name or an option object following the IAsciiArtPostProcessOptions format
  171. */
  172. function AsciiArtPostProcess(name, camera, options) {
  173. var _this = _super.call(this, name, 'asciiart', ['asciiArtFontInfos', 'asciiArtOptions'], ['asciiArtFont'], {
  174. width: camera.getEngine().getRenderWidth(),
  175. height: camera.getEngine().getRenderHeight()
  176. }, camera, BABYLON.Texture.TRILINEAR_SAMPLINGMODE, camera.getEngine(), true) || this;
  177. /**
  178. * This defines the amount you want to mix the "tile" or caracter space colored in the ascii art.
  179. * This number is defined between 0 and 1;
  180. */
  181. _this.mixToTile = 0;
  182. /**
  183. * This defines the amount you want to mix the normal rendering pass in the ascii art.
  184. * This number is defined between 0 and 1;
  185. */
  186. _this.mixToNormal = 0;
  187. // Default values.
  188. var font = "40px Monospace";
  189. var characterSet = " `-.'_:,\"=^;<+!*?/cL\\zrs7TivJtC{3F)Il(xZfY5S2eajo14[nuyE]P6V9kXpKwGhqAUbOd8#HRDB0$mgMW&Q%N@";
  190. // Use options.
  191. if (options) {
  192. if (typeof (options) === "string") {
  193. font = options;
  194. }
  195. else {
  196. font = options.font || font;
  197. characterSet = options.characterSet || characterSet;
  198. _this.mixToTile = options.mixToTile || _this.mixToTile;
  199. _this.mixToNormal = options.mixToNormal || _this.mixToNormal;
  200. }
  201. }
  202. _this._asciiArtFontTexture = new AsciiArtFontTexture(name, font, characterSet, camera.getScene());
  203. var textureSize = _this._asciiArtFontTexture.getSize();
  204. _this.onApply = function (effect) {
  205. effect.setTexture("asciiArtFont", _this._asciiArtFontTexture);
  206. effect.setFloat4("asciiArtFontInfos", _this._asciiArtFontTexture.charSize, characterSet.length, textureSize.width, textureSize.height);
  207. effect.setFloat4("asciiArtOptions", _this.width, _this.height, _this.mixToNormal, _this.mixToTile);
  208. };
  209. return _this;
  210. }
  211. return AsciiArtPostProcess;
  212. }(BABYLON.PostProcess));
  213. BABYLON.AsciiArtPostProcess = AsciiArtPostProcess;
  214. })(BABYLON || (BABYLON = {}));
  215. //# sourceMappingURL=babylon.asciiArtPostProcess.js.map
  216. BABYLON.Effect.ShadersStore['asciiartPixelShader'] = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D asciiArtFont;\n\nuniform vec4 asciiArtFontInfos;\nuniform vec4 asciiArtOptions;\n\nfloat getLuminance(vec3 color)\n{\nreturn clamp(dot(color,vec3(0.2126,0.7152,0.0722)),0.,1.);\n}\n\nvoid main(void) \n{\nfloat caracterSize=asciiArtFontInfos.x;\nfloat numChar=asciiArtFontInfos.y-1.0;\nfloat fontx=asciiArtFontInfos.z;\nfloat fonty=asciiArtFontInfos.w;\nfloat screenx=asciiArtOptions.x;\nfloat screeny=asciiArtOptions.y;\nfloat tileX=float(floor((gl_FragCoord.x)/caracterSize))*caracterSize/screenx;\nfloat tileY=float(floor((gl_FragCoord.y)/caracterSize))*caracterSize/screeny;\nvec2 tileUV=vec2(tileX,tileY);\nvec4 tileColor=texture2D(textureSampler,tileUV);\nvec4 baseColor=texture2D(textureSampler,vUV);\nfloat tileLuminance=getLuminance(tileColor.rgb);\nfloat offsetx=(float(floor(tileLuminance*numChar)))*caracterSize/fontx;\nfloat offsety=0.0;\nfloat x=float(mod(gl_FragCoord.x,caracterSize))/fontx;\nfloat y=float(mod(gl_FragCoord.y,caracterSize))/fonty;\nvec4 finalColor=texture2D(asciiArtFont,vec2(offsetx+x,offsety+(caracterSize/fonty-y)));\nfinalColor.rgb*=tileColor.rgb;\nfinalColor.a=1.0;\nfinalColor=mix(finalColor,tileColor,asciiArtOptions.w);\nfinalColor=mix(finalColor,baseColor,asciiArtOptions.z);\ngl_FragColor=finalColor;\n}";
  217. var BABYLON;
  218. (function (BABYLON) {
  219. /**
  220. * DigitalRainFontTexture is the helper class used to easily create your digital rain font texture.
  221. *
  222. * It basically takes care rendering the font front the given font size to a texture.
  223. * This is used later on in the postprocess.
  224. */
  225. var DigitalRainFontTexture = (function (_super) {
  226. __extends(DigitalRainFontTexture, _super);
  227. /**
  228. * Create a new instance of the Digital Rain FontTexture class
  229. * @param name the name of the texture
  230. * @param font the font to use, use the W3C CSS notation
  231. * @param text the caracter set to use in the rendering.
  232. * @param scene the scene that owns the texture
  233. */
  234. function DigitalRainFontTexture(name, font, text, scene) {
  235. var _this = _super.call(this, scene) || this;
  236. _this.name = name;
  237. _this._text == text;
  238. _this._font == font;
  239. _this.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
  240. _this.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
  241. //this.anisotropicFilteringLevel = 1;
  242. // Get the font specific info.
  243. var maxCharHeight = _this.getFontHeight(font);
  244. var maxCharWidth = _this.getFontWidth(font);
  245. _this._charSize = Math.max(maxCharHeight.height, maxCharWidth);
  246. // This is an approximate size, but should always be able to fit at least the maxCharCount.
  247. var textureWidth = _this._charSize;
  248. var textureHeight = Math.ceil(_this._charSize * text.length);
  249. // Create the texture that will store the font characters.
  250. _this._texture = scene.getEngine().createDynamicTexture(textureWidth, textureHeight, false, BABYLON.Texture.NEAREST_SAMPLINGMODE);
  251. //scene.getEngine().setclamp
  252. var textureSize = _this.getSize();
  253. // Create a canvas with the final size: the one matching the texture.
  254. var canvas = document.createElement("canvas");
  255. canvas.width = textureSize.width;
  256. canvas.height = textureSize.height;
  257. var context = canvas.getContext("2d");
  258. context.textBaseline = "top";
  259. context.font = font;
  260. context.fillStyle = "white";
  261. context.imageSmoothingEnabled = false;
  262. // Sets the text in the texture.
  263. for (var i = 0; i < text.length; i++) {
  264. context.fillText(text[i], 0, i * _this._charSize - maxCharHeight.offset);
  265. }
  266. // Flush the text in the dynamic texture.
  267. _this.getScene().getEngine().updateDynamicTexture(_this._texture, canvas, false, true);
  268. return _this;
  269. }
  270. Object.defineProperty(DigitalRainFontTexture.prototype, "charSize", {
  271. /**
  272. * Gets the size of one char in the texture (each char fits in size * size space in the texture).
  273. */
  274. get: function () {
  275. return this._charSize;
  276. },
  277. enumerable: true,
  278. configurable: true
  279. });
  280. /**
  281. * Gets the max char width of a font.
  282. * @param font the font to use, use the W3C CSS notation
  283. * @return the max char width
  284. */
  285. DigitalRainFontTexture.prototype.getFontWidth = function (font) {
  286. var fontDraw = document.createElement("canvas");
  287. var ctx = fontDraw.getContext('2d');
  288. ctx.fillStyle = 'white';
  289. ctx.font = font;
  290. return ctx.measureText("W").width;
  291. };
  292. // More info here: https://videlais.com/2014/03/16/the-many-and-varied-problems-with-measuring-font-height-for-html5-canvas/
  293. /**
  294. * Gets the max char height of a font.
  295. * @param font the font to use, use the W3C CSS notation
  296. * @return the max char height
  297. */
  298. DigitalRainFontTexture.prototype.getFontHeight = function (font) {
  299. var fontDraw = document.createElement("canvas");
  300. var ctx = fontDraw.getContext('2d');
  301. ctx.fillRect(0, 0, fontDraw.width, fontDraw.height);
  302. ctx.textBaseline = 'top';
  303. ctx.fillStyle = 'white';
  304. ctx.font = font;
  305. ctx.fillText('jH|', 0, 0);
  306. var pixels = ctx.getImageData(0, 0, fontDraw.width, fontDraw.height).data;
  307. var start = -1;
  308. var end = -1;
  309. for (var row = 0; row < fontDraw.height; row++) {
  310. for (var column = 0; column < fontDraw.width; column++) {
  311. var index = (row * fontDraw.width + column) * 4;
  312. if (pixels[index] === 0) {
  313. if (column === fontDraw.width - 1 && start !== -1) {
  314. end = row;
  315. row = fontDraw.height;
  316. break;
  317. }
  318. continue;
  319. }
  320. else {
  321. if (start === -1) {
  322. start = row;
  323. }
  324. break;
  325. }
  326. }
  327. }
  328. return { height: (end - start) + 1, offset: start - 1 };
  329. };
  330. /**
  331. * Clones the current DigitalRainFontTexture.
  332. * @return the clone of the texture.
  333. */
  334. DigitalRainFontTexture.prototype.clone = function () {
  335. return new DigitalRainFontTexture(this.name, this._font, this._text, this.getScene());
  336. };
  337. /**
  338. * Parses a json object representing the texture and returns an instance of it.
  339. * @param source the source JSON representation
  340. * @param scene the scene to create the texture for
  341. * @return the parsed texture
  342. */
  343. DigitalRainFontTexture.Parse = function (source, scene) {
  344. var texture = BABYLON.SerializationHelper.Parse(function () { return new DigitalRainFontTexture(source.name, source.font, source.text, scene); }, source, scene, null);
  345. return texture;
  346. };
  347. __decorate([
  348. BABYLON.serialize("font")
  349. ], DigitalRainFontTexture.prototype, "_font", void 0);
  350. __decorate([
  351. BABYLON.serialize("text")
  352. ], DigitalRainFontTexture.prototype, "_text", void 0);
  353. return DigitalRainFontTexture;
  354. }(BABYLON.BaseTexture));
  355. BABYLON.DigitalRainFontTexture = DigitalRainFontTexture;
  356. /**
  357. * DigitalRainPostProcess helps rendering everithing in digital rain.
  358. *
  359. * Simmply add it to your scene and let the nerd that lives in you have fun.
  360. * Example usage: var pp = new DigitalRainPostProcess("digitalRain", "20px Monospace", camera);
  361. */
  362. var DigitalRainPostProcess = (function (_super) {
  363. __extends(DigitalRainPostProcess, _super);
  364. /**
  365. * Instantiates a new Digital Rain Post Process.
  366. * @param name the name to give to the postprocess
  367. * @camera the camera to apply the post process to.
  368. * @param options can either be the font name or an option object following the IDigitalRainPostProcessOptions format
  369. */
  370. function DigitalRainPostProcess(name, camera, options) {
  371. var _this = _super.call(this, name, 'digitalrain', ['digitalRainFontInfos', 'digitalRainOptions', 'cosTimeZeroOne', 'matrixSpeed'], ['digitalRainFont'], {
  372. width: camera.getEngine().getRenderWidth(),
  373. height: camera.getEngine().getRenderHeight()
  374. }, camera, BABYLON.Texture.TRILINEAR_SAMPLINGMODE, camera.getEngine(), true) || this;
  375. /**
  376. * This defines the amount you want to mix the "tile" or caracter space colored in the digital rain.
  377. * This number is defined between 0 and 1;
  378. */
  379. _this.mixToTile = 0;
  380. /**
  381. * This defines the amount you want to mix the normal rendering pass in the digital rain.
  382. * This number is defined between 0 and 1;
  383. */
  384. _this.mixToNormal = 0;
  385. // Default values.
  386. var font = "15px Monospace";
  387. var characterSet = "古池や蛙飛び込む水の音ふるいけやかわずとびこむみずのおと初しぐれ猿も小蓑をほしげ也はつしぐれさるもこみのをほしげなり江戸の雨何石呑んだ時鳥えどのあめなんごくのんだほととぎす";
  388. // Use options.
  389. if (options) {
  390. if (typeof (options) === "string") {
  391. font = options;
  392. }
  393. else {
  394. font = options.font || font;
  395. _this.mixToTile = options.mixToTile || _this.mixToTile;
  396. _this.mixToNormal = options.mixToNormal || _this.mixToNormal;
  397. }
  398. }
  399. _this._digitalRainFontTexture = new DigitalRainFontTexture(name, font, characterSet, camera.getScene());
  400. var textureSize = _this._digitalRainFontTexture.getSize();
  401. var alpha = 0.0;
  402. var cosTimeZeroOne = 0.0;
  403. var matrix = new BABYLON.Matrix();
  404. for (var i = 0; i < 16; i++) {
  405. matrix.m[i] = Math.random();
  406. }
  407. _this.onApply = function (effect) {
  408. effect.setTexture("digitalRainFont", _this._digitalRainFontTexture);
  409. effect.setFloat4("digitalRainFontInfos", _this._digitalRainFontTexture.charSize, characterSet.length, textureSize.width, textureSize.height);
  410. effect.setFloat4("digitalRainOptions", _this.width, _this.height, _this.mixToNormal, _this.mixToTile);
  411. effect.setMatrix("matrixSpeed", matrix);
  412. alpha += 0.003;
  413. cosTimeZeroOne = alpha;
  414. effect.setFloat('cosTimeZeroOne', cosTimeZeroOne);
  415. };
  416. return _this;
  417. }
  418. return DigitalRainPostProcess;
  419. }(BABYLON.PostProcess));
  420. BABYLON.DigitalRainPostProcess = DigitalRainPostProcess;
  421. })(BABYLON || (BABYLON = {}));
  422. //# sourceMappingURL=babylon.digitalRainPostProcess.js.map
  423. BABYLON.Effect.ShadersStore['digitalrainPixelShader'] = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D digitalRainFont;\n\nuniform vec4 digitalRainFontInfos;\nuniform vec4 digitalRainOptions;\nuniform mat4 matrixSpeed;\nuniform float cosTimeZeroOne;\n\nfloat getLuminance(vec3 color)\n{\nreturn clamp(dot(color,vec3(0.2126,0.7152,0.0722)),0.,1.);\n}\n\nvoid main(void) \n{\nfloat caracterSize=digitalRainFontInfos.x;\nfloat numChar=digitalRainFontInfos.y-1.0;\nfloat fontx=digitalRainFontInfos.z;\nfloat fonty=digitalRainFontInfos.w;\nfloat screenx=digitalRainOptions.x;\nfloat screeny=digitalRainOptions.y;\nfloat ratio=screeny/fonty;\nfloat columnx=float(floor((gl_FragCoord.x)/caracterSize));\nfloat tileX=float(floor((gl_FragCoord.x)/caracterSize))*caracterSize/screenx;\nfloat tileY=float(floor((gl_FragCoord.y)/caracterSize))*caracterSize/screeny;\nvec2 tileUV=vec2(tileX,tileY);\nvec4 tileColor=texture2D(textureSampler,tileUV);\nvec4 baseColor=texture2D(textureSampler,vUV);\nfloat tileLuminance=getLuminance(tileColor.rgb);\nint st=int(mod(columnx,4.0));\nfloat speed=cosTimeZeroOne*(sin(tileX*314.5)*0.5+0.6); \nfloat x=float(mod(gl_FragCoord.x,caracterSize))/fontx;\nfloat y=float(mod(speed+gl_FragCoord.y/screeny,1.0));\ny*=ratio;\nvec4 finalColor=texture2D(digitalRainFont,vec2(x,1.0-y));\nvec3 high=finalColor.rgb*(vec3(1.2,1.2,1.2)*pow(1.0-y,30.0));\nfinalColor.rgb*=vec3(pow(tileLuminance,5.0),pow(tileLuminance,1.5),pow(tileLuminance,3.0));\nfinalColor.rgb+=high;\nfinalColor.rgb=clamp(finalColor.rgb,0.,1.);\nfinalColor.a=1.0;\nfinalColor=mix(finalColor,tileColor,digitalRainOptions.w);\nfinalColor=mix(finalColor,baseColor,digitalRainOptions.z);\ngl_FragColor=finalColor;\n}";
  424. (function universalModuleDefinition(root, factory) {
  425. if (root && root["BABYLON"]) {
  426. return;
  427. }
  428. if(typeof exports === 'object' && typeof module === 'object')
  429. module.exports = factory();
  430. else if(typeof define === 'function' && define.amd)
  431. define([], factory);
  432. else if(typeof exports === 'object')
  433. exports["BJSPostProcess"] = factory();
  434. else {
  435. root["BABYLON"] = factory();
  436. }
  437. })(this, function() {
  438. return BABYLON;
  439. });