@babylonjs/post-processes 7.3.0 → 7.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"asciiArtPostProcess.js","sourceRoot":"","sources":["../../../../dev/postProcesses/src/asciiArt/asciiArtPostProcess.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,2CAA6B;AACjD,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,WAAW,EAAE,0DAA4C;AAClE,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAE1D,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAE7D,qEAAuD;AACvD,OAAO,qBAAqB,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,OAAO,mBAAoB,SAAQ,WAAW;IAShD;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,IAAY,EAAE,IAAY,EAAE,QAAyB,IAAI;QAC/E,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAExB,IAAI,CAAC,KAAK,EAAE;YACR,OAAO;SACV;QAED,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC;QACnB,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC;QAEnB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,iBAAiB,CAAC;QACvC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,iBAAiB,CAAC;QACvC,qCAAqC;QAErC,8BAA8B;QAC9B,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAE9C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E,CAAC;QAExD,IAAI,CAAC,OAAO,GAAG,CAAC,MAAc,EAAE,EAAE;YAC9B,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;YAE7D,MAAM,CAAC,SAAS,CAAC,mBAAmB,EAAE,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;YAEtI,MAAM,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACnG,CAAC,CAAC;IACN,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport type { Camera } from \"core/Cameras/camera\";\r\nimport { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport type { Effect } from \"core/Materials/effect\";\r\nimport { PostProcess } from \"core/PostProcesses/postProcess\";\r\nimport type { Scene } from \"core/scene\";\r\nimport \"core/Engines/Extensions/engine.dynamicTexture\";\r\nimport \"./asciiart.fragment\";\r\n\r\n/**\r\n * AsciiArtFontTexture is the helper class used to easily create your ascii art font texture.\r\n *\r\n * It basically takes care rendering the font front the given font size to a texture.\r\n * This is used later on in the postprocess.\r\n */\r\nexport class AsciiArtFontTexture extends BaseTexture {\r\n @serialize(\"font\")\r\n private _font: string;\r\n\r\n @serialize(\"text\")\r\n private _text: string;\r\n\r\n private _charSize: number;\r\n\r\n /**\r\n * Gets the size of one char in the texture (each char fits in size * size space in the texture).\r\n */\r\n public get charSize(): number {\r\n return this._charSize;\r\n }\r\n\r\n /**\r\n * Create a new instance of the Ascii Art FontTexture class\r\n * @param name the name of the texture\r\n * @param font the font to use, use the W3C CSS notation\r\n * @param text the caracter set to use in the rendering.\r\n * @param scene the scene that owns the texture\r\n */\r\n constructor(name: string, font: string, text: string, scene: Nullable<Scene> = null) {\r\n super(scene);\r\n\r\n scene = this.getScene();\r\n\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n this.name = name;\r\n this._text == text;\r\n this._font == font;\r\n\r\n this.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n //this.anisotropicFilteringLevel = 1;\r\n\r\n // Get the font specific info.\r\n const maxCharHeight = this._getFontHeight(font);\r\n const maxCharWidth = this._getFontWidth(font);\r\n\r\n this._charSize = Math.max(maxCharHeight.height, maxCharWidth);\r\n\r\n // This is an approximate size, but should always be able to fit at least the maxCharCount.\r\n const textureWidth = Math.ceil(this._charSize * text.length);\r\n const textureHeight = this._charSize;\r\n\r\n // Create the texture that will store the font characters.\r\n this._texture = scene.getEngine().createDynamicTexture(textureWidth, textureHeight, false, Texture.NEAREST_SAMPLINGMODE);\r\n //scene.getEngine().setclamp\r\n const textureSize = this.getSize();\r\n\r\n // Create a canvas with the final size: the one matching the texture.\r\n const canvas = document.createElement(\"canvas\");\r\n canvas.width = textureSize.width;\r\n canvas.height = textureSize.height;\r\n const context = <CanvasRenderingContext2D>canvas.getContext(\"2d\");\r\n context.textBaseline = \"top\";\r\n context.font = font;\r\n context.fillStyle = \"white\";\r\n context.imageSmoothingEnabled = false;\r\n\r\n // Sets the text in the texture.\r\n for (let i = 0; i < text.length; i++) {\r\n context.fillText(text[i], i * this._charSize, -maxCharHeight.offset);\r\n }\r\n\r\n // Flush the text in the dynamic texture.\r\n\r\n scene.getEngine().updateDynamicTexture(this._texture, canvas, false, true);\r\n }\r\n\r\n /**\r\n * Gets the max char width of a font.\r\n * @param font the font to use, use the W3C CSS notation\r\n * @returns the max char width\r\n */\r\n private _getFontWidth(font: string): number {\r\n const fontDraw = document.createElement(\"canvas\");\r\n const ctx = <CanvasRenderingContext2D>fontDraw.getContext(\"2d\");\r\n ctx.fillStyle = \"white\";\r\n ctx.font = font;\r\n\r\n return ctx.measureText(\"W\").width;\r\n }\r\n\r\n // More info here: https://videlais.com/2014/03/16/the-many-and-varied-problems-with-measuring-font-height-for-html5-canvas/\r\n /**\r\n * Gets the max char height of a font.\r\n * @param font the font to use, use the W3C CSS notation\r\n * @returns the max char height\r\n */\r\n private _getFontHeight(font: string): { height: number; offset: number } {\r\n const fontDraw = document.createElement(\"canvas\");\r\n const ctx = <CanvasRenderingContext2D>fontDraw.getContext(\"2d\");\r\n ctx.fillRect(0, 0, fontDraw.width, fontDraw.height);\r\n ctx.textBaseline = \"top\";\r\n ctx.fillStyle = \"white\";\r\n ctx.font = font;\r\n ctx.fillText(\"jH|\", 0, 0);\r\n const pixels = ctx.getImageData(0, 0, fontDraw.width, fontDraw.height).data;\r\n let start = -1;\r\n let end = -1;\r\n for (let row = 0; row < fontDraw.height; row++) {\r\n for (let column = 0; column < fontDraw.width; column++) {\r\n const index = (row * fontDraw.width + column) * 4;\r\n if (pixels[index] === 0) {\r\n if (column === fontDraw.width - 1 && start !== -1) {\r\n end = row;\r\n row = fontDraw.height;\r\n break;\r\n }\r\n continue;\r\n } else {\r\n if (start === -1) {\r\n start = row;\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n return { height: end - start + 1, offset: start - 1 };\r\n }\r\n\r\n /**\r\n * Clones the current AsciiArtTexture.\r\n * @returns the clone of the texture.\r\n */\r\n public clone(): AsciiArtFontTexture {\r\n return new AsciiArtFontTexture(this.name, this._font, this._text, this.getScene());\r\n }\r\n\r\n /**\r\n * Parses a json object representing the texture and returns an instance of it.\r\n * @param source the source JSON representation\r\n * @param scene the scene to create the texture for\r\n * @returns the parsed texture\r\n */\r\n public static Parse(source: any, scene: Scene): AsciiArtFontTexture {\r\n const texture = SerializationHelper.Parse(() => new AsciiArtFontTexture(source.name, source.font, source.text, scene), source, scene, null);\r\n\r\n return texture;\r\n }\r\n}\r\n\r\n/**\r\n * Option available in the Ascii Art Post Process.\r\n */\r\nexport interface IAsciiArtPostProcessOptions {\r\n /**\r\n * The font to use following the w3c font definition.\r\n */\r\n font?: string;\r\n\r\n /**\r\n * The character set to use in the postprocess.\r\n */\r\n characterSet?: string;\r\n\r\n /**\r\n * This defines the amount you want to mix the \"tile\" or caracter space colored in the ascii art.\r\n * This number is defined between 0 and 1;\r\n */\r\n mixToTile?: number;\r\n\r\n /**\r\n * This defines the amount you want to mix the normal rendering pass in the ascii art.\r\n * This number is defined between 0 and 1;\r\n */\r\n mixToNormal?: number;\r\n}\r\n\r\n/**\r\n * AsciiArtPostProcess helps rendering everithing in Ascii Art.\r\n *\r\n * Simmply add it to your scene and let the nerd that lives in you have fun.\r\n * Example usage: var pp = new AsciiArtPostProcess(\"myAscii\", \"20px Monospace\", camera);\r\n */\r\nexport class AsciiArtPostProcess extends PostProcess {\r\n /**\r\n * The font texture used to render the char in the post process.\r\n */\r\n private _asciiArtFontTexture: AsciiArtFontTexture;\r\n\r\n /**\r\n * This defines the amount you want to mix the \"tile\" or caracter space colored in the ascii art.\r\n * This number is defined between 0 and 1;\r\n */\r\n public mixToTile: number = 0;\r\n\r\n /**\r\n * This defines the amount you want to mix the normal rendering pass in the ascii art.\r\n * This number is defined between 0 and 1;\r\n */\r\n public mixToNormal: number = 0;\r\n\r\n /**\r\n * Instantiates a new Ascii Art Post Process.\r\n * @param name the name to give to the postprocess\r\n * @camera the camera to apply the post process to.\r\n * @param camera\r\n * @param options can either be the font name or an option object following the IAsciiArtPostProcessOptions format\r\n */\r\n constructor(name: string, camera: Nullable<Camera>, options?: string | IAsciiArtPostProcessOptions) {\r\n super(name, \"asciiart\", [\"asciiArtFontInfos\", \"asciiArtOptions\"], [\"asciiArtFont\"], 1, camera, Texture.TRILINEAR_SAMPLINGMODE, undefined, true);\r\n\r\n // Default values.\r\n let font = \"40px Monospace\";\r\n let characterSet = \" `-.'_:,\\\"=^;<+!*?/cL\\\\zrs7TivJtC{3F)Il(xZfY5S2eajo14[nuyE]P6V9kXpKwGhqAUbOd8#HRDB0$mgMW&Q%N@\";\r\n\r\n // Use options.\r\n if (options) {\r\n if (typeof options === \"string\") {\r\n font = <string>options;\r\n } else {\r\n font = (<IAsciiArtPostProcessOptions>options).font || font;\r\n characterSet = (<IAsciiArtPostProcessOptions>options).characterSet || characterSet;\r\n this.mixToTile = (<IAsciiArtPostProcessOptions>options).mixToTile || this.mixToTile;\r\n this.mixToNormal = (<IAsciiArtPostProcessOptions>options).mixToNormal || this.mixToNormal;\r\n }\r\n }\r\n\r\n const scene = camera?.getScene() || this._scene;\r\n this._asciiArtFontTexture = new AsciiArtFontTexture(name, font, characterSet, scene);\r\n const textureSize = this._asciiArtFontTexture.getSize();\r\n\r\n this.onApply = (effect: Effect) => {\r\n effect.setTexture(\"asciiArtFont\", this._asciiArtFontTexture);\r\n\r\n effect.setFloat4(\"asciiArtFontInfos\", this._asciiArtFontTexture.charSize, characterSet.length, textureSize.width, textureSize.height);\r\n\r\n effect.setFloat4(\"asciiArtOptions\", this.width, this.height, this.mixToNormal, this.mixToTile);\r\n };\r\n }\r\n}\r\n"]}
|
1
|
+
{"version":3,"file":"asciiArtPostProcess.js","sourceRoot":"","sources":["../../../../dev/postProcesses/src/asciiArt/asciiArtPostProcess.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,2CAA6B;AACjD,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,WAAW,EAAE,0DAA4C;AAClE,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAE1D,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAE7D,qEAAuD;AACvD,OAAO,qBAAqB,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,OAAO,mBAAoB,SAAQ,WAAW;IAShD;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;;;;;;OAMG;IACH,YAAY,IAAY,EAA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C7B,IAAI,GAAW,OAAO,CAAC;aAC1B;iBAAM;gBACH,IAAI,GAAiC,OAAQ,CAAC,IAAI,IAAI,IAAI,CAAC;gBAC3D,YAAY,GAAiC,OAAQ,CAAC,YAAY,IAAI,YAAY,CAAC;gBACnF,IAAI,CAAC,SAAS,GAAiC,OAAQ,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC;gBACpF,IAAI,CAAC,WAAW,GAAiC,OAAQ,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC;aAC7F;SACJ;QAED,MAAM,KAAK,GAAG,MAAM,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC;QAChD,IAAI,CAAC,oBAAoB,GAAG,IAAI,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;QACrF,MAAM,WAAW,GAAG,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC;QAExD,IAAI,CAAC,OAAO,GAAG,CAAC,MAAc,EAAE,EAAE;YAC9B,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;YAE7D,MAAM,CAAC,SAAS,CAAC,mBAAmB,EAAE,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;YAEtI,MAAM,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACnG,CAAC,CAAC;IACN,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport type { Camera } from \"core/Cameras/camera\";\r\nimport { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport type { Effect } from \"core/Materials/effect\";\r\nimport { PostProcess } from \"core/PostProcesses/postProcess\";\r\nimport type { Scene } from \"core/scene\";\r\nimport \"core/Engines/Extensions/engine.dynamicTexture\";\r\nimport \"./asciiart.fragment\";\r\n\r\n/**\r\n * AsciiArtFontTexture is the helper class used to easily create your ascii art font texture.\r\n *\r\n * It basically takes care rendering the font front the given font size to a texture.\r\n * This is used later on in the postprocess.\r\n */\r\nexport class AsciiArtFontTexture extends BaseTexture {\r\n @serialize(\"font\")\r\n private _font: string;\r\n\r\n @serialize(\"text\")\r\n private _text: string;\r\n\r\n private _charSize: number;\r\n\r\n /**\r\n * Gets the size of one char in the texture (each char fits in size * size space in the texture).\r\n */\r\n public get charSize(): number {\r\n return this._charSize;\r\n }\r\n\r\n /**\r\n * Create a new instance of the Ascii Art FontTexture class\r\n * @param name the name of the texture\r\n * @param font the font to use, use the W3C CSS notation\r\n * @param text the caracter set to use in the rendering.\r\n * @param scene the scene that owns the texture\r\n */\r\n constructor(name: string, font: string, text: string, scene: Nullable<Scene> = null) {\r\n super(scene);\r\n\r\n scene = this.getScene();\r\n\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n this.name = name;\r\n this._text == text;\r\n this._font == font;\r\n\r\n this.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n //this.anisotropicFilteringLevel = 1;\r\n\r\n // Get the font specific info.\r\n const maxCharHeight = this._getFontHeight(font);\r\n const maxCharWidth = this._getFontWidth(font);\r\n\r\n this._charSize = Math.max(maxCharHeight.height, maxCharWidth);\r\n\r\n // This is an approximate size, but should always be able to fit at least the maxCharCount.\r\n const textureWidth = Math.ceil(this._charSize * text.length);\r\n const textureHeight = this._charSize;\r\n\r\n // Create the texture that will store the font characters.\r\n this._texture = scene.getEngine().createDynamicTexture(textureWidth, textureHeight, false, Texture.NEAREST_SAMPLINGMODE);\r\n //scene.getEngine().setclamp\r\n const textureSize = this.getSize();\r\n\r\n // Create a canvas with the final size: the one matching the texture.\r\n const canvas = document.createElement(\"canvas\");\r\n canvas.width = textureSize.width;\r\n canvas.height = textureSize.height;\r\n const context = <CanvasRenderingContext2D>canvas.getContext(\"2d\");\r\n context.textBaseline = \"top\";\r\n context.font = font;\r\n context.fillStyle = \"white\";\r\n context.imageSmoothingEnabled = false;\r\n\r\n // Sets the text in the texture.\r\n for (let i = 0; i < text.length; i++) {\r\n context.fillText(text[i], i * this._charSize, -maxCharHeight.offset);\r\n }\r\n\r\n // Flush the text in the dynamic texture.\r\n\r\n scene.getEngine().updateDynamicTexture(this._texture, canvas, false, true);\r\n }\r\n\r\n /**\r\n * Gets the max char width of a font.\r\n * @param font the font to use, use the W3C CSS notation\r\n * @returns the max char width\r\n */\r\n private _getFontWidth(font: string): number {\r\n const fontDraw = document.createElement(\"canvas\");\r\n const ctx = <CanvasRenderingContext2D>fontDraw.getContext(\"2d\");\r\n ctx.fillStyle = \"white\";\r\n ctx.font = font;\r\n\r\n return ctx.measureText(\"W\").width;\r\n }\r\n\r\n // More info here: https://videlais.com/2014/03/16/the-many-and-varied-problems-with-measuring-font-height-for-html5-canvas/\r\n /**\r\n * Gets the max char height of a font.\r\n * @param font the font to use, use the W3C CSS notation\r\n * @returns the max char height\r\n */\r\n private _getFontHeight(font: string): { height: number; offset: number } {\r\n const fontDraw = document.createElement(\"canvas\");\r\n const ctx = <CanvasRenderingContext2D>fontDraw.getContext(\"2d\");\r\n ctx.fillRect(0, 0, fontDraw.width, fontDraw.height);\r\n ctx.textBaseline = \"top\";\r\n ctx.fillStyle = \"white\";\r\n ctx.font = font;\r\n ctx.fillText(\"jH|\", 0, 0);\r\n const pixels = ctx.getImageData(0, 0, fontDraw.width, fontDraw.height).data;\r\n let start = -1;\r\n let end = -1;\r\n for (let row = 0; row < fontDraw.height; row++) {\r\n for (let column = 0; column < fontDraw.width; column++) {\r\n const index = (row * fontDraw.width + column) * 4;\r\n if (pixels[index] === 0) {\r\n if (column === fontDraw.width - 1 && start !== -1) {\r\n end = row;\r\n row = fontDraw.height;\r\n break;\r\n }\r\n continue;\r\n } else {\r\n if (start === -1) {\r\n start = row;\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n return { height: end - start + 1, offset: start - 1 };\r\n }\r\n\r\n /**\r\n * Clones the current AsciiArtTexture.\r\n * @returns the clone of the texture.\r\n */\r\n public override clone(): AsciiArtFontTexture {\r\n return new AsciiArtFontTexture(this.name, this._font, this._text, this.getScene());\r\n }\r\n\r\n /**\r\n * Parses a json object representing the texture and returns an instance of it.\r\n * @param source the source JSON representation\r\n * @param scene the scene to create the texture for\r\n * @returns the parsed texture\r\n */\r\n public static Parse(source: any, scene: Scene): AsciiArtFontTexture {\r\n const texture = SerializationHelper.Parse(() => new AsciiArtFontTexture(source.name, source.font, source.text, scene), source, scene, null);\r\n\r\n return texture;\r\n }\r\n}\r\n\r\n/**\r\n * Option available in the Ascii Art Post Process.\r\n */\r\nexport interface IAsciiArtPostProcessOptions {\r\n /**\r\n * The font to use following the w3c font definition.\r\n */\r\n font?: string;\r\n\r\n /**\r\n * The character set to use in the postprocess.\r\n */\r\n characterSet?: string;\r\n\r\n /**\r\n * This defines the amount you want to mix the \"tile\" or caracter space colored in the ascii art.\r\n * This number is defined between 0 and 1;\r\n */\r\n mixToTile?: number;\r\n\r\n /**\r\n * This defines the amount you want to mix the normal rendering pass in the ascii art.\r\n * This number is defined between 0 and 1;\r\n */\r\n mixToNormal?: number;\r\n}\r\n\r\n/**\r\n * AsciiArtPostProcess helps rendering everithing in Ascii Art.\r\n *\r\n * Simmply add it to your scene and let the nerd that lives in you have fun.\r\n * Example usage: var pp = new AsciiArtPostProcess(\"myAscii\", \"20px Monospace\", camera);\r\n */\r\nexport class AsciiArtPostProcess extends PostProcess {\r\n /**\r\n * The font texture used to render the char in the post process.\r\n */\r\n private _asciiArtFontTexture: AsciiArtFontTexture;\r\n\r\n /**\r\n * This defines the amount you want to mix the \"tile\" or caracter space colored in the ascii art.\r\n * This number is defined between 0 and 1;\r\n */\r\n public mixToTile: number = 0;\r\n\r\n /**\r\n * This defines the amount you want to mix the normal rendering pass in the ascii art.\r\n * This number is defined between 0 and 1;\r\n */\r\n public mixToNormal: number = 0;\r\n\r\n /**\r\n * Instantiates a new Ascii Art Post Process.\r\n * @param name the name to give to the postprocess\r\n * @camera the camera to apply the post process to.\r\n * @param camera\r\n * @param options can either be the font name or an option object following the IAsciiArtPostProcessOptions format\r\n */\r\n constructor(name: string, camera: Nullable<Camera>, options?: string | IAsciiArtPostProcessOptions) {\r\n super(name, \"asciiart\", [\"asciiArtFontInfos\", \"asciiArtOptions\"], [\"asciiArtFont\"], 1, camera, Texture.TRILINEAR_SAMPLINGMODE, undefined, true);\r\n\r\n // Default values.\r\n let font = \"40px Monospace\";\r\n let characterSet = \" `-.'_:,\\\"=^;<+!*?/cL\\\\zrs7TivJtC{3F)Il(xZfY5S2eajo14[nuyE]P6V9kXpKwGhqAUbOd8#HRDB0$mgMW&Q%N@\";\r\n\r\n // Use options.\r\n if (options) {\r\n if (typeof options === \"string\") {\r\n font = <string>options;\r\n } else {\r\n font = (<IAsciiArtPostProcessOptions>options).font || font;\r\n characterSet = (<IAsciiArtPostProcessOptions>options).characterSet || characterSet;\r\n this.mixToTile = (<IAsciiArtPostProcessOptions>options).mixToTile || this.mixToTile;\r\n this.mixToNormal = (<IAsciiArtPostProcessOptions>options).mixToNormal || this.mixToNormal;\r\n }\r\n }\r\n\r\n const scene = camera?.getScene() || this._scene;\r\n this._asciiArtFontTexture = new AsciiArtFontTexture(name, font, characterSet, scene);\r\n const textureSize = this._asciiArtFontTexture.getSize();\r\n\r\n this.onApply = (effect: Effect) => {\r\n effect.setTexture(\"asciiArtFont\", this._asciiArtFontTexture);\r\n\r\n effect.setFloat4(\"asciiArtFontInfos\", this._asciiArtFontTexture.charSize, characterSet.length, textureSize.width, textureSize.height);\r\n\r\n effect.setFloat4(\"asciiArtOptions\", this.width, this.height, this.mixToNormal, this.mixToTile);\r\n };\r\n }\r\n}\r\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"digitalRainPostProcess.js","sourceRoot":"","sources":["../../../../dev/postProcesses/src/digitalRain/digitalRainPostProcess.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,2CAA6B;AACjD,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AACzE,OAAO,EAAE,MAAM,EAAE,6CAA+B;AAEhD,OAAO,EAAE,WAAW,EAAE,0DAA4C;AAClE,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAE1D,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAE7D,qEAAuD;AACvD,OAAO,wBAAwB,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,OAAO,sBAAuB,SAAQ,WAAW;IASnD;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,IAAY,EAAE,IAAY,EAAE,QAAyB,IAAI;QAC/E,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAExB,IAAI,CAAC,KAAK,EAAE;YACR,OAAO;SACV;QAED,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC;QACnB,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC;QAEnB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,iBAAiB,CAAC;QACvC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,iBAAiB,CAAC;QAEvC,8BAA8B;QAC9B,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAE9C,IAAI,CAAC,SAAS,GAAG,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AC;IACN,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport { Matrix } from \"core/Maths/math.vector\";\r\nimport type { Camera } from \"core/Cameras/camera\";\r\nimport { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport type { Effect } from \"core/Materials/effect\";\r\nimport { PostProcess } from \"core/PostProcesses/postProcess\";\r\nimport type { Scene } from \"core/scene\";\r\nimport \"core/Engines/Extensions/engine.dynamicTexture\";\r\nimport \"./digitalrain.fragment\";\r\n\r\n/**\r\n * DigitalRainFontTexture is the helper class used to easily create your digital rain font texture.\r\n *\r\n * It basically takes care rendering the font front the given font size to a texture.\r\n * This is used later on in the postprocess.\r\n */\r\nexport class DigitalRainFontTexture extends BaseTexture {\r\n @serialize(\"font\")\r\n private _font: string;\r\n\r\n @serialize(\"text\")\r\n private _text: string;\r\n\r\n private _charSize: number;\r\n\r\n /**\r\n * Gets the size of one char in the texture (each char fits in size * size space in the texture).\r\n */\r\n public get charSize(): number {\r\n return this._charSize;\r\n }\r\n\r\n /**\r\n * Create a new instance of the Digital Rain FontTexture class\r\n * @param name the name of the texture\r\n * @param font the font to use, use the W3C CSS notation\r\n * @param text the caracter set to use in the rendering.\r\n * @param scene the scene that owns the texture\r\n */\r\n constructor(name: string, font: string, text: string, scene: Nullable<Scene> = null) {\r\n super(scene);\r\n\r\n scene = this.getScene();\r\n\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n this.name = name;\r\n this._text == text;\r\n this._font == font;\r\n\r\n this.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n\r\n // Get the font specific info.\r\n const maxCharHeight = this._getFontHeight(font);\r\n const maxCharWidth = this._getFontWidth(font);\r\n\r\n this._charSize = Math.max(maxCharHeight.height, maxCharWidth);\r\n\r\n // This is an approximate size, but should always be able to fit at least the maxCharCount.\r\n const textureWidth = this._charSize;\r\n const textureHeight = Math.ceil(this._charSize * text.length);\r\n\r\n // Create the texture that will store the font characters.\r\n this._texture = scene.getEngine().createDynamicTexture(textureWidth, textureHeight, false, Texture.NEAREST_SAMPLINGMODE);\r\n //scene.getEngine().setclamp\r\n const textureSize = this.getSize();\r\n\r\n // Create a canvas with the final size: the one matching the texture.\r\n const canvas = document.createElement(\"canvas\");\r\n canvas.width = textureSize.width;\r\n canvas.height = textureSize.height;\r\n const context = <CanvasRenderingContext2D>canvas.getContext(\"2d\");\r\n context.textBaseline = \"top\";\r\n context.font = font;\r\n context.fillStyle = \"white\";\r\n context.imageSmoothingEnabled = false;\r\n\r\n // Sets the text in the texture.\r\n for (let i = 0; i < text.length; i++) {\r\n context.fillText(text[i], 0, i * this._charSize - maxCharHeight.offset);\r\n }\r\n\r\n // Flush the text in the dynamic texture.\r\n scene.getEngine().updateDynamicTexture(this._texture, canvas, false, true);\r\n }\r\n\r\n /**\r\n * Gets the max char width of a font.\r\n * @param font the font to use, use the W3C CSS notation\r\n * @returns the max char width\r\n */\r\n private _getFontWidth(font: string): number {\r\n const fontDraw = document.createElement(\"canvas\");\r\n const ctx = <CanvasRenderingContext2D>fontDraw.getContext(\"2d\");\r\n ctx.fillStyle = \"white\";\r\n ctx.font = font;\r\n\r\n return ctx.measureText(\"W\").width;\r\n }\r\n\r\n // More info here: https://videlais.com/2014/03/16/the-many-and-varied-problems-with-measuring-font-height-for-html5-canvas/\r\n /**\r\n * Gets the max char height of a font.\r\n * @param font the font to use, use the W3C CSS notation\r\n * @returns the max char height\r\n */\r\n private _getFontHeight(font: string): { height: number; offset: number } {\r\n const fontDraw = document.createElement(\"canvas\");\r\n const ctx = <CanvasRenderingContext2D>fontDraw.getContext(\"2d\");\r\n ctx.fillRect(0, 0, fontDraw.width, fontDraw.height);\r\n ctx.textBaseline = \"top\";\r\n ctx.fillStyle = \"white\";\r\n ctx.font = font;\r\n ctx.fillText(\"jH|\", 0, 0);\r\n const pixels = ctx.getImageData(0, 0, fontDraw.width, fontDraw.height).data;\r\n let start = -1;\r\n let end = -1;\r\n for (let row = 0; row < fontDraw.height; row++) {\r\n for (let column = 0; column < fontDraw.width; column++) {\r\n const index = (row * fontDraw.width + column) * 4;\r\n if (pixels[index] === 0) {\r\n if (column === fontDraw.width - 1 && start !== -1) {\r\n end = row;\r\n row = fontDraw.height;\r\n break;\r\n }\r\n continue;\r\n } else {\r\n if (start === -1) {\r\n start = row;\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n return { height: end - start + 1, offset: start - 1 };\r\n }\r\n\r\n /**\r\n * Clones the current DigitalRainFontTexture.\r\n * @returns the clone of the texture.\r\n */\r\n public clone(): DigitalRainFontTexture {\r\n return new DigitalRainFontTexture(this.name, this._font, this._text, this.getScene());\r\n }\r\n\r\n /**\r\n * Parses a json object representing the texture and returns an instance of it.\r\n * @param source the source JSON representation\r\n * @param scene the scene to create the texture for\r\n * @returns the parsed texture\r\n */\r\n public static Parse(source: any, scene: Scene): DigitalRainFontTexture {\r\n const texture = SerializationHelper.Parse(() => new DigitalRainFontTexture(source.name, source.font, source.text, scene), source, scene, null);\r\n\r\n return texture;\r\n }\r\n}\r\n\r\n/**\r\n * Option available in the Digital Rain Post Process.\r\n */\r\nexport interface IDigitalRainPostProcessOptions {\r\n /**\r\n * The font to use following the w3c font definition.\r\n */\r\n font?: string;\r\n\r\n /**\r\n * This defines the amount you want to mix the \"tile\" or caracter space colored in the digital rain.\r\n * This number is defined between 0 and 1;\r\n */\r\n mixToTile?: number;\r\n\r\n /**\r\n * This defines the amount you want to mix the normal rendering pass in the digital rain.\r\n * This number is defined between 0 and 1;\r\n */\r\n mixToNormal?: number;\r\n}\r\n\r\n/**\r\n * DigitalRainPostProcess helps rendering everithing in digital rain.\r\n *\r\n * Simmply add it to your scene and let the nerd that lives in you have fun.\r\n * Example usage: var pp = new DigitalRainPostProcess(\"digitalRain\", \"20px Monospace\", camera);\r\n */\r\nexport class DigitalRainPostProcess extends PostProcess {\r\n /**\r\n * The font texture used to render the char in the post process.\r\n */\r\n private _digitalRainFontTexture: DigitalRainFontTexture;\r\n\r\n /**\r\n * This defines the amount you want to mix the \"tile\" or caracter space colored in the digital rain.\r\n * This number is defined between 0 and 1;\r\n */\r\n public mixToTile: number = 0;\r\n\r\n /**\r\n * This defines the amount you want to mix the normal rendering pass in the digital rain.\r\n * This number is defined between 0 and 1;\r\n */\r\n public mixToNormal: number = 0;\r\n\r\n /**\r\n * Speed of the effect\r\n */\r\n public speed: number = 0.003;\r\n\r\n /**\r\n * Instantiates a new Digital Rain Post Process.\r\n * @param name the name to give to the postprocess\r\n * @camera the camera to apply the post process to.\r\n * @param camera\r\n * @param options can either be the font name or an option object following the IDigitalRainPostProcessOptions format\r\n */\r\n constructor(name: string, camera: Nullable<Camera>, options?: string | IDigitalRainPostProcessOptions) {\r\n super(\r\n name,\r\n \"digitalrain\",\r\n [\"digitalRainFontInfos\", \"digitalRainOptions\", \"cosTimeZeroOne\", \"matrixSpeed\"],\r\n [\"digitalRainFont\"],\r\n 1.0,\r\n camera,\r\n Texture.TRILINEAR_SAMPLINGMODE,\r\n undefined,\r\n true\r\n );\r\n\r\n // Default values.\r\n let font = \"15px Monospace\";\r\n const characterSet =\r\n \"古池や蛙飛び込む水の音ふるいけやかわずとびこむみずのおと初しぐれ猿も小蓑をほしげ也はつしぐれさるもこみのをほしげなり江戸の雨何石呑んだ時鳥えどのあめなんごくのんだほととぎす\";\r\n\r\n // Use options.\r\n if (options) {\r\n if (typeof options === \"string\") {\r\n font = <string>options;\r\n } else {\r\n font = (<IDigitalRainPostProcessOptions>options).font || font;\r\n this.mixToTile = (<IDigitalRainPostProcessOptions>options).mixToTile || this.mixToTile;\r\n this.mixToNormal = (<IDigitalRainPostProcessOptions>options).mixToNormal || this.mixToNormal;\r\n }\r\n }\r\n\r\n const scene = camera?.getScene() || null;\r\n this._digitalRainFontTexture = new DigitalRainFontTexture(name, font, characterSet, scene);\r\n const textureSize = this._digitalRainFontTexture.getSize();\r\n\r\n let alpha = 0.0;\r\n let cosTimeZeroOne = 0.0;\r\n const matrix = Matrix.FromValues(\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random()\r\n );\r\n\r\n this.onApply = (effect: Effect) => {\r\n effect.setTexture(\"digitalRainFont\", this._digitalRainFontTexture);\r\n\r\n effect.setFloat4(\"digitalRainFontInfos\", this._digitalRainFontTexture.charSize, characterSet.length, textureSize.width, textureSize.height);\r\n\r\n effect.setFloat4(\"digitalRainOptions\", this.width, this.height, this.mixToNormal, this.mixToTile);\r\n\r\n effect.setMatrix(\"matrixSpeed\", matrix);\r\n\r\n alpha += this.speed;\r\n cosTimeZeroOne = alpha;\r\n effect.setFloat(\"cosTimeZeroOne\", cosTimeZeroOne);\r\n };\r\n }\r\n}\r\n"]}
|
1
|
+
{"version":3,"file":"digitalRainPostProcess.js","sourceRoot":"","sources":["../../../../dev/postProcesses/src/digitalRain/digitalRainPostProcess.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,2CAA6B;AACjD,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AACzE,OAAO,EAAE,MAAM,EAAE,6CAA+B;AAEhD,OAAO,EAAE,WAAW,EAAE,0DAA4C;AAClE,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAE1D,OAAO,EAAE,WAAW,EAAE,qDAAuC;AAE7D,qEAAuD;AACvD,OAAO,wBAAwB,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,OAAO,sBAAuB,SAAQ,WAAW;IASnD;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;;;;;;OAMG;IACH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AE,EAAE;YAC9B,MAAM,CAAC,UAAU,CAAC,iBAAiB,EAAE,IAAI,CAAC,uBAAuB,CAAC,CAAC;YAEnE,MAAM,CAAC,SAAS,CAAC,sBAAsB,EAAE,IAAI,CAAC,uBAAuB,CAAC,QAAQ,EAAE,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;YAE5I,MAAM,CAAC,SAAS,CAAC,oBAAoB,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YAElG,MAAM,CAAC,SAAS,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;YAExC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC;YACpB,cAAc,GAAG,KAAK,CAAC;YACvB,MAAM,CAAC,QAAQ,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;QACtD,CAAC,CAAC;IACN,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport { Matrix } from \"core/Maths/math.vector\";\r\nimport type { Camera } from \"core/Cameras/camera\";\r\nimport { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport type { Effect } from \"core/Materials/effect\";\r\nimport { PostProcess } from \"core/PostProcesses/postProcess\";\r\nimport type { Scene } from \"core/scene\";\r\nimport \"core/Engines/Extensions/engine.dynamicTexture\";\r\nimport \"./digitalrain.fragment\";\r\n\r\n/**\r\n * DigitalRainFontTexture is the helper class used to easily create your digital rain font texture.\r\n *\r\n * It basically takes care rendering the font front the given font size to a texture.\r\n * This is used later on in the postprocess.\r\n */\r\nexport class DigitalRainFontTexture extends BaseTexture {\r\n @serialize(\"font\")\r\n private _font: string;\r\n\r\n @serialize(\"text\")\r\n private _text: string;\r\n\r\n private _charSize: number;\r\n\r\n /**\r\n * Gets the size of one char in the texture (each char fits in size * size space in the texture).\r\n */\r\n public get charSize(): number {\r\n return this._charSize;\r\n }\r\n\r\n /**\r\n * Create a new instance of the Digital Rain FontTexture class\r\n * @param name the name of the texture\r\n * @param font the font to use, use the W3C CSS notation\r\n * @param text the caracter set to use in the rendering.\r\n * @param scene the scene that owns the texture\r\n */\r\n constructor(name: string, font: string, text: string, scene: Nullable<Scene> = null) {\r\n super(scene);\r\n\r\n scene = this.getScene();\r\n\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n this.name = name;\r\n this._text == text;\r\n this._font == font;\r\n\r\n this.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n\r\n // Get the font specific info.\r\n const maxCharHeight = this._getFontHeight(font);\r\n const maxCharWidth = this._getFontWidth(font);\r\n\r\n this._charSize = Math.max(maxCharHeight.height, maxCharWidth);\r\n\r\n // This is an approximate size, but should always be able to fit at least the maxCharCount.\r\n const textureWidth = this._charSize;\r\n const textureHeight = Math.ceil(this._charSize * text.length);\r\n\r\n // Create the texture that will store the font characters.\r\n this._texture = scene.getEngine().createDynamicTexture(textureWidth, textureHeight, false, Texture.NEAREST_SAMPLINGMODE);\r\n //scene.getEngine().setclamp\r\n const textureSize = this.getSize();\r\n\r\n // Create a canvas with the final size: the one matching the texture.\r\n const canvas = document.createElement(\"canvas\");\r\n canvas.width = textureSize.width;\r\n canvas.height = textureSize.height;\r\n const context = <CanvasRenderingContext2D>canvas.getContext(\"2d\");\r\n context.textBaseline = \"top\";\r\n context.font = font;\r\n context.fillStyle = \"white\";\r\n context.imageSmoothingEnabled = false;\r\n\r\n // Sets the text in the texture.\r\n for (let i = 0; i < text.length; i++) {\r\n context.fillText(text[i], 0, i * this._charSize - maxCharHeight.offset);\r\n }\r\n\r\n // Flush the text in the dynamic texture.\r\n scene.getEngine().updateDynamicTexture(this._texture, canvas, false, true);\r\n }\r\n\r\n /**\r\n * Gets the max char width of a font.\r\n * @param font the font to use, use the W3C CSS notation\r\n * @returns the max char width\r\n */\r\n private _getFontWidth(font: string): number {\r\n const fontDraw = document.createElement(\"canvas\");\r\n const ctx = <CanvasRenderingContext2D>fontDraw.getContext(\"2d\");\r\n ctx.fillStyle = \"white\";\r\n ctx.font = font;\r\n\r\n return ctx.measureText(\"W\").width;\r\n }\r\n\r\n // More info here: https://videlais.com/2014/03/16/the-many-and-varied-problems-with-measuring-font-height-for-html5-canvas/\r\n /**\r\n * Gets the max char height of a font.\r\n * @param font the font to use, use the W3C CSS notation\r\n * @returns the max char height\r\n */\r\n private _getFontHeight(font: string): { height: number; offset: number } {\r\n const fontDraw = document.createElement(\"canvas\");\r\n const ctx = <CanvasRenderingContext2D>fontDraw.getContext(\"2d\");\r\n ctx.fillRect(0, 0, fontDraw.width, fontDraw.height);\r\n ctx.textBaseline = \"top\";\r\n ctx.fillStyle = \"white\";\r\n ctx.font = font;\r\n ctx.fillText(\"jH|\", 0, 0);\r\n const pixels = ctx.getImageData(0, 0, fontDraw.width, fontDraw.height).data;\r\n let start = -1;\r\n let end = -1;\r\n for (let row = 0; row < fontDraw.height; row++) {\r\n for (let column = 0; column < fontDraw.width; column++) {\r\n const index = (row * fontDraw.width + column) * 4;\r\n if (pixels[index] === 0) {\r\n if (column === fontDraw.width - 1 && start !== -1) {\r\n end = row;\r\n row = fontDraw.height;\r\n break;\r\n }\r\n continue;\r\n } else {\r\n if (start === -1) {\r\n start = row;\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n return { height: end - start + 1, offset: start - 1 };\r\n }\r\n\r\n /**\r\n * Clones the current DigitalRainFontTexture.\r\n * @returns the clone of the texture.\r\n */\r\n public override clone(): DigitalRainFontTexture {\r\n return new DigitalRainFontTexture(this.name, this._font, this._text, this.getScene());\r\n }\r\n\r\n /**\r\n * Parses a json object representing the texture and returns an instance of it.\r\n * @param source the source JSON representation\r\n * @param scene the scene to create the texture for\r\n * @returns the parsed texture\r\n */\r\n public static Parse(source: any, scene: Scene): DigitalRainFontTexture {\r\n const texture = SerializationHelper.Parse(() => new DigitalRainFontTexture(source.name, source.font, source.text, scene), source, scene, null);\r\n\r\n return texture;\r\n }\r\n}\r\n\r\n/**\r\n * Option available in the Digital Rain Post Process.\r\n */\r\nexport interface IDigitalRainPostProcessOptions {\r\n /**\r\n * The font to use following the w3c font definition.\r\n */\r\n font?: string;\r\n\r\n /**\r\n * This defines the amount you want to mix the \"tile\" or caracter space colored in the digital rain.\r\n * This number is defined between 0 and 1;\r\n */\r\n mixToTile?: number;\r\n\r\n /**\r\n * This defines the amount you want to mix the normal rendering pass in the digital rain.\r\n * This number is defined between 0 and 1;\r\n */\r\n mixToNormal?: number;\r\n}\r\n\r\n/**\r\n * DigitalRainPostProcess helps rendering everithing in digital rain.\r\n *\r\n * Simmply add it to your scene and let the nerd that lives in you have fun.\r\n * Example usage: var pp = new DigitalRainPostProcess(\"digitalRain\", \"20px Monospace\", camera);\r\n */\r\nexport class DigitalRainPostProcess extends PostProcess {\r\n /**\r\n * The font texture used to render the char in the post process.\r\n */\r\n private _digitalRainFontTexture: DigitalRainFontTexture;\r\n\r\n /**\r\n * This defines the amount you want to mix the \"tile\" or caracter space colored in the digital rain.\r\n * This number is defined between 0 and 1;\r\n */\r\n public mixToTile: number = 0;\r\n\r\n /**\r\n * This defines the amount you want to mix the normal rendering pass in the digital rain.\r\n * This number is defined between 0 and 1;\r\n */\r\n public mixToNormal: number = 0;\r\n\r\n /**\r\n * Speed of the effect\r\n */\r\n public speed: number = 0.003;\r\n\r\n /**\r\n * Instantiates a new Digital Rain Post Process.\r\n * @param name the name to give to the postprocess\r\n * @camera the camera to apply the post process to.\r\n * @param camera\r\n * @param options can either be the font name or an option object following the IDigitalRainPostProcessOptions format\r\n */\r\n constructor(name: string, camera: Nullable<Camera>, options?: string | IDigitalRainPostProcessOptions) {\r\n super(\r\n name,\r\n \"digitalrain\",\r\n [\"digitalRainFontInfos\", \"digitalRainOptions\", \"cosTimeZeroOne\", \"matrixSpeed\"],\r\n [\"digitalRainFont\"],\r\n 1.0,\r\n camera,\r\n Texture.TRILINEAR_SAMPLINGMODE,\r\n undefined,\r\n true\r\n );\r\n\r\n // Default values.\r\n let font = \"15px Monospace\";\r\n const characterSet =\r\n \"古池や蛙飛び込む水の音ふるいけやかわずとびこむみずのおと初しぐれ猿も小蓑をほしげ也はつしぐれさるもこみのをほしげなり江戸の雨何石呑んだ時鳥えどのあめなんごくのんだほととぎす\";\r\n\r\n // Use options.\r\n if (options) {\r\n if (typeof options === \"string\") {\r\n font = <string>options;\r\n } else {\r\n font = (<IDigitalRainPostProcessOptions>options).font || font;\r\n this.mixToTile = (<IDigitalRainPostProcessOptions>options).mixToTile || this.mixToTile;\r\n this.mixToNormal = (<IDigitalRainPostProcessOptions>options).mixToNormal || this.mixToNormal;\r\n }\r\n }\r\n\r\n const scene = camera?.getScene() || null;\r\n this._digitalRainFontTexture = new DigitalRainFontTexture(name, font, characterSet, scene);\r\n const textureSize = this._digitalRainFontTexture.getSize();\r\n\r\n let alpha = 0.0;\r\n let cosTimeZeroOne = 0.0;\r\n const matrix = Matrix.FromValues(\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random(),\r\n Math.random()\r\n );\r\n\r\n this.onApply = (effect: Effect) => {\r\n effect.setTexture(\"digitalRainFont\", this._digitalRainFontTexture);\r\n\r\n effect.setFloat4(\"digitalRainFontInfos\", this._digitalRainFontTexture.charSize, characterSet.length, textureSize.width, textureSize.height);\r\n\r\n effect.setFloat4(\"digitalRainOptions\", this.width, this.height, this.mixToNormal, this.mixToTile);\r\n\r\n effect.setMatrix(\"matrixSpeed\", matrix);\r\n\r\n alpha += this.speed;\r\n cosTimeZeroOne = alpha;\r\n effect.setFloat(\"cosTimeZeroOne\", cosTimeZeroOne);\r\n };\r\n }\r\n}\r\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@babylonjs/post-processes",
|
3
|
-
"version": "7.3.
|
3
|
+
"version": "7.3.2",
|
4
4
|
"main": "index.js",
|
5
5
|
"module": "index.js",
|
6
6
|
"types": "index.d.ts",
|
@@ -18,7 +18,7 @@
|
|
18
18
|
"postcompile": "build-tools -c add-js-to-es6"
|
19
19
|
},
|
20
20
|
"devDependencies": {
|
21
|
-
"@babylonjs/core": "^7.3.
|
21
|
+
"@babylonjs/core": "^7.3.2",
|
22
22
|
"@dev/build-tools": "^1.0.0",
|
23
23
|
"@lts/post-processes": "^1.0.0"
|
24
24
|
},
|