mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2025-12-16 05:20:06 +01:00
Add .clang-format and use it to format shader files (#1249)
This commit is contained in:
21
.clang-format
Normal file
21
.clang-format
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
BasedOnStyle: LLVM
|
||||||
|
AlignAfterOpenBracket: DontAlign
|
||||||
|
AlignOperands: DontAlign
|
||||||
|
AlignTrailingComments:
|
||||||
|
Kind: Never
|
||||||
|
OverEmptyLines: 0
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: Inline
|
||||||
|
BreakConstructorInitializers: AfterColon
|
||||||
|
ColumnLimit: 0
|
||||||
|
ContinuationIndentWidth: 8
|
||||||
|
IndentCaseLabels: true
|
||||||
|
IndentWidth: 4
|
||||||
|
InsertBraces: true
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
|
RemoveSemicolon: true
|
||||||
|
SpacesInLineCommentPrefix:
|
||||||
|
Minimum: 0 # We want a minimum of 1 for comments, but allow 0 for disabled code.
|
||||||
|
Maximum: -1
|
||||||
|
TabWidth: 4
|
||||||
|
UseTab: Always
|
||||||
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/burano.jpg-bbae3c5a81f8b6300cd944219dbbbc05.c
|
|||||||
compress/mode=0
|
compress/mode=0
|
||||||
compress/high_quality=false
|
compress/high_quality=false
|
||||||
compress/lossy_quality=0.7
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
compress/hdr_compression=1
|
compress/hdr_compression=1
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
compress/channel_pack=0
|
compress/channel_pack=0
|
||||||
@@ -25,6 +27,10 @@ mipmaps/generate=false
|
|||||||
mipmaps/limit=-1
|
mipmaps/limit=-1
|
||||||
roughness/mode=0
|
roughness/mode=0
|
||||||
roughness/src_normal=""
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
process/fix_alpha_border=true
|
process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/normal_map_invert_y=false
|
process/normal_map_invert_y=false
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ dest_files=["res://.godot/imported/filmgrain.png-8b1c9d8b22a2ffa8f94b1e004d5eddc
|
|||||||
compress/mode=2
|
compress/mode=2
|
||||||
compress/high_quality=false
|
compress/high_quality=false
|
||||||
compress/lossy_quality=0.7
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
compress/hdr_compression=1
|
compress/hdr_compression=1
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
compress/channel_pack=0
|
compress/channel_pack=0
|
||||||
@@ -26,6 +28,10 @@ mipmaps/generate=true
|
|||||||
mipmaps/limit=-1
|
mipmaps/limit=-1
|
||||||
roughness/mode=0
|
roughness/mode=0
|
||||||
roughness/src_normal=""
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
process/fix_alpha_border=true
|
process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/normal_map_invert_y=false
|
process/normal_map_invert_y=false
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/forest.jpg-f2ce28f12b0871a15d1e9ebfcd24b47f.c
|
|||||||
compress/mode=0
|
compress/mode=0
|
||||||
compress/high_quality=false
|
compress/high_quality=false
|
||||||
compress/lossy_quality=0.7
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
compress/hdr_compression=1
|
compress/hdr_compression=1
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
compress/channel_pack=0
|
compress/channel_pack=0
|
||||||
@@ -25,6 +27,10 @@ mipmaps/generate=false
|
|||||||
mipmaps/limit=-1
|
mipmaps/limit=-1
|
||||||
roughness/mode=0
|
roughness/mode=0
|
||||||
roughness/src_normal=""
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
process/fix_alpha_border=true
|
process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/normal_map_invert_y=false
|
process/normal_map_invert_y=false
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/mountains.jpg-fd51eb0e2a35878963804e860ef9d18
|
|||||||
compress/mode=0
|
compress/mode=0
|
||||||
compress/high_quality=false
|
compress/high_quality=false
|
||||||
compress/lossy_quality=0.7
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
compress/hdr_compression=1
|
compress/hdr_compression=1
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
compress/channel_pack=0
|
compress/channel_pack=0
|
||||||
@@ -25,6 +27,10 @@ mipmaps/generate=false
|
|||||||
mipmaps/limit=-1
|
mipmaps/limit=-1
|
||||||
roughness/mode=0
|
roughness/mode=0
|
||||||
roughness/src_normal=""
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
process/fix_alpha_border=true
|
process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/normal_map_invert_y=false
|
process/normal_map_invert_y=false
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/platformer.jpg-ce18350247a11c58497c7e0d8e3be2
|
|||||||
compress/mode=0
|
compress/mode=0
|
||||||
compress/high_quality=false
|
compress/high_quality=false
|
||||||
compress/lossy_quality=0.7
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
compress/hdr_compression=1
|
compress/hdr_compression=1
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
compress/channel_pack=0
|
compress/channel_pack=0
|
||||||
@@ -25,6 +27,10 @@ mipmaps/generate=false
|
|||||||
mipmaps/limit=-1
|
mipmaps/limit=-1
|
||||||
roughness/mode=0
|
roughness/mode=0
|
||||||
roughness/src_normal=""
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
process/fix_alpha_border=true
|
process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/normal_map_invert_y=false
|
process/normal_map_invert_y=false
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ dest_files=["res://.godot/imported/vignette.png-993dbe0a69e475ef62cba692d80d947d
|
|||||||
compress/mode=2
|
compress/mode=2
|
||||||
compress/high_quality=false
|
compress/high_quality=false
|
||||||
compress/lossy_quality=0.7
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
compress/hdr_compression=1
|
compress/hdr_compression=1
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
compress/channel_pack=0
|
compress/channel_pack=0
|
||||||
@@ -26,6 +28,10 @@ mipmaps/generate=true
|
|||||||
mipmaps/limit=-1
|
mipmaps/limit=-1
|
||||||
roughness/mode=0
|
roughness/mode=0
|
||||||
roughness/src_normal=""
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
process/fix_alpha_border=true
|
process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/normal_map_invert_y=false
|
process/normal_map_invert_y=false
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/white.png-9cdc9524282ba2bce69b45edcd6ac827.ct
|
|||||||
compress/mode=0
|
compress/mode=0
|
||||||
compress/high_quality=false
|
compress/high_quality=false
|
||||||
compress/lossy_quality=0.7
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
compress/hdr_compression=1
|
compress/hdr_compression=1
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
compress/channel_pack=0
|
compress/channel_pack=0
|
||||||
@@ -25,6 +27,10 @@ mipmaps/generate=false
|
|||||||
mipmaps/limit=-1
|
mipmaps/limit=-1
|
||||||
roughness/mode=0
|
roughness/mode=0
|
||||||
roughness/src_normal=""
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
process/fix_alpha_border=true
|
process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/normal_map_invert_y=false
|
process/normal_map_invert_y=false
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ct
|
|||||||
compress/mode=0
|
compress/mode=0
|
||||||
compress/high_quality=false
|
compress/high_quality=false
|
||||||
compress/lossy_quality=0.7
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
compress/hdr_compression=1
|
compress/hdr_compression=1
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
compress/channel_pack=0
|
compress/channel_pack=0
|
||||||
@@ -25,6 +27,10 @@ mipmaps/generate=false
|
|||||||
mipmaps/limit=-1
|
mipmaps/limit=-1
|
||||||
roughness/mode=0
|
roughness/mode=0
|
||||||
roughness/src_normal=""
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
process/fix_alpha_border=true
|
process/fix_alpha_border=true
|
||||||
process/premult_alpha=false
|
process/premult_alpha=false
|
||||||
process/normal_map_invert_y=false
|
process/normal_map_invert_y=false
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ config/description="Several examples of full screen 2D shader processing.
|
|||||||
Many common full-res effects are implemented here for reference."
|
Many common full-res effects are implemented here for reference."
|
||||||
config/tags=PackedStringArray("2d", "demo", "official", "rendering", "shaders")
|
config/tags=PackedStringArray("2d", "demo", "official", "rendering", "shaders")
|
||||||
run/main_scene="res://screen_shaders.tscn"
|
run/main_scene="res://screen_shaders.tscn"
|
||||||
config/features=PackedStringArray("4.4")
|
config/features=PackedStringArray("4.5")
|
||||||
config/icon="res://icon.webp"
|
config/icon="res://icon.webp"
|
||||||
|
|
||||||
[debug]
|
[debug]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
shader_type canvas_item;
|
shader_type canvas_item;
|
||||||
|
|
||||||
uniform sampler2D screen_texture : hint_screen_texture, filter_linear_mipmap;
|
uniform sampler2D screen_texture : hint_screen_texture, filter_linear_mipmap;
|
||||||
uniform float amount: hint_range(0.0, 5.0);
|
uniform float amount : hint_range(0.0, 5.0);
|
||||||
|
|
||||||
void fragment() {
|
void fragment() {
|
||||||
COLOR.rgb = textureLod(screen_texture, SCREEN_UV, amount).rgb;
|
COLOR.rgb = textureLod(screen_texture, SCREEN_UV, amount).rgb;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
shader_type canvas_item;
|
shader_type canvas_item;
|
||||||
|
|
||||||
uniform sampler2D screen_texture : hint_screen_texture, filter_linear_mipmap;
|
uniform sampler2D screen_texture : hint_screen_texture, filter_linear_mipmap;
|
||||||
uniform vec4 base: source_color;
|
uniform vec4 base : source_color;
|
||||||
uniform sampler2D grain;
|
uniform sampler2D grain;
|
||||||
uniform float grain_strength = 0.3;
|
uniform float grain_strength = 0.3;
|
||||||
uniform sampler2D vignette;
|
uniform sampler2D vignette;
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ void fragment() {
|
|||||||
float angle = length(rel) * rotation;
|
float angle = length(rel) * rotation;
|
||||||
mat2 rot = mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle)));
|
mat2 rot = mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle)));
|
||||||
rel = rot * rel;
|
rel = rot * rel;
|
||||||
uv = clamp(rel + vec2(0.5,0.5), vec2(0.0, 0.0), vec2(1.0, 1.0));
|
uv = clamp(rel + vec2(0.5, 0.5), vec2(0.0, 0.0), vec2(1.0, 1.0));
|
||||||
COLOR.rgb = textureLod(screen_texture, uv, 0.0).rgb;
|
COLOR.rgb = textureLod(screen_texture, uv, 0.0).rgb;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ void fragment() {
|
|||||||
vec3 rainbow = vec3(
|
vec3 rainbow = vec3(
|
||||||
0.5 + 0.5 * sin(t),
|
0.5 + 0.5 * sin(t),
|
||||||
0.5 + 0.5 * sin(t + 2.0),
|
0.5 + 0.5 * sin(t + 2.0),
|
||||||
0.5 + 0.5 * sin(t + 4.0)
|
0.5 + 0.5 * sin(t + 4.0));
|
||||||
);
|
|
||||||
ALBEDO = rainbow;
|
ALBEDO = rainbow;
|
||||||
ALPHA = 1.0;
|
ALPHA = 1.0;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -9,35 +9,28 @@ void fragment() {
|
|||||||
// Draw base color
|
// Draw base color
|
||||||
ALBEDO = my_color;
|
ALBEDO = my_color;
|
||||||
|
|
||||||
if (UV.y > 0.25)
|
if (UV.y > 0.25) {
|
||||||
{
|
|
||||||
// Draw gradient
|
// Draw gradient
|
||||||
float scale = UV.x * float(steps);
|
float scale = UV.x * float(steps);
|
||||||
|
|
||||||
if (exponential_view)
|
if (exponential_view) {
|
||||||
{
|
|
||||||
scale = (scale * scale) / float(steps);
|
scale = (scale * scale) / float(steps);
|
||||||
}
|
}
|
||||||
|
|
||||||
ALBEDO *= scale;
|
ALBEDO *= scale;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// Draw step separation bars
|
// Draw step separation bars
|
||||||
for (int i = 1; i < steps; i++)
|
for (int i = 1; i < steps; i++) {
|
||||||
{
|
|
||||||
float threshold = 0.002; // Bar size
|
float threshold = 0.002; // Bar size
|
||||||
float target = float(i);
|
float target = float(i);
|
||||||
|
|
||||||
if (exponential_view)
|
if (exponential_view) {
|
||||||
{
|
|
||||||
target = sqrt(float(i) * float(steps));
|
target = sqrt(float(i) * float(steps));
|
||||||
}
|
}
|
||||||
|
|
||||||
target = target / float(steps);
|
target = target / float(steps);
|
||||||
|
|
||||||
if (UV.x < target + threshold && UV.x > target - threshold)
|
if (UV.x < target + threshold && UV.x > target - threshold) {
|
||||||
{
|
|
||||||
ALBEDO = vec3(0); // Bars are colored black
|
ALBEDO = vec3(0); // Bars are colored black
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,45 +6,33 @@ uniform bool exponential_view = true;
|
|||||||
|
|
||||||
void fragment() {
|
void fragment() {
|
||||||
float top_bar = 0.01;
|
float top_bar = 0.01;
|
||||||
if (UV.y >= top_bar)
|
if (UV.y >= top_bar) {
|
||||||
{
|
|
||||||
float padding = 0.002;
|
float padding = 0.002;
|
||||||
float y = (UV.y - top_bar - padding) / (1.0 - top_bar - padding * 2.0);
|
float y = (UV.y - top_bar - padding) / (1.0 - top_bar - padding * 2.0);
|
||||||
y = clamp(y, 0.0, 1.0);
|
y = clamp(y, 0.0, 1.0);
|
||||||
float segments = 1.0 / 6.0;
|
float segments = 1.0 / 6.0;
|
||||||
vec3 col = vec3(0);
|
vec3 col = vec3(0);
|
||||||
if (y < segments)
|
if (y < segments) {
|
||||||
{
|
|
||||||
col.r = 1.0;
|
col.r = 1.0;
|
||||||
col.g = y / segments;
|
col.g = y / segments;
|
||||||
col.b = 0.0;
|
col.b = 0.0;
|
||||||
}
|
} else if (y < segments * 2.0) {
|
||||||
else if (y < segments * 2.0)
|
|
||||||
{
|
|
||||||
col.r = (y - segments * 2.0) / -segments;
|
col.r = (y - segments * 2.0) / -segments;
|
||||||
col.g = 1.0;
|
col.g = 1.0;
|
||||||
col.b = 0.0;
|
col.b = 0.0;
|
||||||
}
|
} else if (y < segments * 3.0) {
|
||||||
else if (y < segments * 3.0)
|
|
||||||
{
|
|
||||||
col.r = 0.0;
|
col.r = 0.0;
|
||||||
col.g = 1.0;
|
col.g = 1.0;
|
||||||
col.b = (y - segments * 2.0) / segments;
|
col.b = (y - segments * 2.0) / segments;
|
||||||
}
|
} else if (y < segments * 4.0) {
|
||||||
else if (y < segments * 4.0)
|
|
||||||
{
|
|
||||||
col.r = 0.0;
|
col.r = 0.0;
|
||||||
col.g = (y - segments * 4.0) / -segments;
|
col.g = (y - segments * 4.0) / -segments;
|
||||||
col.b = 1.0;
|
col.b = 1.0;
|
||||||
}
|
} else if (y < segments * 5.0) {
|
||||||
else if (y < segments * 5.0)
|
|
||||||
{
|
|
||||||
col.r = (y - segments * 4.0) / segments;
|
col.r = (y - segments * 4.0) / segments;
|
||||||
col.g = 0.0;
|
col.g = 0.0;
|
||||||
col.b = 1.0;
|
col.b = 1.0;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
col.r = 1.0;
|
col.r = 1.0;
|
||||||
col.g = 0.0;
|
col.g = 0.0;
|
||||||
col.b = (y - segments * 6.0) / -segments;
|
col.b = (y - segments * 6.0) / -segments;
|
||||||
@@ -52,31 +40,25 @@ void fragment() {
|
|||||||
|
|
||||||
float scale = UV.x * float(steps);
|
float scale = UV.x * float(steps);
|
||||||
|
|
||||||
if (exponential_view)
|
if (exponential_view) {
|
||||||
{
|
|
||||||
scale = (scale * scale) / float(steps);
|
scale = (scale * scale) / float(steps);
|
||||||
}
|
}
|
||||||
|
|
||||||
ALBEDO = col * scale;
|
ALBEDO = col * scale;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
ALBEDO = vec3(1.0);
|
ALBEDO = vec3(1.0);
|
||||||
// Draw step separation bars
|
// Draw step separation bars
|
||||||
for (int i = 1; i < steps; i++)
|
for (int i = 1; i < steps; i++) {
|
||||||
{
|
|
||||||
float threshold = 0.002; // Bar size
|
float threshold = 0.002; // Bar size
|
||||||
float target = float(i);
|
float target = float(i);
|
||||||
|
|
||||||
if (exponential_view)
|
if (exponential_view) {
|
||||||
{
|
|
||||||
target = sqrt(float(i) * float(steps));
|
target = sqrt(float(i) * float(steps));
|
||||||
}
|
}
|
||||||
|
|
||||||
target = target / float(steps);
|
target = target / float(steps);
|
||||||
|
|
||||||
if (UV.x < target + threshold && UV.x > target - threshold)
|
if (UV.x < target + threshold && UV.x > target - threshold) {
|
||||||
{
|
|
||||||
ALBEDO = vec3(0); // Bars are colored black
|
ALBEDO = vec3(0); // Bars are colored black
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
shader_type canvas_item;
|
shader_type canvas_item;
|
||||||
render_mode unshaded;
|
render_mode unshaded;
|
||||||
|
|
||||||
uniform vec2 viewport_size; // size in pixels of the viewport
|
uniform vec2 viewport_size; // size in pixels of the viewport
|
||||||
uniform sampler2D viewport1 : source_color;
|
uniform sampler2D viewport1 : source_color;
|
||||||
uniform sampler2D viewport2 : source_color;
|
uniform sampler2D viewport2 : source_color;
|
||||||
uniform bool split_active; // true: split screen, false: use view1
|
uniform bool split_active; // true: split screen, false: use view1
|
||||||
uniform vec2 player1_position; // position of player 1 un UV coordinates
|
uniform vec2 player1_position; // position of player 1 un UV coordinates
|
||||||
uniform vec2 player2_position; // position of player 2 un UV coordinates
|
uniform vec2 player2_position; // position of player 2 un UV coordinates
|
||||||
uniform float split_line_thickness : hint_range(0, 10, 0.1); // width of the split boder
|
uniform float split_line_thickness : hint_range(0, 10, 0.1); // width of the split boder
|
||||||
uniform vec3 split_line_color : source_color; // color of the split border
|
uniform vec3 split_line_color : source_color; // color of the split border
|
||||||
|
|
||||||
// from https://stackoverflow.com/questions/15276454/is-it-possible-to-draw-line-thickness-in-a-fragment-shader
|
// from https://stackoverflow.com/questions/15276454/is-it-possible-to-draw-line-thickness-in-a-fragment-shader
|
||||||
float distance_to_line(vec2 p1, vec2 p2, vec2 point) {
|
float distance_to_line(vec2 p1, vec2 p2, vec2 point) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
shader_type spatial;
|
shader_type spatial;
|
||||||
render_mode blend_mix,depth_draw_opaque,cull_disabled,unshaded,depth_test_disabled;
|
render_mode blend_mix, depth_draw_opaque, cull_disabled, unshaded, depth_test_disabled;
|
||||||
uniform vec4 albedo : source_color;
|
uniform vec4 albedo : source_color;
|
||||||
|
|
||||||
void vertex() {
|
void vertex() {
|
||||||
|
|||||||
@@ -5,5 +5,5 @@ uniform vec3 color : source_color = vec3(1.0, 1.0, 1.0);
|
|||||||
void fragment() {
|
void fragment() {
|
||||||
// Called for every pixel the material is visible on.
|
// Called for every pixel the material is visible on.
|
||||||
float dist = length(UV - vec2(0.5, 0.5));
|
float dist = length(UV - vec2(0.5, 0.5));
|
||||||
COLOR.a = 1.0 - clamp(abs(0.4 - dist)/0.1, 0.0, 1.0);
|
COLOR.a = 1.0 - clamp(abs(0.4 - dist) / 0.1, 0.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
shader_type spatial;
|
shader_type spatial;
|
||||||
render_mode blend_mix,depth_draw_opaque,cull_disabled,unshaded,depth_test_disabled;
|
render_mode blend_mix, depth_draw_opaque, cull_disabled, unshaded, depth_test_disabled;
|
||||||
uniform vec4 albedo : source_color;
|
uniform vec4 albedo : source_color;
|
||||||
|
|
||||||
void vertex() {
|
void vertex() {
|
||||||
|
|||||||
Reference in New Issue
Block a user