Projectile TRIGGER_GROUND
This commit is contained in:
parent
211881fcfb
commit
3cabf08b85
189
addons/decals/Decal.shader
Normal file
189
addons/decals/Decal.shader
Normal file
@ -0,0 +1,189 @@
|
||||
shader_type spatial;
|
||||
render_mode blend_mix, depth_draw_never, cull_back, depth_test_disable;
|
||||
|
||||
uniform sampler2D border_mask : hint_white;
|
||||
|
||||
uniform sampler2D albedo : hint_albedo;
|
||||
uniform vec4 albedo_tint : hint_color = vec4(1.0);
|
||||
|
||||
uniform sampler2D emission : hint_black;
|
||||
uniform vec4 emission_tint : hint_color = vec4(vec3(0.0), 1.0);
|
||||
uniform float emission_strength = 1.0;
|
||||
|
||||
uniform sampler2D occlusion : hint_white;
|
||||
uniform float occlusion_strength = 1.0;
|
||||
|
||||
uniform sampler2D specular : hint_white;
|
||||
uniform float specular_strength = 1.0;
|
||||
|
||||
uniform sampler2D metallic : hint_black;
|
||||
uniform float metallic_strength = 1.0;
|
||||
|
||||
uniform sampler2D normal_map : hint_normal;
|
||||
|
||||
uniform float animation_speed = 1.0;
|
||||
uniform int flipbook_columns_count = 1;
|
||||
uniform bool one_shot = false;
|
||||
uniform float start_time; // set by script
|
||||
|
||||
uniform float current_frame_blend = 0.0;
|
||||
|
||||
uniform bool use_normal_map = false;
|
||||
|
||||
varying vec3 decal_half_scale;
|
||||
varying vec3 decal_right;
|
||||
varying vec3 decal_up;
|
||||
varying vec3 decal_forward;
|
||||
|
||||
|
||||
int get_current_frame(float cur_time)
|
||||
{
|
||||
int cur_frame = int(round((cur_time - start_time) * animation_speed));
|
||||
if (one_shot)
|
||||
{
|
||||
cur_frame = clamp(cur_frame,0,flipbook_columns_count*flipbook_columns_count-1);
|
||||
}
|
||||
return cur_frame;
|
||||
}
|
||||
|
||||
//Checks if the given point is in the decal's boundaries using an oriented bounding box defined by the decal's tranform
|
||||
bool is_point_in_decal_bounds(vec3 point, vec3 decal_position)
|
||||
{
|
||||
vec3 scale = decal_half_scale * 2.0;
|
||||
vec3 p = point - decal_position;
|
||||
return abs(dot(p, decal_right)) <= scale.x && abs(dot(p, decal_forward)) <= scale.y && abs(dot(p, decal_up)) <= scale.z;
|
||||
}
|
||||
|
||||
|
||||
void vertex()
|
||||
{
|
||||
vec3 world_position = (WORLD_MATRIX*vec4(0.0, 0.0, 0.0, 1.0)).xyz;
|
||||
UV = world_position.xy;
|
||||
UV2 = vec2(world_position.z,0.0);
|
||||
|
||||
decal_right = (WORLD_MATRIX*vec4(1.0, 0.0, 0.0, 1.0)).xyz - world_position;
|
||||
decal_forward = (WORLD_MATRIX*vec4(0.0, 0.0, -1.0, 1.0)).xyz - world_position;
|
||||
decal_up = (WORLD_MATRIX*vec4(0.0, 1.0, 0.0, 1.0)).xyz - world_position;
|
||||
decal_half_scale = vec3(length(decal_right), length(decal_forward), length(decal_up)) / 2.0;
|
||||
decal_right = normalize(decal_right);
|
||||
decal_forward = normalize(decal_forward);
|
||||
decal_up = normalize(decal_up);
|
||||
|
||||
//Override the projector mesh's normals in order to render the decal with mostly correct lighting
|
||||
NORMAL = vec3(0.0, 0.0, 1.0);
|
||||
TANGENT = vec3(1.0, 0.0, 0.0);
|
||||
BINORMAL = vec3(0.0, 1.0, 0.0);
|
||||
|
||||
}
|
||||
|
||||
void fragment ()
|
||||
{
|
||||
//Compute world position using the depth buffer
|
||||
float depth = texture(DEPTH_TEXTURE, SCREEN_UV).x;
|
||||
vec3 ndc = vec3(SCREEN_UV, depth) * 2.0 - 1.0;
|
||||
vec4 view = INV_PROJECTION_MATRIX * vec4(ndc, 1.0);
|
||||
view.xyz /= view.w;
|
||||
vec4 world = CAMERA_MATRIX * INV_PROJECTION_MATRIX * vec4(ndc, 1.0);
|
||||
vec3 world_position = world.xyz / world.w;
|
||||
|
||||
vec3 decal_position = vec3(UV.xy, UV2.x);
|
||||
|
||||
|
||||
if(is_point_in_decal_bounds(world_position, decal_position))
|
||||
{
|
||||
//If the world position is within the decal's boundaries, we can compute it's uv coordinates
|
||||
vec4 local_position = (vec4(world_position - decal_position, 0.0)) * WORLD_MATRIX;
|
||||
int current_frame = get_current_frame(TIME);
|
||||
vec2 flipbook_frame_index = vec2(float(current_frame % flipbook_columns_count), float(current_frame / flipbook_columns_count));
|
||||
vec2 frame_size = vec2(1.0/float(flipbook_columns_count));
|
||||
|
||||
vec2 uv_coords = (vec2(local_position.x, -local_position.y) / (4.0*(decal_half_scale.xz * 2.0 * decal_half_scale.xz))) - vec2(0.5);
|
||||
|
||||
//This is used to fix some blending issues on the decal's edges, border mask is a white texture with a 1px transparent border on all sides
|
||||
float border_alpha = texture(border_mask, uv_coords).a;
|
||||
|
||||
//Offset UVs to handle flipbook animation
|
||||
uv_coords = uv_coords / float(flipbook_columns_count);
|
||||
uv_coords -= float(flipbook_columns_count - 1) * frame_size - flipbook_frame_index * frame_size;
|
||||
|
||||
//Hacky stuff, to get UVs, correct lighting and normal mapping working, i need to get the fragment's local position in the light shader
|
||||
//Unfortunately, we can't use varying to pass values between the fragment and light shaders
|
||||
//To work around this limitation, i put the data i need in the TRANSMISSION built-in.
|
||||
//Also, due to some limitation caused by how this shader works, PBR lighting isn't supported.
|
||||
TRANSMISSION = vec3(1.0) - local_position.xyz / 100.0;
|
||||
|
||||
ALBEDO = texture(albedo, uv_coords).rgb * albedo_tint.rgb;
|
||||
EMISSION = texture(emission, uv_coords).rgb * emission_tint.rgb * emission_strength;
|
||||
ALPHA = texture(albedo, uv_coords).a * albedo_tint.a * border_alpha;
|
||||
}else{
|
||||
ALPHA = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
//taken from http://www.thetenthplanet.de/archives/1180
|
||||
mat3 cotangent_frame(vec3 N, vec3 p, vec2 uv)
|
||||
{
|
||||
|
||||
vec3 dp1 = dFdx(p);
|
||||
vec3 dp2 = dFdy(p);
|
||||
vec2 duv1 = dFdx(uv);
|
||||
vec2 duv2 = dFdy(uv);
|
||||
|
||||
vec3 dp2perp = cross( dp2, N );
|
||||
vec3 dp1perp = cross( N, dp1 );
|
||||
|
||||
vec3 T = dp2perp * duv1.x + dp1perp * duv2.x;
|
||||
vec3 B = dp2perp * duv1.y + dp1perp * duv2.y;
|
||||
|
||||
float invmax = inversesqrt( max( dot(T,T), dot(B,B) ) );
|
||||
return mat3( T * invmax, B * invmax, N );
|
||||
}
|
||||
|
||||
vec3 perturb_normal(vec3 N, vec3 V, vec2 texcoord )
|
||||
{
|
||||
vec3 map = texture(normal_map, texcoord ).rgb;
|
||||
map = map * 255./127. - 128./127.;
|
||||
map.x *= -1.0;
|
||||
map.y *= 1.0;
|
||||
map.z *= -1.0;
|
||||
mat3 TBN = cotangent_frame(N, V, texcoord);
|
||||
return normalize(TBN * map);
|
||||
}
|
||||
|
||||
void light ()
|
||||
{
|
||||
//Get back the data from the fragment shader
|
||||
vec3 data = (vec3(1.0) - TRANSMISSION) * 100.0;
|
||||
|
||||
//Recompute UV coordinates
|
||||
vec2 uv_coords = vec2(data.x, -data.y);
|
||||
|
||||
int current_frame = get_current_frame(TIME);
|
||||
vec2 flipbook_frame_index = vec2(float(current_frame % flipbook_columns_count), float(current_frame / flipbook_columns_count));
|
||||
vec2 frame_size = vec2(1.0/float(flipbook_columns_count));
|
||||
uv_coords = (uv_coords.xy / (4.0*(decal_half_scale.xz * 2.0 * decal_half_scale.xz))) - vec2(0.5);
|
||||
uv_coords = uv_coords / float(flipbook_columns_count);
|
||||
uv_coords -= float(flipbook_columns_count - 1) * frame_size - flipbook_frame_index * frame_size;
|
||||
|
||||
//Normal mapping
|
||||
vec3 normal = NORMAL;
|
||||
if(use_normal_map == true)
|
||||
{
|
||||
normal = perturb_normal(NORMAL, VIEW, uv_coords);
|
||||
}
|
||||
|
||||
float n_dot_l = clamp(dot(normal, LIGHT), 0.0, 1.0);
|
||||
|
||||
//Specular lighting
|
||||
vec3 view_dir = normalize(CAMERA_MATRIX[3].xyz - data);
|
||||
vec3 reflection_dir = reflect(-LIGHT, normal);
|
||||
float spec = pow(max(dot(view_dir, reflection_dir), 0.0), 32);
|
||||
vec3 specular_light = specular_strength * spec * LIGHT_COLOR;
|
||||
|
||||
//Diffuse lighting
|
||||
vec3 albedo_color = ALBEDO * n_dot_l;
|
||||
albedo_color = albedo_color * mix(1.0, texture(occlusion, uv_coords).r, occlusion_strength);
|
||||
|
||||
DIFFUSE_LIGHT += albedo_color * ATTENUATION * LIGHT_COLOR;
|
||||
SPECULAR_LIGHT = specular_light * texture(specular, uv_coords).r;
|
||||
}
|
178
addons/decals/DecalGLES2.shader
Normal file
178
addons/decals/DecalGLES2.shader
Normal file
@ -0,0 +1,178 @@
|
||||
shader_type spatial;
|
||||
render_mode blend_mix, depth_draw_never, cull_back, depth_test_disable;
|
||||
|
||||
uniform sampler2D border_mask : hint_white;
|
||||
|
||||
uniform sampler2D albedo : hint_albedo;
|
||||
uniform vec4 albedo_tint : hint_color = vec4(1.0);
|
||||
|
||||
uniform sampler2D emission : hint_black;
|
||||
uniform vec4 emission_tint : hint_color = vec4(vec3(0.0), 1.0);
|
||||
uniform float emission_strength = 1.0;
|
||||
|
||||
uniform sampler2D occlusion : hint_white;
|
||||
uniform float occlusion_strength = 1.0;
|
||||
|
||||
uniform sampler2D specular : hint_white;
|
||||
uniform float specular_strength = 1.0;
|
||||
|
||||
uniform sampler2D metallic : hint_black;
|
||||
uniform float metallic_strength = 1.0;
|
||||
|
||||
uniform sampler2D normal_map : hint_normal;
|
||||
|
||||
uniform int current_frame = 0;
|
||||
uniform int flipbook_columns_count = 1;
|
||||
|
||||
uniform float current_frame_blend = 0.0;
|
||||
|
||||
uniform bool use_normal_map = false;
|
||||
|
||||
varying vec3 decal_half_scale;
|
||||
varying vec3 decal_right;
|
||||
varying vec3 decal_up;
|
||||
varying vec3 decal_forward;
|
||||
|
||||
//Checks if the given point is in the decal's boundaries using an oriented bounding box defined by the decal's tranform
|
||||
bool is_point_in_decal_bounds(vec3 point, vec3 decal_position)
|
||||
{
|
||||
vec3 scale = decal_half_scale * 2.0;
|
||||
vec3 p = point - decal_position;
|
||||
return abs(dot(p, decal_right)) <= scale.x && abs(dot(p, decal_forward)) <= scale.y && abs(dot(p, decal_up)) <= scale.z;
|
||||
}
|
||||
|
||||
void vertex()
|
||||
{
|
||||
vec3 world_position = (WORLD_MATRIX*vec4(0.0, 0.0, 0.0, 1.0)).xyz;
|
||||
UV = world_position.xy;
|
||||
UV2 = vec2(world_position.z,0.0);
|
||||
|
||||
decal_right = (WORLD_MATRIX*vec4(1.0, 0.0, 0.0, 1.0)).xyz - world_position;
|
||||
decal_forward = (WORLD_MATRIX*vec4(0.0, 0.0, -1.0, 1.0)).xyz - world_position;
|
||||
decal_up = (WORLD_MATRIX*vec4(0.0, 1.0, 0.0, 1.0)).xyz - world_position;
|
||||
decal_half_scale = vec3(length(decal_right), length(decal_forward), length(decal_up)) / 2.0;
|
||||
decal_right = normalize(decal_right);
|
||||
decal_forward = normalize(decal_forward);
|
||||
decal_up = normalize(decal_up);
|
||||
|
||||
//Override the projector mesh's normals in order to render the decal with mostly correct lighting
|
||||
NORMAL = vec3(0.0, 0.0, 1.0);
|
||||
TANGENT = vec3(1.0, 0.0, 0.0);
|
||||
BINORMAL = vec3(0.0, 1.0, 0.0);
|
||||
}
|
||||
|
||||
void fragment ()
|
||||
{
|
||||
//Compute world position using the depth buffer
|
||||
float depth = texture(DEPTH_TEXTURE, SCREEN_UV).x;
|
||||
vec3 ndc = vec3(SCREEN_UV, depth) * 2.0 - 1.0;
|
||||
vec4 view = INV_PROJECTION_MATRIX * vec4(ndc, 1.0);
|
||||
view.xyz /= view.w;
|
||||
vec4 world = CAMERA_MATRIX * INV_PROJECTION_MATRIX * vec4(ndc, 1.0);
|
||||
vec3 world_position = world.xyz / world.w;
|
||||
|
||||
vec3 decal_position = vec3(UV.xy, UV2.x);
|
||||
|
||||
if(is_point_in_decal_bounds(world_position, decal_position))
|
||||
{
|
||||
//If the world position is within the decal's boundaries, we can compute it's uv coordinates
|
||||
vec4 local_position = (vec4(world_position - decal_position, 0.0)) * WORLD_MATRIX;
|
||||
|
||||
vec2 flipbook_frame_index = vec2(float(current_frame % flipbook_columns_count), float(current_frame / flipbook_columns_count));
|
||||
vec2 frame_size = vec2(1.0/float(flipbook_columns_count));
|
||||
vec2 uv_coords = (vec2(local_position.x, -local_position.y) / (4.0*(decal_half_scale.xy * 2.0 * decal_half_scale.xy))) - vec2(0.5);
|
||||
|
||||
//This is used to fix some blending issues on the decal's edges, border mask is a white texture with a 1px transparent border on all sides
|
||||
float border_alpha = texture(border_mask, uv_coords).a;
|
||||
|
||||
//Offset UVs to handle flipbook animation
|
||||
uv_coords = uv_coords / float(flipbook_columns_count);
|
||||
uv_coords -= float(flipbook_columns_count - 1) * frame_size - flipbook_frame_index * frame_size;
|
||||
|
||||
//Hacky stuff, to get UVs, correct lighting and normal mapping working, i need to get the fragment's local position in the light shader
|
||||
//Unfortunately, we can't use varying to pass values between the fragment and light shaders
|
||||
//To work around this limitation, i put the data i need in the TRANSMISSION built-in.
|
||||
//Also, due to some limitation caused by how this shader works, PBR lighting isn't supported.
|
||||
TRANSMISSION = vec3(1.0) - local_position.xyz / 100.0;
|
||||
|
||||
ALBEDO = texture(albedo, uv_coords).rgb * albedo_tint.rgb;
|
||||
EMISSION = texture(emission, uv_coords).rgb * emission_tint.rgb * emission_strength;
|
||||
ALPHA = texture(albedo, uv_coords).a * albedo_tint.a * border_alpha;
|
||||
}else{
|
||||
ALPHA = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
//taken from https://stackoverflow.com/questions/22442304/glsl-es-dfdx-dfdy-analog
|
||||
float dfd(vec2 p)
|
||||
{
|
||||
return p.x * p.x - p.y;
|
||||
}
|
||||
|
||||
//taken from http://www.thetenthplanet.de/archives/1180 -- Modified for ES2!
|
||||
mat3 cotangent_frame(vec3 N, vec3 p, vec2 uv)
|
||||
{
|
||||
vec2 ps = vec2(1.0 / uv.x, 1.0 / uv.y);
|
||||
float c = dfd(uv);
|
||||
vec3 dp1 = vec3(dfd(uv + p.x) - c);
|
||||
vec3 dp2 = vec3(dfd(uv + p.y) - c);
|
||||
vec2 duv1 = vec2(dfd(uv));
|
||||
vec2 duv2 = vec2(dfd(uv));
|
||||
|
||||
vec3 dp2perp = cross( dp2, N );
|
||||
vec3 dp1perp = cross( N, dp1 );
|
||||
|
||||
vec3 T = dp2perp * duv1.x + dp1perp * duv2.x;
|
||||
vec3 B = dp2perp * duv1.y + dp1perp * duv2.y;
|
||||
|
||||
float invmax = inversesqrt( max( dot(T,T), dot(B,B) ) );
|
||||
return mat3( T * invmax, B * invmax, N );
|
||||
}
|
||||
|
||||
vec3 perturb_normal(vec3 N, vec3 V, vec2 texcoord )
|
||||
{
|
||||
vec3 map = texture(normal_map, texcoord ).rgb;
|
||||
map = map * 255./127. - 128./127.;
|
||||
map.x *= 1.0; //Normal direction is flipped in GLES2
|
||||
map.y *= 1.0;
|
||||
map.z *= -1.0;
|
||||
//mat3 TBN = cotangent_frame(N, V, texcoord); //Makes normals look worse in GLES2
|
||||
return normalize(map);
|
||||
}
|
||||
|
||||
void light ()
|
||||
{
|
||||
//Get back the data from the fragment shader
|
||||
vec3 data = (vec3(1.0) - TRANSMISSION) * 100.0;
|
||||
|
||||
//Recompute UV coordinates
|
||||
vec2 uv_coords = vec2(data.x, -data.y);
|
||||
|
||||
vec2 flipbook_frame_index = vec2(float(current_frame % flipbook_columns_count), float(current_frame / flipbook_columns_count));
|
||||
vec2 frame_size = vec2(1.0/float(flipbook_columns_count));
|
||||
uv_coords = (uv_coords.xy / (4.0*(decal_half_scale.xy * 2.0 * decal_half_scale.xy))) - vec2(0.5);
|
||||
uv_coords = uv_coords / float(flipbook_columns_count);
|
||||
uv_coords -= float(flipbook_columns_count - 1) * frame_size - flipbook_frame_index * frame_size;
|
||||
|
||||
//Normal mapping
|
||||
vec3 normal = NORMAL;
|
||||
if(use_normal_map == true)
|
||||
{
|
||||
normal = perturb_normal(NORMAL, VIEW, uv_coords);
|
||||
}
|
||||
|
||||
float n_dot_l = clamp(dot(normal, LIGHT), 0.0, 1.0);
|
||||
|
||||
//Specular lighting
|
||||
vec3 view_dir = normalize(CAMERA_MATRIX[3].xyz - data);
|
||||
vec3 reflection_dir = reflect(-LIGHT, normal);
|
||||
float spec = pow(max(dot(view_dir, reflection_dir), 0.0), 32);
|
||||
vec3 specular_light = specular_strength * spec * LIGHT_COLOR;
|
||||
|
||||
//Diffuse lighting
|
||||
vec3 albedo_color = ALBEDO * n_dot_l;
|
||||
albedo_color = albedo_color * mix(1.0, texture(occlusion, uv_coords).r, occlusion_strength);
|
||||
|
||||
DIFFUSE_LIGHT += albedo_color * ATTENUATION * LIGHT_COLOR;
|
||||
SPECULAR_LIGHT = specular_light * texture(specular, uv_coords).r;
|
||||
}
|
11
addons/decals/SetStartTimeOnDecal.gd
Normal file
11
addons/decals/SetStartTimeOnDecal.gd
Normal file
@ -0,0 +1,11 @@
|
||||
tool
|
||||
extends MeshInstance
|
||||
|
||||
# use this script on one shot flipbook animations
|
||||
|
||||
func _ready():
|
||||
var cur_time = OS.get_ticks_msec() / 1000.0
|
||||
var mat = get_surface_material(0).duplicate(true)
|
||||
set_surface_material(0, mat)
|
||||
mat.set_shader_param("start_time", cur_time)
|
||||
|
BIN
addons/decals/alpha_mask.png
Normal file
BIN
addons/decals/alpha_mask.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 803 B |
36
addons/decals/alpha_mask.png.import
Normal file
36
addons/decals/alpha_mask.png.import
Normal file
@ -0,0 +1,36 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path.s3tc="res://.import/alpha_mask.png-3fcfa26237929d23fdc23fc22cfd7635.s3tc.stex"
|
||||
path.etc2="res://.import/alpha_mask.png-3fcfa26237929d23fdc23fc22cfd7635.etc2.stex"
|
||||
metadata={
|
||||
"imported_formats": [ "s3tc", "etc2" ],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/decals/alpha_mask.png"
|
||||
dest_files=[ "res://.import/alpha_mask.png-3fcfa26237929d23fdc23fc22cfd7635.s3tc.stex", "res://.import/alpha_mask.png-3fcfa26237929d23fdc23fc22cfd7635.etc2.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=2
|
||||
flags/repeat=true
|
||||
flags/filter=true
|
||||
flags/mipmaps=true
|
||||
flags/anisotropic=false
|
||||
flags/srgb=1
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=true
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=false
|
||||
svg/scale=1.0
|
BIN
addons/decals/decal_projector_mesh.mtl
(Stored with Git LFS)
Normal file
BIN
addons/decals/decal_projector_mesh.mtl
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -2,33 +2,35 @@
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/EFX_shockwave.tga-a7671ba0f9d94194ac1ff168775a8823.stex"
|
||||
path.s3tc="res://.import/EFX_shockwave.tga-a7671ba0f9d94194ac1ff168775a8823.s3tc.stex"
|
||||
path.etc2="res://.import/EFX_shockwave.tga-a7671ba0f9d94194ac1ff168775a8823.etc2.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
"imported_formats": [ "s3tc", "etc2" ],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/all_gbs/textures/EFX_shockwave.tga"
|
||||
dest_files=[ "res://.import/EFX_shockwave.tga-a7671ba0f9d94194ac1ff168775a8823.stex" ]
|
||||
dest_files=[ "res://.import/EFX_shockwave.tga-a7671ba0f9d94194ac1ff168775a8823.s3tc.stex", "res://.import/EFX_shockwave.tga-a7671ba0f9d94194ac1ff168775a8823.etc2.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/mode=2
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/repeat=true
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/mipmaps=true
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
flags/srgb=1
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
detect_3d=false
|
||||
svg/scale=1.0
|
||||
|
@ -1,7 +1,7 @@
|
||||
[gd_resource type="AudioBusLayout" format=2]
|
||||
|
||||
[resource]
|
||||
bus/0/volume_db = 1.45601
|
||||
bus/0/volume_db = -80.0
|
||||
bus/1/name = "Music"
|
||||
bus/1/solo = false
|
||||
bus/1/mute = false
|
||||
|
28
effects/explosion_decal.tscn
Normal file
28
effects/explosion_decal.tscn
Normal file
@ -0,0 +1,28 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://assets/all_gbs/textures/blastmark_1.tga" type="Texture" id=1]
|
||||
[ext_resource path="res://addons/decals/Decal.shader" type="Shader" id=2]
|
||||
|
||||
[sub_resource type="CubeMesh" id=1]
|
||||
size = Vector3( 1, 1, 1 )
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=2]
|
||||
shader = ExtResource( 2 )
|
||||
shader_param/albedo_tint = Color( 1, 1, 1, 1 )
|
||||
shader_param/emission_tint = Color( 0, 0, 0, 1 )
|
||||
shader_param/emission_strength = 1.0
|
||||
shader_param/occlusion_strength = 1.0
|
||||
shader_param/specular_strength = 1.0
|
||||
shader_param/metallic_strength = 1.0
|
||||
shader_param/animation_speed = 1.0
|
||||
shader_param/flipbook_columns_count = 1
|
||||
shader_param/one_shot = false
|
||||
shader_param/start_time = null
|
||||
shader_param/current_frame_blend = 0.0
|
||||
shader_param/use_normal_map = false
|
||||
shader_param/albedo = ExtResource( 1 )
|
||||
|
||||
[node name="Decal" type="MeshInstance"]
|
||||
transform = Transform( 20, 0, 0, 0, 1, 0, 0, 0, 20, 1345, 30, 654 )
|
||||
mesh = SubResource( 1 )
|
||||
material/0 = SubResource( 2 )
|
40
effects/fx_prox_explosion.tscn
Normal file
40
effects/fx_prox_explosion.tscn
Normal file
@ -0,0 +1,40 @@
|
||||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://assets/all_gbs/textures/b_spark.tx_lev1.gzp.tga" type="Texture" id=1]
|
||||
|
||||
[sub_resource type="Gradient" id=1]
|
||||
offsets = PoolRealArray( 0, 0.00649351, 0.285714, 0.538961, 1 )
|
||||
colors = PoolColorArray( 0, 0, 0, 0, 1, 0.0078125, 0.0078125, 1, 0.682353, 0.47451, 0.552941, 0, 0.992157, 0.348805, 0, 1, 1, 0.603922, 0.603922, 0 )
|
||||
|
||||
[sub_resource type="GradientTexture" id=2]
|
||||
gradient = SubResource( 1 )
|
||||
|
||||
[sub_resource type="Curve" id=3]
|
||||
_data = [ Vector2( 0, 0 ), 0.0, 1.0, 0, 1, Vector2( 1, 1 ), 1.0, 0.0, 1, 0 ]
|
||||
|
||||
[sub_resource type="CurveTexture" id=4]
|
||||
curve = SubResource( 3 )
|
||||
|
||||
[sub_resource type="ParticlesMaterial" id=5]
|
||||
gravity = Vector3( 0, 0, 0 )
|
||||
scale = 150.0
|
||||
scale_curve = SubResource( 4 )
|
||||
color_ramp = SubResource( 2 )
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=6]
|
||||
flags_transparent = true
|
||||
flags_unshaded = true
|
||||
vertex_color_use_as_albedo = true
|
||||
albedo_texture = ExtResource( 1 )
|
||||
uv1_scale = Vector3( 4, 1, 1 )
|
||||
|
||||
[sub_resource type="SphereMesh" id=7]
|
||||
material = SubResource( 6 )
|
||||
|
||||
[node name="Spatial" type="Particles"]
|
||||
emitting = false
|
||||
amount = 1
|
||||
lifetime = 1.5
|
||||
one_shot = true
|
||||
process_material = SubResource( 5 )
|
||||
draw_pass_1 = SubResource( 7 )
|
@ -1,11 +1,17 @@
|
||||
extends Entity
|
||||
class_name GenericProjectile
|
||||
|
||||
export var BULLET_SPEED: float = 1
|
||||
export var BULLET_DAMAGE: float = 15
|
||||
export var bullet_speed: float = 1
|
||||
export var bullet_damage: float = 15
|
||||
|
||||
export var LIFETIME: float = 0
|
||||
var _timer = 0
|
||||
export var lifetime: float = 0
|
||||
export var fx_explode: PackedScene
|
||||
var current_fx_explode: Particles
|
||||
|
||||
export var proximity_collision_area_path: NodePath
|
||||
onready var proximity_collision_area: Area = get_node(proximity_collision_area_path)
|
||||
|
||||
var lifetime_timer = 0
|
||||
|
||||
func _init():
|
||||
gravity_scale = 0
|
||||
@ -35,9 +41,9 @@ var to: Vector3 = Vector3.ZERO
|
||||
export(int, FLAGS) var properties
|
||||
|
||||
func _physics_process(delta):
|
||||
if LIFETIME != 0:
|
||||
_timer += delta
|
||||
if _timer >= LIFETIME:
|
||||
if lifetime != 0:
|
||||
lifetime_timer += delta
|
||||
if lifetime_timer >= lifetime:
|
||||
queue_free()
|
||||
|
||||
func create(_from: Transform, _to: Vector3, exclude_collisions: Array):
|
||||
@ -47,4 +53,38 @@ func create(_from: Transform, _to: Vector3, exclude_collisions: Array):
|
||||
|
||||
for object in exclude_collisions:
|
||||
add_collision_exception_with(object)
|
||||
add_central_force((to - from.origin).normalized() * BULLET_SPEED)
|
||||
add_central_force((to - from.origin).normalized() * bullet_speed)
|
||||
|
||||
func body_entered(body: Node):
|
||||
if properties & WeaponProperties.TRIGGER_GROUND and body.is_in_group("world"):
|
||||
trigger(body)
|
||||
if properties & WeaponProperties.TRIGGER_OBJECT and body.is_in_group("objects"):
|
||||
trigger(body)
|
||||
|
||||
func proximity_body_entered(body: Node):
|
||||
if properties & WeaponProperties.TRIGGER_OBJECT:
|
||||
if body.is_in_group("objects"):
|
||||
trigger(body)
|
||||
|
||||
func trigger(body: Node):
|
||||
if fx_explode:
|
||||
var fx: Particles = fx_explode.instance()
|
||||
fx.global_transform = global_transform
|
||||
fx.emitting = true
|
||||
get_parent().add_child(fx)
|
||||
current_fx_explode = fx
|
||||
visible = false # needed because _process must still destroy the fx
|
||||
else:
|
||||
queue_free()
|
||||
if properties & WeaponProperties.EXPLODE:
|
||||
# create decal
|
||||
var decal: MeshInstance = preload("res://effects/explosion_decal.tscn").instance()
|
||||
decal.global_transform = global_transform
|
||||
decal.scale = Vector3(20, 2, 20)
|
||||
get_parent().add_child(decal)
|
||||
print("Created decal")
|
||||
|
||||
func _process(delta):
|
||||
if current_fx_explode and not current_fx_explode.emitting:
|
||||
current_fx_explode.queue_free()
|
||||
queue_free()
|
||||
|
@ -55,8 +55,8 @@ material = SubResource( 9 )
|
||||
[node name="Projectile" type="RigidBody"]
|
||||
gravity_scale = 0.0
|
||||
script = ExtResource( 1 )
|
||||
BULLET_SPEED = 10000.0
|
||||
LIFETIME = 2.0
|
||||
bullet_speed = 1000.0
|
||||
lifetime = 2.0
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="."]
|
||||
transform = Transform( 0.05, 0, 0, 0, 0.05, 0, 0, 0, 1, 0.000276685, 0, -0.00347565 )
|
||||
|
@ -1,27 +1,32 @@
|
||||
[gd_scene load_steps=8 format=2]
|
||||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://assets/all_gbs/mc_rocket_proximity.gbs.obj" type="ArrayMesh" id=1]
|
||||
[ext_resource path="res://entities/genericprojectile.gd" type="Script" id=2]
|
||||
[ext_resource path="res://addons/Trail/trail_3d.gd" type="Script" id=3]
|
||||
[ext_resource path="res://effects/fx_prox_explosion.tscn" type="PackedScene" id=4]
|
||||
|
||||
[sub_resource type="Curve" id=2]
|
||||
_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ]
|
||||
|
||||
[sub_resource type="Gradient" id=3]
|
||||
offsets = PoolRealArray( 0.032967, 1 )
|
||||
colors = PoolColorArray( 0.5, 0, 1, 1, 1, 1, 1, 1 )
|
||||
|
||||
[sub_resource type="CapsuleShape" id=4]
|
||||
height = 6.21251
|
||||
|
||||
[sub_resource type="CapsuleShape" id=1]
|
||||
radius = 9.20595
|
||||
height = 6.01707
|
||||
|
||||
[sub_resource type="ParticlesMaterial" id=2]
|
||||
|
||||
[sub_resource type="Curve" id=3]
|
||||
_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ]
|
||||
|
||||
[sub_resource type="Gradient" id=4]
|
||||
offsets = PoolRealArray( 0.032967, 1 )
|
||||
colors = PoolColorArray( 0.5, 0, 1, 1, 1, 1, 1, 1 )
|
||||
|
||||
[node name="Projectile" type="RigidBody"]
|
||||
gravity_scale = 0.0
|
||||
script = ExtResource( 2 )
|
||||
BULLET_SPEED = 10000.0
|
||||
LIFETIME = 2.0
|
||||
bullet_speed = 5000.0
|
||||
lifetime = 2.0
|
||||
fx_explode = ExtResource( 4 )
|
||||
proximity_collision_area_path = NodePath("Area")
|
||||
properties = 956
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0 )
|
||||
@ -29,15 +34,18 @@ mesh = ExtResource( 1 )
|
||||
material/0 = null
|
||||
material/1 = null
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="."]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Particles" type="Particles" parent="."]
|
||||
visible = false
|
||||
process_material = SubResource( 2 )
|
||||
|
||||
[node name="Trail3D" type="ImmediateGeometry" parent="."]
|
||||
script = ExtResource( 3 )
|
||||
base_width = 10.0
|
||||
width_profile = SubResource( 3 )
|
||||
color_gradient = SubResource( 4 )
|
||||
width_profile = SubResource( 2 )
|
||||
color_gradient = SubResource( 3 )
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="."]
|
||||
shape = SubResource( 4 )
|
||||
|
||||
[node name="Area" type="Area" parent="."]
|
||||
|
||||
[node name="Proximity" type="CollisionShape" parent="Area"]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[connection signal="body_entered" from="Area" to="." method="proximity_body_entered"]
|
||||
|
@ -86,8 +86,8 @@ colors = PoolColorArray( 0, 1, 0.460938, 1, 0.0375366, 0.636304, 0.960938, 1, 0.
|
||||
[node name="Projectile" type="RigidBody"]
|
||||
gravity_scale = 0.0
|
||||
script = ExtResource( 1 )
|
||||
BULLET_SPEED = 1000.0
|
||||
LIFETIME = 5.0
|
||||
bullet_speed = 1000.0
|
||||
lifetime = 2.0
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="."]
|
||||
transform = Transform( 1.91069e-15, 4.37114e-08, -1, 1, -4.37114e-08, 0, -4.37114e-08, -1, -4.37114e-08, 0, 0, 0 )
|
||||
|
@ -91,6 +91,8 @@ func _ready():
|
||||
mesh_instance.scale = obj_scale
|
||||
|
||||
mesh_instance.create_trimesh_collision()
|
||||
# mesh_instance.get_node("StaticBody").add_to_group("objects")
|
||||
# mesh_instance.add_to_group("objects")
|
||||
|
||||
if "audio" in ids[_id]:
|
||||
var audio_raw = ids[_id]["audio"] + ".wav"
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=110 format=2]
|
||||
[gd_scene load_steps=108 format=2]
|
||||
|
||||
[ext_resource path="res://assets/M_3WL1_env.tres" type="Environment" id=1]
|
||||
[ext_resource path="res://assets/all_gbs/Giants_logo_3D.gbs.obj" type="ArrayMesh" id=2]
|
||||
@ -11,9 +11,7 @@
|
||||
[ext_resource path="res://player/TPSController.tscn" type="PackedScene" id=9]
|
||||
[ext_resource path="res://assets/all_gbs/textures/M_3w_L2_ground.tga" type="Texture" id=10]
|
||||
[ext_resource path="res://assets/all_gbs/textures/M_3w_L2_wall.tga" type="Texture" id=11]
|
||||
[ext_resource path="res://assets/audio/Stream/Ambient/AM_DSAN7.wav" type="AudioStream" id=12]
|
||||
[ext_resource path="res://characters/vimp.tscn" type="PackedScene" id=13]
|
||||
[ext_resource path="res://assets/audio/Sounds/AM_MS1Q.xx_sm_evil.gzp.wav" type="AudioStream" id=14]
|
||||
[ext_resource path="res://scenes/realistic_water.tscn" type="PackedScene" id=16]
|
||||
|
||||
[sub_resource type="ConvexPolygonShape" id=1]
|
||||
@ -622,25 +620,16 @@ cast_shadow = 0
|
||||
mesh = ExtResource( 5 )
|
||||
material/0 = SubResource( 93 )
|
||||
|
||||
[node name="StaticBody" type="StaticBody" parent="MeshInstance"]
|
||||
[node name="StaticBody" type="StaticBody" parent="MeshInstance" groups=[
|
||||
"world",
|
||||
]]
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="MeshInstance/StaticBody"]
|
||||
shape = SubResource( 94 )
|
||||
|
||||
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 415.13, 16.8944, 0.0514412 )
|
||||
visible = false
|
||||
stream = ExtResource( 12 )
|
||||
unit_size = 100.0
|
||||
autoplay = true
|
||||
|
||||
[node name="PlayerController" parent="." instance=ExtResource( 9 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1469.2, 232.516, 687.363 )
|
||||
character_scene = ExtResource( 4 )
|
||||
|
||||
[node name="Vimp" parent="." instance=ExtResource( 13 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1264, 26, 505 )
|
||||
|
||||
[node name="AudioStreamPlayer3D2" type="AudioStreamPlayer3D" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1475, 88, 629 )
|
||||
stream = ExtResource( 14 )
|
||||
|
@ -12,8 +12,8 @@ script = ExtResource( 2 )
|
||||
projectile = ExtResource( 3 )
|
||||
fire_sound = ExtResource( 4 )
|
||||
switch_sound = ExtResource( 5 )
|
||||
max_ammo = 25
|
||||
current_ammo = 25
|
||||
max_ammo = 100
|
||||
current_ammo = 100
|
||||
weapon_icon = ExtResource( 6 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="."]
|
||||
|
Loading…
Reference in New Issue
Block a user