@babylonjs/post-processes 5.0.0-rc.5 → 5.0.0-rc.9
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.
- package/asciiArt/asciiArtPostProcess.d.ts +107 -107
- package/asciiArt/asciiArtPostProcess.js +206 -206
- package/asciiArt/asciiart.fragment.d.ts +5 -5
- package/asciiArt/asciiart.fragment.js +8 -8
- package/asciiArt/index.d.ts +1 -1
- package/asciiArt/index.js +1 -1
- package/digitalRain/digitalRainPostProcess.d.ts +107 -107
- package/digitalRain/digitalRainPostProcess.js +216 -216
- package/digitalRain/digitalrain.fragment.d.ts +5 -5
- package/digitalRain/digitalrain.fragment.js +8 -8
- package/digitalRain/index.d.ts +1 -1
- package/digitalRain/index.js +1 -1
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/legacy/legacy-asciiArt.d.ts +1 -1
- package/legacy/legacy-asciiArt.js +12 -12
- package/legacy/legacy-digitalRain.d.ts +1 -1
- package/legacy/legacy-digitalRain.js +12 -12
- package/legacy/legacy.d.ts +1 -1
- package/legacy/legacy.js +13 -13
- package/package.json +2 -2
@@ -1,9 +1,9 @@
|
|
1
|
-
// Do not edit.
|
2
|
-
import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
|
3
|
-
var name = "asciiartPixelShader";
|
4
|
-
var shader = "varying vec2 vUV;uniform sampler2D textureSampler;uniform sampler2D asciiArtFont;uniform vec4 asciiArtFontInfos;uniform vec4 asciiArtOptions;float getLuminance(vec3 color)\n{return clamp(dot(color,vec3(0.2126,0.7152,0.0722)),0.,1.);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{float caracterSize=asciiArtFontInfos.x;float numChar=asciiArtFontInfos.y-1.0;float fontx=asciiArtFontInfos.z;float fonty=asciiArtFontInfos.w;float screenx=asciiArtOptions.x;float screeny=asciiArtOptions.y;float tileX=float(floor((gl_FragCoord.x)/caracterSize))*caracterSize/screenx;float tileY=float(floor((gl_FragCoord.y)/caracterSize))*caracterSize/screeny;vec2 tileUV=vec2(tileX,tileY);vec4 tileColor=texture2D(textureSampler,tileUV);vec4 baseColor=texture2D(textureSampler,vUV);float tileLuminance=getLuminance(tileColor.rgb);float offsetx=(float(floor(tileLuminance*numChar)))*caracterSize/fontx;float offsety=0.0;float x=float(mod(gl_FragCoord.x,caracterSize))/fontx;float y=float(mod(gl_FragCoord.y,caracterSize))/fonty;vec4 finalColor= texture2D(asciiArtFont,vec2(offsetx+x,offsety+(caracterSize/fonty-y)));finalColor.rgb*=tileColor.rgb;finalColor.a=1.0;finalColor= mix(finalColor,tileColor,asciiArtOptions.w);finalColor= mix(finalColor,baseColor,asciiArtOptions.z);gl_FragColor=finalColor;}";
|
5
|
-
// Sideeffect
|
6
|
-
ShaderStore.ShadersStore[name] = shader;
|
7
|
-
/** @hidden */
|
8
|
-
export var asciiartPixelShader = { name: name, shader: shader };
|
1
|
+
// Do not edit.
|
2
|
+
import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
|
3
|
+
var name = "asciiartPixelShader";
|
4
|
+
var shader = "varying vec2 vUV;uniform sampler2D textureSampler;uniform sampler2D asciiArtFont;uniform vec4 asciiArtFontInfos;uniform vec4 asciiArtOptions;float getLuminance(vec3 color)\n{return clamp(dot(color,vec3(0.2126,0.7152,0.0722)),0.,1.);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{float caracterSize=asciiArtFontInfos.x;float numChar=asciiArtFontInfos.y-1.0;float fontx=asciiArtFontInfos.z;float fonty=asciiArtFontInfos.w;float screenx=asciiArtOptions.x;float screeny=asciiArtOptions.y;float tileX=float(floor((gl_FragCoord.x)/caracterSize))*caracterSize/screenx;float tileY=float(floor((gl_FragCoord.y)/caracterSize))*caracterSize/screeny;vec2 tileUV=vec2(tileX,tileY);vec4 tileColor=texture2D(textureSampler,tileUV);vec4 baseColor=texture2D(textureSampler,vUV);float tileLuminance=getLuminance(tileColor.rgb);float offsetx=(float(floor(tileLuminance*numChar)))*caracterSize/fontx;float offsety=0.0;float x=float(mod(gl_FragCoord.x,caracterSize))/fontx;float y=float(mod(gl_FragCoord.y,caracterSize))/fonty;vec4 finalColor= texture2D(asciiArtFont,vec2(offsetx+x,offsety+(caracterSize/fonty-y)));finalColor.rgb*=tileColor.rgb;finalColor.a=1.0;finalColor= mix(finalColor,tileColor,asciiArtOptions.w);finalColor= mix(finalColor,baseColor,asciiArtOptions.z);gl_FragColor=finalColor;}";
|
5
|
+
// Sideeffect
|
6
|
+
ShaderStore.ShadersStore[name] = shader;
|
7
|
+
/** @hidden */
|
8
|
+
export var asciiartPixelShader = { name: name, shader: shader };
|
9
9
|
//# sourceMappingURL=asciiart.fragment.js.map
|
package/asciiArt/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export * from "./asciiArtPostProcess";
|
1
|
+
export * from "./asciiArtPostProcess";
|
package/asciiArt/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export * from "./asciiArtPostProcess
|
1
|
+
export * from "./asciiArtPostProcess";
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1,107 +1,107 @@
|
|
1
|
-
import { Nullable } from "@babylonjs/core/types.js";
|
2
|
-
import { Camera } from "@babylonjs/core/Cameras/camera.js";
|
3
|
-
import { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
|
4
|
-
import { PostProcess } from "@babylonjs/core/PostProcesses/postProcess.js";
|
5
|
-
import { Scene } from "@babylonjs/core/scene.js";
|
6
|
-
import "@babylonjs/core/Engines/Extensions/engine.dynamicTexture.js";
|
7
|
-
import "./digitalrain.fragment";
|
8
|
-
/**
|
9
|
-
* DigitalRainFontTexture is the helper class used to easily create your digital rain font texture.
|
10
|
-
*
|
11
|
-
* It basically takes care rendering the font front the given font size to a texture.
|
12
|
-
* This is used later on in the postprocess.
|
13
|
-
*/
|
14
|
-
export declare class DigitalRainFontTexture extends BaseTexture {
|
15
|
-
private _font;
|
16
|
-
private _text;
|
17
|
-
private _charSize;
|
18
|
-
/**
|
19
|
-
* Gets the size of one char in the texture (each char fits in size * size space in the texture).
|
20
|
-
*/
|
21
|
-
get charSize(): number;
|
22
|
-
/**
|
23
|
-
* Create a new instance of the Digital Rain FontTexture class
|
24
|
-
* @param name the name of the texture
|
25
|
-
* @param font the font to use, use the W3C CSS notation
|
26
|
-
* @param text the caracter set to use in the rendering.
|
27
|
-
* @param scene the scene that owns the texture
|
28
|
-
*/
|
29
|
-
constructor(name: string, font: string, text: string, scene?: Nullable<Scene>);
|
30
|
-
/**
|
31
|
-
* Gets the max char width of a font.
|
32
|
-
* @param font the font to use, use the W3C CSS notation
|
33
|
-
* @return the max char width
|
34
|
-
*/
|
35
|
-
private _getFontWidth;
|
36
|
-
/**
|
37
|
-
* Gets the max char height of a font.
|
38
|
-
* @param font the font to use, use the W3C CSS notation
|
39
|
-
* @return the max char height
|
40
|
-
*/
|
41
|
-
private _getFontHeight;
|
42
|
-
/**
|
43
|
-
* Clones the current DigitalRainFontTexture.
|
44
|
-
* @return the clone of the texture.
|
45
|
-
*/
|
46
|
-
clone(): DigitalRainFontTexture;
|
47
|
-
/**
|
48
|
-
* Parses a json object representing the texture and returns an instance of it.
|
49
|
-
* @param source the source JSON representation
|
50
|
-
* @param scene the scene to create the texture for
|
51
|
-
* @return the parsed texture
|
52
|
-
*/
|
53
|
-
static Parse(source: any, scene: Scene): DigitalRainFontTexture;
|
54
|
-
}
|
55
|
-
/**
|
56
|
-
* Option available in the Digital Rain Post Process.
|
57
|
-
*/
|
58
|
-
export interface IDigitalRainPostProcessOptions {
|
59
|
-
/**
|
60
|
-
* The font to use following the w3c font definition.
|
61
|
-
*/
|
62
|
-
font?: string;
|
63
|
-
/**
|
64
|
-
* This defines the amount you want to mix the "tile" or caracter space colored in the digital rain.
|
65
|
-
* This number is defined between 0 and 1;
|
66
|
-
*/
|
67
|
-
mixToTile?: number;
|
68
|
-
/**
|
69
|
-
* This defines the amount you want to mix the normal rendering pass in the digital rain.
|
70
|
-
* This number is defined between 0 and 1;
|
71
|
-
*/
|
72
|
-
mixToNormal?: number;
|
73
|
-
}
|
74
|
-
/**
|
75
|
-
* DigitalRainPostProcess helps rendering everithing in digital rain.
|
76
|
-
*
|
77
|
-
* Simmply add it to your scene and let the nerd that lives in you have fun.
|
78
|
-
* Example usage: var pp = new DigitalRainPostProcess("digitalRain", "20px Monospace", camera);
|
79
|
-
*/
|
80
|
-
export declare class DigitalRainPostProcess extends PostProcess {
|
81
|
-
/**
|
82
|
-
* The font texture used to render the char in the post process.
|
83
|
-
*/
|
84
|
-
private _digitalRainFontTexture;
|
85
|
-
/**
|
86
|
-
* This defines the amount you want to mix the "tile" or caracter space colored in the digital rain.
|
87
|
-
* This number is defined between 0 and 1;
|
88
|
-
*/
|
89
|
-
mixToTile: number;
|
90
|
-
/**
|
91
|
-
* This defines the amount you want to mix the normal rendering pass in the digital rain.
|
92
|
-
* This number is defined between 0 and 1;
|
93
|
-
*/
|
94
|
-
mixToNormal: number;
|
95
|
-
/**
|
96
|
-
* Speed of the effect
|
97
|
-
*/
|
98
|
-
speed: number;
|
99
|
-
/**
|
100
|
-
* Instantiates a new Digital Rain Post Process.
|
101
|
-
* @param name the name to give to the postprocess
|
102
|
-
* @camera the camera to apply the post process to.
|
103
|
-
* @param camera
|
104
|
-
* @param options can either be the font name or an option object following the IDigitalRainPostProcessOptions format
|
105
|
-
*/
|
106
|
-
constructor(name: string, camera: Camera, options?: string | IDigitalRainPostProcessOptions);
|
107
|
-
}
|
1
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
2
|
+
import { Camera } from "@babylonjs/core/Cameras/camera.js";
|
3
|
+
import { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture.js";
|
4
|
+
import { PostProcess } from "@babylonjs/core/PostProcesses/postProcess.js";
|
5
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
6
|
+
import "@babylonjs/core/Engines/Extensions/engine.dynamicTexture.js";
|
7
|
+
import "./digitalrain.fragment";
|
8
|
+
/**
|
9
|
+
* DigitalRainFontTexture is the helper class used to easily create your digital rain font texture.
|
10
|
+
*
|
11
|
+
* It basically takes care rendering the font front the given font size to a texture.
|
12
|
+
* This is used later on in the postprocess.
|
13
|
+
*/
|
14
|
+
export declare class DigitalRainFontTexture extends BaseTexture {
|
15
|
+
private _font;
|
16
|
+
private _text;
|
17
|
+
private _charSize;
|
18
|
+
/**
|
19
|
+
* Gets the size of one char in the texture (each char fits in size * size space in the texture).
|
20
|
+
*/
|
21
|
+
get charSize(): number;
|
22
|
+
/**
|
23
|
+
* Create a new instance of the Digital Rain FontTexture class
|
24
|
+
* @param name the name of the texture
|
25
|
+
* @param font the font to use, use the W3C CSS notation
|
26
|
+
* @param text the caracter set to use in the rendering.
|
27
|
+
* @param scene the scene that owns the texture
|
28
|
+
*/
|
29
|
+
constructor(name: string, font: string, text: string, scene?: Nullable<Scene>);
|
30
|
+
/**
|
31
|
+
* Gets the max char width of a font.
|
32
|
+
* @param font the font to use, use the W3C CSS notation
|
33
|
+
* @return the max char width
|
34
|
+
*/
|
35
|
+
private _getFontWidth;
|
36
|
+
/**
|
37
|
+
* Gets the max char height of a font.
|
38
|
+
* @param font the font to use, use the W3C CSS notation
|
39
|
+
* @return the max char height
|
40
|
+
*/
|
41
|
+
private _getFontHeight;
|
42
|
+
/**
|
43
|
+
* Clones the current DigitalRainFontTexture.
|
44
|
+
* @return the clone of the texture.
|
45
|
+
*/
|
46
|
+
clone(): DigitalRainFontTexture;
|
47
|
+
/**
|
48
|
+
* Parses a json object representing the texture and returns an instance of it.
|
49
|
+
* @param source the source JSON representation
|
50
|
+
* @param scene the scene to create the texture for
|
51
|
+
* @return the parsed texture
|
52
|
+
*/
|
53
|
+
static Parse(source: any, scene: Scene): DigitalRainFontTexture;
|
54
|
+
}
|
55
|
+
/**
|
56
|
+
* Option available in the Digital Rain Post Process.
|
57
|
+
*/
|
58
|
+
export interface IDigitalRainPostProcessOptions {
|
59
|
+
/**
|
60
|
+
* The font to use following the w3c font definition.
|
61
|
+
*/
|
62
|
+
font?: string;
|
63
|
+
/**
|
64
|
+
* This defines the amount you want to mix the "tile" or caracter space colored in the digital rain.
|
65
|
+
* This number is defined between 0 and 1;
|
66
|
+
*/
|
67
|
+
mixToTile?: number;
|
68
|
+
/**
|
69
|
+
* This defines the amount you want to mix the normal rendering pass in the digital rain.
|
70
|
+
* This number is defined between 0 and 1;
|
71
|
+
*/
|
72
|
+
mixToNormal?: number;
|
73
|
+
}
|
74
|
+
/**
|
75
|
+
* DigitalRainPostProcess helps rendering everithing in digital rain.
|
76
|
+
*
|
77
|
+
* Simmply add it to your scene and let the nerd that lives in you have fun.
|
78
|
+
* Example usage: var pp = new DigitalRainPostProcess("digitalRain", "20px Monospace", camera);
|
79
|
+
*/
|
80
|
+
export declare class DigitalRainPostProcess extends PostProcess {
|
81
|
+
/**
|
82
|
+
* The font texture used to render the char in the post process.
|
83
|
+
*/
|
84
|
+
private _digitalRainFontTexture;
|
85
|
+
/**
|
86
|
+
* This defines the amount you want to mix the "tile" or caracter space colored in the digital rain.
|
87
|
+
* This number is defined between 0 and 1;
|
88
|
+
*/
|
89
|
+
mixToTile: number;
|
90
|
+
/**
|
91
|
+
* This defines the amount you want to mix the normal rendering pass in the digital rain.
|
92
|
+
* This number is defined between 0 and 1;
|
93
|
+
*/
|
94
|
+
mixToNormal: number;
|
95
|
+
/**
|
96
|
+
* Speed of the effect
|
97
|
+
*/
|
98
|
+
speed: number;
|
99
|
+
/**
|
100
|
+
* Instantiates a new Digital Rain Post Process.
|
101
|
+
* @param name the name to give to the postprocess
|
102
|
+
* @camera the camera to apply the post process to.
|
103
|
+
* @param camera
|
104
|
+
* @param options can either be the font name or an option object following the IDigitalRainPostProcessOptions format
|
105
|
+
*/
|
106
|
+
constructor(name: string, camera: Camera, options?: string | IDigitalRainPostProcessOptions);
|
107
|
+
}
|