forked from Siv3D/OpenSiv3D
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
1,464 additions
and
167 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# version 300 es | ||
|
||
// Copyright (c) 2008-2023 Ryo Suzuki. | ||
// Copyright (c) 2016-2023 OpenSiv3D Project. | ||
// Licensed under the MIT License. | ||
|
||
precision mediump float; | ||
|
||
// | ||
// Textures | ||
// | ||
uniform sampler2D Texture0; | ||
|
||
// | ||
// PSInput | ||
// | ||
in vec4 Color; | ||
in vec2 UV; | ||
|
||
// | ||
// PSOutput | ||
// | ||
layout(location = 0) out vec4 FragColor; | ||
|
||
// | ||
// Constant Buffer | ||
// | ||
layout(std140) uniform PSConstants2D | ||
{ | ||
vec4 g_colorAdd; | ||
vec4 g_sdfParam; | ||
vec4 g_sdfOutlineColor; | ||
vec4 g_sdfShadowColor; | ||
}; | ||
|
||
layout(std140) uniform PSQuadWarp | ||
{ | ||
mat3x3 g_invHomography; | ||
vec4 g_uvTransform; | ||
}; | ||
|
||
vec2 Transform(vec2 pos, mat3x3 mat) | ||
{ | ||
float s = (mat[0][2] * pos.x + mat[1][2] * pos.y + mat[2][2]); | ||
float x = (mat[0][0] * pos.x + mat[1][0] * pos.y + mat[2][0]) / s; | ||
float y = (mat[0][1] * pos.x + mat[1][1] * pos.y + mat[2][1]) / s; | ||
return vec2(x, y); | ||
} | ||
|
||
// | ||
// Functions | ||
// | ||
void main() | ||
{ | ||
vec2 uv = (Transform(UV, g_invHomography) * g_uvTransform.xy + g_uvTransform.zw); | ||
|
||
vec4 texColor = texture(Texture0, uv); | ||
|
||
FragColor = ((texColor * Color) + g_colorAdd); | ||
} |
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,62 @@ | ||
#version 300 es | ||
|
||
// Copyright (c) 2008-2023 Ryo Suzuki. | ||
// Copyright (c) 2016-2023 OpenSiv3D Project. | ||
// Licensed under the MIT License. | ||
|
||
// | ||
// VSInput | ||
// | ||
layout(location = 0) in vec2 VertexPosition; | ||
layout(location = 1) in vec2 VertexUV; | ||
layout(location = 2) in vec4 VertexColor; | ||
|
||
// | ||
// VSOutput | ||
// | ||
out vec4 Color; | ||
out vec2 UV; | ||
|
||
// | ||
// Siv3D Functions | ||
// | ||
vec4 s3d_Transform2D(const vec2 pos, const vec4 t[2]) | ||
{ | ||
return vec4(t[0].zw + (pos.x * t[0].xy) + (pos.y * t[1].xy), t[1].zw); | ||
} | ||
|
||
// | ||
// Constant Buffer | ||
// | ||
layout(std140) uniform VSConstants2D | ||
{ | ||
vec4 g_transform[2]; | ||
vec4 g_colorMul; | ||
}; | ||
|
||
layout(std140) uniform VSQuadWarp | ||
{ | ||
mat3x3 g_homography; | ||
}; | ||
|
||
vec2 Transform(vec2 pos, mat3x3 mat) | ||
{ | ||
float s = (mat[0][2] * pos.x + mat[1][2] * pos.y + mat[2][2]); | ||
float x = (mat[0][0] * pos.x + mat[1][0] * pos.y + mat[2][0]) / s; | ||
float y = (mat[0][1] * pos.x + mat[1][1] * pos.y + mat[2][1]) / s; | ||
return vec2(x, y); | ||
} | ||
|
||
// | ||
// Functions | ||
// | ||
void main() | ||
{ | ||
vec2 position = Transform(VertexPosition, g_homography); | ||
|
||
gl_Position = s3d_Transform2D(position, g_transform); | ||
|
||
Color = (VertexColor * g_colorMul); | ||
|
||
UV = position; | ||
} |
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,59 @@ | ||
// Copyright (c) 2008-2023 Ryo Suzuki. | ||
// Copyright (c) 2016-2023 OpenSiv3D Project. | ||
// Licensed under the MIT License. | ||
|
||
# version 410 | ||
|
||
// | ||
// Textures | ||
// | ||
uniform sampler2D Texture0; | ||
|
||
// | ||
// PSInput | ||
// | ||
layout(location = 0) in vec4 Color; | ||
layout(location = 1) in vec2 UV; | ||
|
||
// | ||
// PSOutput | ||
// | ||
layout(location = 0) out vec4 FragColor; | ||
|
||
// | ||
// Constant Buffer | ||
// | ||
layout(std140) uniform PSConstants2D | ||
{ | ||
vec4 g_colorAdd; | ||
vec4 g_sdfParam; | ||
vec4 g_sdfOutlineColor; | ||
vec4 g_sdfShadowColor; | ||
vec4 g_internal; | ||
}; | ||
|
||
layout(std140) uniform PSQuadWarp | ||
{ | ||
mat3x3 g_invHomography; | ||
vec4 g_uvTransform; | ||
}; | ||
|
||
vec2 Transform(vec2 pos, mat3x3 mat) | ||
{ | ||
float s = (mat[0][2] * pos.x + mat[1][2] * pos.y + mat[2][2]); | ||
float x = (mat[0][0] * pos.x + mat[1][0] * pos.y + mat[2][0]) / s; | ||
float y = (mat[0][1] * pos.x + mat[1][1] * pos.y + mat[2][1]) / s; | ||
return vec2(x, y); | ||
} | ||
|
||
// | ||
// Functions | ||
// | ||
void main() | ||
{ | ||
vec2 uv = (Transform(UV, g_invHomography) * g_uvTransform.xy + g_uvTransform.zw); | ||
|
||
vec4 texColor = texture(Texture0, uv); | ||
|
||
FragColor = ((texColor * Color) + g_colorAdd); | ||
} |
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,66 @@ | ||
// Copyright (c) 2008-2023 Ryo Suzuki. | ||
// Copyright (c) 2016-2023 OpenSiv3D Project. | ||
// Licensed under the MIT License. | ||
|
||
# version 410 | ||
|
||
// | ||
// VSInput | ||
// | ||
layout(location = 0) in vec2 VertexPosition; | ||
layout(location = 1) in vec2 VertexUV; | ||
layout(location = 2) in vec4 VertexColor; | ||
|
||
// | ||
// VSOutput | ||
// | ||
layout(location = 0) out vec4 Color; | ||
layout(location = 1) out vec2 UV; | ||
out gl_PerVertex | ||
{ | ||
vec4 gl_Position; | ||
}; | ||
|
||
// | ||
// Siv3D Functions | ||
// | ||
vec4 s3d_Transform2D(const vec2 pos, const vec4 t[2]) | ||
{ | ||
return vec4(t[0].zw + (pos.x * t[0].xy) + (pos.y * t[1].xy), t[1].zw); | ||
} | ||
|
||
// | ||
// Constant Buffer | ||
// | ||
layout(std140) uniform VSConstants2D | ||
{ | ||
vec4 g_transform[2]; | ||
vec4 g_colorMul; | ||
}; | ||
|
||
layout(std140) uniform VSQuadWarp | ||
{ | ||
mat3x3 g_homography; | ||
}; | ||
|
||
vec2 Transform(vec2 pos, mat3x3 mat) | ||
{ | ||
float s = (mat[0][2] * pos.x + mat[1][2] * pos.y + mat[2][2]); | ||
float x = (mat[0][0] * pos.x + mat[1][0] * pos.y + mat[2][0]) / s; | ||
float y = (mat[0][1] * pos.x + mat[1][1] * pos.y + mat[2][1]) / s; | ||
return vec2(x, y); | ||
} | ||
|
||
// | ||
// Functions | ||
// | ||
void main() | ||
{ | ||
vec2 position = Transform(VertexPosition, g_homography); | ||
|
||
gl_Position = s3d_Transform2D(position, g_transform); | ||
|
||
Color = (VertexColor * g_colorMul); | ||
|
||
UV = position; | ||
} |
Oops, something went wrong.