babylonjs.postProcess.js 24 KB

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