-
-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core/Graphics: adding Linear Guassian blur effects (#473)
- Loading branch information
Showing
15 changed files
with
216 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
librtt/Display/Shader/kernel_filter_blurGaussianLinear_gl.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
local kernel = {} | ||
|
||
kernel.language = "glsl" | ||
|
||
kernel.category = "filter" | ||
|
||
kernel.name = "blurGaussianLinear" | ||
|
||
kernel.graph = | ||
{ | ||
nodes = { | ||
horizontal = { effect="filter.blurLinearHorizontal", input1="paint1" }, | ||
vertical = { effect="filter.blurLinearVertical", input1="horizontal" }, | ||
}, | ||
output = "vertical", | ||
} | ||
|
||
return kernel |
51 changes: 51 additions & 0 deletions
51
librtt/Display/Shader/kernel_filter_blurLinearHorizontal_gl.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
local kernel = {} | ||
|
||
kernel.language = "glsl" | ||
|
||
kernel.category = "filter" | ||
|
||
kernel.name = "blurLinearHorizontal" | ||
|
||
kernel.unsupportedPlatforms = | ||
{ | ||
WinPhone = true, | ||
} | ||
|
||
kernel.vertexData = | ||
{ | ||
{ | ||
name = "offset1", | ||
default = 1.3846153846, | ||
min = 0, | ||
max = 100, | ||
index = 0, -- v_UserData.x | ||
}, | ||
{ | ||
name = "offset2", | ||
default = 3.2307692308, | ||
min = 0, | ||
max = 100, | ||
index = 1, -- v_UserData.y | ||
}, | ||
} | ||
|
||
kernel.fragment = | ||
[[ | ||
const P_UV float kWeight0 = 0.2270270270; | ||
const P_UV float kWeight1 = 0.3162162162; | ||
const P_UV float kWeight2 = 0.0702702703; | ||
P_COLOR vec4 FragmentKernel( P_UV vec2 texCoord ) | ||
{ | ||
P_COLOR vec4 color = texture2D(u_FillSampler0, texCoord.st) * kWeight0; | ||
color += texture2D(u_FillSampler0, (texCoord.st + vec2(v_UserData.x, 0.0) * u_TexelSize.xy)) * kWeight1; | ||
color += texture2D(u_FillSampler0, (texCoord.st - vec2(v_UserData.x, 0.0) * u_TexelSize.xy)) * kWeight1; | ||
color += texture2D(u_FillSampler0, (texCoord.st + vec2(v_UserData.y, 0.0) * u_TexelSize.xy)) * kWeight2; | ||
color += texture2D(u_FillSampler0, (texCoord.st - vec2(v_UserData.y, 0.0) * u_TexelSize.xy)) * kWeight2; | ||
return color * v_ColorScale; | ||
} | ||
]] | ||
|
||
return kernel |
51 changes: 51 additions & 0 deletions
51
librtt/Display/Shader/kernel_filter_blurLinearVertical_gl.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
local kernel = {} | ||
|
||
kernel.language = "glsl" | ||
|
||
kernel.category = "filter" | ||
|
||
kernel.name = "blurLinearVertical" | ||
|
||
kernel.unsupportedPlatforms = | ||
{ | ||
WinPhone = true, | ||
} | ||
|
||
kernel.vertexData = | ||
{ | ||
{ | ||
name = "offset1", | ||
default = 1.3846153846, | ||
min = 0, | ||
max = 100, | ||
index = 0, -- v_UserData.x | ||
}, | ||
{ | ||
name = "offset2", | ||
default = 3.2307692308, | ||
min = 0, | ||
max = 100, | ||
index = 1, -- v_UserData.y | ||
}, | ||
} | ||
|
||
kernel.fragment = | ||
[[ | ||
const P_UV float kWeight0 = 0.2270270270; | ||
const P_UV float kWeight1 = 0.3162162162; | ||
const P_UV float kWeight2 = 0.0702702703; | ||
P_COLOR vec4 FragmentKernel( P_UV vec2 texCoord ) | ||
{ | ||
P_COLOR vec4 color = texture2D(u_FillSampler0, texCoord.st) * kWeight0; | ||
color += texture2D(u_FillSampler0, (texCoord.st + vec2(0.0, v_UserData.x) * u_TexelSize.xy)) * kWeight1; | ||
color += texture2D(u_FillSampler0, (texCoord.st - vec2(0.0, v_UserData.x) * u_TexelSize.xy)) * kWeight1; | ||
color += texture2D(u_FillSampler0, (texCoord.st + vec2(0.0, v_UserData.y) * u_TexelSize.xy)) * kWeight2; | ||
color += texture2D(u_FillSampler0, (texCoord.st - vec2(0.0, v_UserData.y) * u_TexelSize.xy)) * kWeight2; | ||
return color * v_ColorScale; | ||
} | ||
]] | ||
|
||
return kernel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.