139 lines
4.6 KiB
Plaintext
139 lines
4.6 KiB
Plaintext
[gd_scene load_steps=10 format=2]
|
|
|
|
[ext_resource path="res://effects/npc/wall_struggler/offsets.exr" type="Texture" id=1]
|
|
[ext_resource path="res://effects/npc/wall_struggler/normals.png" type="Texture" id=2]
|
|
[ext_resource path="res://effects/npc/wall_struggler/Struggle_mesh069.mesh" type="ArrayMesh" id=3]
|
|
[ext_resource path="res://effects/npc/wall_struggler/MeatWallStruggle.png" type="Texture" id=4]
|
|
[ext_resource path="res://effects/npc/wall_struggler/WallStruggler.gd" type="Script" id=5]
|
|
|
|
[sub_resource type="Shader" id=1]
|
|
code = "// NOTE: Shader automatically converted from Godot Engine 3.5.1.stable.mono's SpatialMaterial.
|
|
|
|
shader_type spatial;
|
|
render_mode async_visible,blend_mix,depth_draw_opaque,cull_disabled,diffuse_burley,specular_schlick_ggx;
|
|
uniform vec4 albedo : hint_color;
|
|
uniform sampler2D texture_albedo : hint_albedo;
|
|
uniform float specular;
|
|
uniform float metallic;
|
|
uniform float roughness : hint_range(0,1);
|
|
uniform float point_size : hint_range(0,128);
|
|
uniform vec3 uv1_scale;
|
|
uniform vec3 uv1_offset;
|
|
uniform vec3 uv2_scale;
|
|
uniform vec3 uv2_offset;
|
|
|
|
uniform sampler2D offset_map;
|
|
uniform sampler2D normal_map;
|
|
|
|
uniform float start_frame = 0;
|
|
uniform float end_frame = 70.0;
|
|
uniform float time_scale = 0.5;
|
|
uniform float start_time = -1000.0;
|
|
|
|
|
|
|
|
|
|
|
|
void vertex(){
|
|
|
|
UV=UV*uv1_scale.xy+uv1_offset.xy;
|
|
|
|
float time_int = 1.0;
|
|
//float time = modf(TIME * time_scale, time_int);
|
|
float time = (TIME-start_time) * time_scale;
|
|
float num_frames = end_frame - start_frame;
|
|
float frame_offset = num_frames * INSTANCE_CUSTOM.a;
|
|
float current_frame = start_frame + mod((time * num_frames) + frame_offset, num_frames);
|
|
|
|
if (time < 0.0 || time > 1.0) {
|
|
current_frame = 0.0;
|
|
}
|
|
|
|
ivec2 tex_size = textureSize(offset_map, 0);
|
|
float pixel_size = 1.0 / float(tex_size.y);
|
|
float frame_floor = clamp(floor(current_frame), start_frame, end_frame);
|
|
float frame_ceil = clamp(ceil(current_frame), start_frame, end_frame);
|
|
|
|
vec2 frame_floor_uv_offset = vec2(0.0, -((frame_floor + 0.5) * pixel_size));
|
|
vec2 frame_ceil_uv_offset = vec2(0.0, -((frame_ceil + 0.5) * pixel_size));
|
|
|
|
float lerp_factor = current_frame - frame_floor;
|
|
|
|
vec3 offset_floor = texture(offset_map, UV2 + frame_floor_uv_offset).xyz;
|
|
vec3 offset_ceil = texture(offset_map, UV2 + frame_ceil_uv_offset).xyz;
|
|
vec3 offset_lerp = mix(offset_floor, offset_ceil, lerp_factor);
|
|
vec3 new_offset = vec3(offset_lerp.x, offset_lerp.z, offset_lerp.y);
|
|
|
|
VERTEX += new_offset;
|
|
|
|
vec3 normal_floor = texture(normal_map, UV2 + frame_floor_uv_offset).xyz;
|
|
vec3 normal_ceil = texture(normal_map, UV2 + frame_ceil_uv_offset).xyz;
|
|
vec3 normal_lerp = mix(normal_floor, normal_ceil, lerp_factor);
|
|
vec3 new_normal = vec3((normal_lerp.x * 2.0) - 1.0, (normal_lerp.z * 2.0) - 1.0, (normal_lerp.y * 2.0) - 1.0);
|
|
|
|
NORMAL = new_normal;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void fragment() {
|
|
vec2 base_uv = UV;
|
|
vec4 albedo_tex = texture(texture_albedo,base_uv);
|
|
albedo_tex *= COLOR;
|
|
ALBEDO = albedo.rgb * albedo_tex.rgb;
|
|
METALLIC = metallic;
|
|
ROUGHNESS = roughness;
|
|
SPECULAR = specular;
|
|
}
|
|
|
|
"
|
|
|
|
[sub_resource type="ShaderMaterial" id=2]
|
|
resource_name = "MeatWallStruggle"
|
|
shader = SubResource( 1 )
|
|
shader_param/albedo = Color( 1, 1, 1, 1 )
|
|
shader_param/specular = 0.1
|
|
shader_param/metallic = 0.0
|
|
shader_param/roughness = 0.775
|
|
shader_param/point_size = 1.0
|
|
shader_param/uv1_scale = Vector3( 1, 1, 1 )
|
|
shader_param/uv1_offset = Vector3( 0, 0, 0 )
|
|
shader_param/uv2_scale = Vector3( 1, 1, 1 )
|
|
shader_param/uv2_offset = Vector3( 0, 0, 0 )
|
|
shader_param/start_frame = 0.0
|
|
shader_param/end_frame = 70.0
|
|
shader_param/time_scale = 0.5
|
|
shader_param/start_time = -1000.0
|
|
shader_param/texture_albedo = ExtResource( 4 )
|
|
shader_param/offset_map = ExtResource( 1 )
|
|
shader_param/normal_map = ExtResource( 2 )
|
|
|
|
[sub_resource type="BoxShape" id=3]
|
|
extents = Vector3( 1.72965, 1.52498, 0.0716956 )
|
|
|
|
[sub_resource type="BoxShape" id=4]
|
|
extents = Vector3( 1, 1, 1.66041 )
|
|
|
|
[node name="WallStruggler" type="MeshInstance"]
|
|
transform = Transform( 0.75, 0, 0, 0, 0.75, 0, 0, 0, 0.75, 0, 0, 0 )
|
|
material_override = SubResource( 2 )
|
|
mesh = ExtResource( 3 )
|
|
script = ExtResource( 5 )
|
|
|
|
[node name="StaticBody" type="StaticBody" parent="."]
|
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.215516 )
|
|
|
|
[node name="CollisionShape" type="CollisionShape" parent="StaticBody"]
|
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.0202021 )
|
|
shape = SubResource( 3 )
|
|
|
|
[node name="Area" type="Area" parent="."]
|
|
|
|
[node name="CollisionShape" type="CollisionShape" parent="Area"]
|
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1.52395, 0, -0.135652, 1.12392 )
|
|
shape = SubResource( 4 )
|
|
|
|
[connection signal="body_entered" from="Area" to="." method="_on_Area_body_entered"]
|