You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
182 lines
4.8 KiB
182 lines
4.8 KiB
[gd_scene load_steps=17 format=2] |
|
|
|
[ext_resource path="res://gfx/hit_decal.png" type="Texture" id=1] |
|
[ext_resource path="res://src/Objects/HitDecal.cs" type="Script" id=2] |
|
|
|
[sub_resource type="VisualShaderNodeInput" id=15] |
|
input_name = "modulate_color" |
|
|
|
[sub_resource type="VisualShaderNodeInput" id=16] |
|
input_name = "modulate_alpha" |
|
|
|
[sub_resource type="VisualShaderNodeScalarOp" id=17] |
|
operator = 2 |
|
|
|
[sub_resource type="VisualShaderNodeExpression" id=18] |
|
size = Vector2( 512, 260 ) |
|
expression = "vec2 tex_size = vec2(textureSize(mask, 0)); |
|
vec2 pix_loc = uv.xy / TEXTURE_PIXEL_SIZE; |
|
mask_uv = vec3((pix_loc + offset.xy) / tex_size, 0); |
|
outside = mask_uv.x >= 0.0 && mask_uv.x <= 1.0 && |
|
mask_uv.y >= 0.0 && mask_uv.y <= 1.0;" |
|
|
|
[sub_resource type="VisualShaderNodeInput" id=19] |
|
input_name = "uv" |
|
|
|
[sub_resource type="VisualShaderNodeScalarSwitch" id=20] |
|
|
|
[sub_resource type="VisualShaderNodeVectorOp" id=21] |
|
operator = 2 |
|
|
|
[sub_resource type="VisualShaderNodeTexture" id=22] |
|
source = 5 |
|
|
|
[sub_resource type="VisualShaderNodeInput" id=23] |
|
input_name = "texture" |
|
|
|
[sub_resource type="VisualShaderNodeScalarOp" id=24] |
|
operator = 2 |
|
|
|
[sub_resource type="VisualShaderNodeVec3Uniform" id=25] |
|
uniform_name = "offset" |
|
|
|
[sub_resource type="VisualShaderNodeTextureUniform" id=26] |
|
uniform_name = "mask" |
|
|
|
[sub_resource type="VisualShader" id=27] |
|
code = "shader_type canvas_item; |
|
uniform vec3 offset; |
|
uniform sampler2D mask; |
|
|
|
|
|
|
|
void vertex() { |
|
// Output:0 |
|
|
|
} |
|
|
|
void fragment() { |
|
// Input:10 |
|
vec3 n_out10p0 = MODULATE.rgb; |
|
|
|
// Input:3 |
|
|
|
// Texture:2 |
|
vec3 n_out2p0; |
|
float n_out2p1; |
|
{ |
|
vec4 TEXTURE_tex_read = texture(TEXTURE, UV.xy); |
|
n_out2p0 = TEXTURE_tex_read.rgb; |
|
n_out2p1 = TEXTURE_tex_read.a; |
|
} |
|
|
|
// VectorOp:18 |
|
vec3 n_out18p0 = n_out10p0 * n_out2p0; |
|
|
|
// Input:13 |
|
float n_out13p0 = MODULATE.a; |
|
|
|
// VectorUniform:7 |
|
vec3 n_out7p0 = offset; |
|
|
|
// Input:16 |
|
vec3 n_out16p0 = vec3(UV, 0.0); |
|
|
|
// Expression:15 |
|
vec3 n_out15p0; |
|
bool n_out15p1; |
|
n_out15p0 = vec3(0.0, 0.0, 0.0); |
|
n_out15p1 = false; |
|
{ |
|
vec2 tex_size = vec2(textureSize(mask, 0)); |
|
vec2 pix_loc = n_out16p0.xy / TEXTURE_PIXEL_SIZE; |
|
n_out15p0 = vec3((pix_loc + n_out7p0.xy) / tex_size, 0); |
|
n_out15p1 = n_out15p0.x >= 0.0 && n_out15p0.x <= 1.0 && |
|
n_out15p0.y >= 0.0 && n_out15p0.y <= 1.0; |
|
} |
|
|
|
// TextureUniform:8 |
|
vec3 n_out8p0; |
|
float n_out8p1; |
|
{ |
|
vec4 n_tex_read = texture(mask, n_out15p0.xy); |
|
n_out8p0 = n_tex_read.rgb; |
|
n_out8p1 = n_tex_read.a; |
|
} |
|
|
|
// ScalarSwitch:17 |
|
float n_in17p2 = 0.00000; |
|
float n_out17p0; |
|
if(n_out15p1) |
|
{ |
|
n_out17p0 = n_out8p1; |
|
} |
|
else |
|
{ |
|
n_out17p0 = n_in17p2; |
|
} |
|
|
|
// ScalarOp:6 |
|
float n_out6p0 = n_out2p1 * n_out17p0; |
|
|
|
// ScalarOp:14 |
|
float n_out14p0 = n_out13p0 * n_out6p0; |
|
|
|
// Output:0 |
|
COLOR.rgb = n_out18p0; |
|
COLOR.a = n_out14p0; |
|
|
|
} |
|
|
|
void light() { |
|
// Output:0 |
|
|
|
} |
|
" |
|
graph_offset = Vector2( 341, -275 ) |
|
mode = 1 |
|
flags/light_only = false |
|
nodes/fragment/0/position = Vector2( 840, -100 ) |
|
nodes/fragment/2/node = SubResource( 22 ) |
|
nodes/fragment/2/position = Vector2( 400, -40 ) |
|
nodes/fragment/3/node = SubResource( 23 ) |
|
nodes/fragment/3/position = Vector2( 220, -40 ) |
|
nodes/fragment/6/node = SubResource( 24 ) |
|
nodes/fragment/6/position = Vector2( 640, 60 ) |
|
nodes/fragment/7/node = SubResource( 25 ) |
|
nodes/fragment/7/position = Vector2( -340, 60 ) |
|
nodes/fragment/8/node = SubResource( 26 ) |
|
nodes/fragment/8/position = Vector2( 400, 100 ) |
|
nodes/fragment/10/node = SubResource( 15 ) |
|
nodes/fragment/10/position = Vector2( 320, -200 ) |
|
nodes/fragment/13/node = SubResource( 16 ) |
|
nodes/fragment/13/position = Vector2( 320, -120 ) |
|
nodes/fragment/14/node = SubResource( 17 ) |
|
nodes/fragment/14/position = Vector2( 640, -60 ) |
|
nodes/fragment/15/node = SubResource( 18 ) |
|
nodes/fragment/15/position = Vector2( -140, 40 ) |
|
nodes/fragment/15/size = Vector2( 512, 260 ) |
|
nodes/fragment/15/input_ports = "0,1,offset;1,1,uv;" |
|
nodes/fragment/15/output_ports = "0,1,mask_uv;1,2,outside;" |
|
nodes/fragment/15/expression = "vec2 tex_size = vec2(textureSize(mask, 0)); |
|
vec2 pix_loc = uv.xy / TEXTURE_PIXEL_SIZE; |
|
mask_uv = vec3((pix_loc + offset.xy) / tex_size, 0); |
|
outside = mask_uv.x >= 0.0 && mask_uv.x <= 1.0 && |
|
mask_uv.y >= 0.0 && mask_uv.y <= 1.0;" |
|
nodes/fragment/16/node = SubResource( 19 ) |
|
nodes/fragment/16/position = Vector2( -340, 140 ) |
|
nodes/fragment/17/node = SubResource( 20 ) |
|
nodes/fragment/17/position = Vector2( 620, 180 ) |
|
nodes/fragment/18/node = SubResource( 21 ) |
|
nodes/fragment/18/position = Vector2( 640, -180 ) |
|
nodes/fragment/connections = PoolIntArray( 3, 0, 2, 2, 2, 1, 6, 0, 6, 0, 14, 1, 13, 0, 14, 0, 14, 0, 0, 1, 7, 0, 15, 0, 16, 0, 15, 1, 15, 0, 8, 0, 15, 1, 17, 0, 8, 1, 17, 1, 17, 0, 6, 1, 10, 0, 18, 0, 2, 0, 18, 1, 18, 0, 0, 0 ) |
|
|
|
[sub_resource type="ShaderMaterial" id=14] |
|
shader = SubResource( 27 ) |
|
shader_param/offset = Vector3( 0, 0, 0 ) |
|
|
|
[node name="HitDecal" type="Sprite"] |
|
material = SubResource( 14 ) |
|
texture = ExtResource( 1 ) |
|
centered = false |
|
script = ExtResource( 2 )
|
|
|