Moves stuff around, made a main menu and scene mgr
This commit is contained in:
parent
b2e3a3957b
commit
6c023a60a6
37 changed files with 888 additions and 214 deletions
|
|
@ -1,90 +1,13 @@
|
|||
shader_type spatial;
|
||||
render_mode unshaded;
|
||||
render_mode cull_front, unshaded;
|
||||
|
||||
uniform sampler2D screen_texture : source_color, hint_screen_texture, filter_nearest;
|
||||
uniform sampler2D depth_texture : source_color, hint_depth_texture, filter_nearest;
|
||||
uniform sampler2D normal_texture : source_color, hint_normal_roughness_texture, filter_nearest;
|
||||
|
||||
uniform float depth_threshold : hint_range(0, 1) = 0.05;
|
||||
uniform float reverse_depth_threshold : hint_range(0, 1) = 0.25;
|
||||
uniform float normal_threshold : hint_range(0, 1) = 0.6;
|
||||
|
||||
uniform float darken_amount : hint_range(0, 1, 0.01) = 0.3;
|
||||
uniform float lighten_amount : hint_range(0, 10, 0.01) = 1.5;
|
||||
|
||||
uniform vec3 normal_edge_bias = vec3(1, 1, 1);
|
||||
global uniform vec3 light_direction;
|
||||
|
||||
float get_depth(vec2 screen_uv, mat4 inv_projection_matrix) {
|
||||
float depth = texture(depth_texture, screen_uv).r;
|
||||
vec3 ndc = vec3(screen_uv * 2.0 - 1.0, depth);
|
||||
vec4 view = inv_projection_matrix * vec4(ndc, 1.0);
|
||||
view.xyz /= view.w;
|
||||
return -view.z;
|
||||
}
|
||||
uniform vec3 color : source_color = vec3(0,0,0);
|
||||
uniform float thickness : hint_range(0.0, 1.0, 0.01) = 0.01;
|
||||
|
||||
void vertex() {
|
||||
POSITION = vec4(VERTEX.xy, 1.0, 1.0);
|
||||
VERTEX += thickness*NORMAL;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
float depth = get_depth(SCREEN_UV, INV_PROJECTION_MATRIX);
|
||||
vec3 normal = texture(normal_texture, SCREEN_UV).xyz * 2.0 - 1.0;
|
||||
vec2 texel_size = 1.0 / VIEWPORT_SIZE.xy;
|
||||
|
||||
vec2 uvs[4];
|
||||
uvs[0] = vec2(SCREEN_UV.x, min(1.0 - 0.001, SCREEN_UV.y + texel_size.y));
|
||||
uvs[1] = vec2(SCREEN_UV.x, max(0.0, SCREEN_UV.y - texel_size.y));
|
||||
uvs[2] = vec2(min(1.0 - 0.001, SCREEN_UV.x + texel_size.x), SCREEN_UV.y);
|
||||
uvs[3] = vec2(max(0.0, SCREEN_UV.x - texel_size.x), SCREEN_UV.y);
|
||||
|
||||
float depth_diff = 0.0;
|
||||
float depth_diff_reversed = 0.0;
|
||||
float nearest_depth = depth;
|
||||
vec2 nearest_uv = SCREEN_UV;
|
||||
|
||||
float normal_sum = 0.0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
float d = get_depth(uvs[i], INV_PROJECTION_MATRIX);
|
||||
depth_diff += depth - d;
|
||||
depth_diff_reversed += d - depth;
|
||||
|
||||
if (d < nearest_depth) {
|
||||
nearest_depth = d;
|
||||
nearest_uv = uvs[i];
|
||||
}
|
||||
|
||||
vec3 n = texture(normal_texture, uvs[i]).xyz * 2.0 - 1.0;
|
||||
vec3 normal_diff = normal - n;
|
||||
|
||||
// Edge pixels should yield to the normal closest to the bias direction
|
||||
float normal_bias_diff = dot(normal_diff, normal_edge_bias);
|
||||
float normal_indicator = smoothstep(-0.01, 0.01, normal_bias_diff);
|
||||
|
||||
normal_sum += dot(normal_diff, normal_diff) * normal_indicator;
|
||||
}
|
||||
float depth_edge = step(depth_threshold, depth_diff);
|
||||
|
||||
// The reverse depth sum produces depth lines inside of the object, but they don't look as nice as the normal depth_diff
|
||||
// Instead, we can use this value to mask the normal edge along the outside of the object
|
||||
float reverse_depth_edge = step(reverse_depth_threshold, depth_diff_reversed);
|
||||
|
||||
float indicator = sqrt(normal_sum);
|
||||
float normal_edge = step(normal_threshold, indicator - reverse_depth_edge);
|
||||
|
||||
vec3 original = texture(screen_texture, SCREEN_UV).rgb;
|
||||
vec3 nearest = texture(screen_texture, nearest_uv).rgb;
|
||||
|
||||
mat3 view_to_world_normal_mat = mat3(
|
||||
INV_VIEW_MATRIX[0].xyz,
|
||||
INV_VIEW_MATRIX[1].xyz,
|
||||
INV_VIEW_MATRIX[2].xyz
|
||||
);
|
||||
float ld = dot((view_to_world_normal_mat * normal), normalize(light_direction));
|
||||
|
||||
vec3 depth_col = nearest * darken_amount;
|
||||
vec3 normal_col = original * (ld > 0.0 ? darken_amount : lighten_amount);
|
||||
vec3 edge_mix = mix(normal_col, depth_col, depth_edge);
|
||||
|
||||
ALBEDO = mix(original, edge_mix, (depth_edge > 0.0 ? depth_edge : normal_edge));
|
||||
ALBEDO = color;
|
||||
}
|
||||
|
|
@ -1 +1 @@
|
|||
uid://bsemnmdracd4m
|
||||
uid://c67ldhbce6ro7
|
||||
|
|
|
|||
90
Common/shaders/pixel_outline.gdshader
Normal file
90
Common/shaders/pixel_outline.gdshader
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
shader_type spatial;
|
||||
render_mode unshaded;
|
||||
|
||||
uniform sampler2D screen_texture : source_color, hint_screen_texture, filter_nearest;
|
||||
uniform sampler2D depth_texture : source_color, hint_depth_texture, filter_nearest;
|
||||
uniform sampler2D normal_texture : source_color, hint_normal_roughness_texture, filter_nearest;
|
||||
|
||||
uniform float depth_threshold : hint_range(0, 1) = 0.05;
|
||||
uniform float reverse_depth_threshold : hint_range(0, 1) = 0.25;
|
||||
uniform float normal_threshold : hint_range(0, 1) = 0.6;
|
||||
|
||||
uniform float darken_amount : hint_range(0, 1, 0.01) = 0.3;
|
||||
uniform float lighten_amount : hint_range(0, 10, 0.01) = 1.5;
|
||||
|
||||
uniform vec3 normal_edge_bias = vec3(1, 1, 1);
|
||||
global uniform vec3 light_direction;
|
||||
|
||||
float get_depth(vec2 screen_uv, mat4 inv_projection_matrix) {
|
||||
float depth = texture(depth_texture, screen_uv).r;
|
||||
vec3 ndc = vec3(screen_uv * 2.0 - 1.0, depth);
|
||||
vec4 view = inv_projection_matrix * vec4(ndc, 1.0);
|
||||
view.xyz /= view.w;
|
||||
return -view.z;
|
||||
}
|
||||
|
||||
void vertex() {
|
||||
POSITION = vec4(VERTEX.xy, 1.0, 1.0);
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
float depth = get_depth(SCREEN_UV, INV_PROJECTION_MATRIX);
|
||||
vec3 normal = texture(normal_texture, SCREEN_UV).xyz * 2.0 - 1.0;
|
||||
vec2 texel_size = 1.0 / VIEWPORT_SIZE.xy;
|
||||
|
||||
vec2 uvs[4];
|
||||
uvs[0] = vec2(SCREEN_UV.x, min(1.0 - 0.001, SCREEN_UV.y + texel_size.y));
|
||||
uvs[1] = vec2(SCREEN_UV.x, max(0.0, SCREEN_UV.y - texel_size.y));
|
||||
uvs[2] = vec2(min(1.0 - 0.001, SCREEN_UV.x + texel_size.x), SCREEN_UV.y);
|
||||
uvs[3] = vec2(max(0.0, SCREEN_UV.x - texel_size.x), SCREEN_UV.y);
|
||||
|
||||
float depth_diff = 0.0;
|
||||
float depth_diff_reversed = 0.0;
|
||||
float nearest_depth = depth;
|
||||
vec2 nearest_uv = SCREEN_UV;
|
||||
|
||||
float normal_sum = 0.0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
float d = get_depth(uvs[i], INV_PROJECTION_MATRIX);
|
||||
depth_diff += depth - d;
|
||||
depth_diff_reversed += d - depth;
|
||||
|
||||
if (d < nearest_depth) {
|
||||
nearest_depth = d;
|
||||
nearest_uv = uvs[i];
|
||||
}
|
||||
|
||||
vec3 n = texture(normal_texture, uvs[i]).xyz * 2.0 - 1.0;
|
||||
vec3 normal_diff = normal - n;
|
||||
|
||||
// Edge pixels should yield to the normal closest to the bias direction
|
||||
float normal_bias_diff = dot(normal_diff, normal_edge_bias);
|
||||
float normal_indicator = smoothstep(-0.01, 0.01, normal_bias_diff);
|
||||
|
||||
normal_sum += dot(normal_diff, normal_diff) * normal_indicator;
|
||||
}
|
||||
float depth_edge = step(depth_threshold, depth_diff);
|
||||
|
||||
// The reverse depth sum produces depth lines inside of the object, but they don't look as nice as the normal depth_diff
|
||||
// Instead, we can use this value to mask the normal edge along the outside of the object
|
||||
float reverse_depth_edge = step(reverse_depth_threshold, depth_diff_reversed);
|
||||
|
||||
float indicator = sqrt(normal_sum);
|
||||
float normal_edge = step(normal_threshold, indicator - reverse_depth_edge);
|
||||
|
||||
vec3 original = texture(screen_texture, SCREEN_UV).rgb;
|
||||
vec3 nearest = texture(screen_texture, nearest_uv).rgb;
|
||||
|
||||
mat3 view_to_world_normal_mat = mat3(
|
||||
INV_VIEW_MATRIX[0].xyz,
|
||||
INV_VIEW_MATRIX[1].xyz,
|
||||
INV_VIEW_MATRIX[2].xyz
|
||||
);
|
||||
float ld = dot((view_to_world_normal_mat * normal), normalize(light_direction));
|
||||
|
||||
vec3 depth_col = nearest * darken_amount;
|
||||
vec3 normal_col = original * (ld > 0.0 ? darken_amount : lighten_amount);
|
||||
vec3 edge_mix = mix(normal_col, depth_col, depth_edge);
|
||||
|
||||
ALBEDO = mix(original, edge_mix, (depth_edge > 0.0 ? depth_edge : normal_edge));
|
||||
}
|
||||
1
Common/shaders/pixel_outline.gdshader.uid
Normal file
1
Common/shaders/pixel_outline.gdshader.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bsemnmdracd4m
|
||||
BIN
Entities/Grass/assets/grass.res
Normal file
BIN
Entities/Grass/assets/grass.res
Normal file
Binary file not shown.
|
|
@ -1,7 +1,6 @@
|
|||
[gd_scene load_steps=17 format=3 uid="uid://bwcevwwphdvq"]
|
||||
[gd_scene load_steps=16 format=3 uid="uid://bwcevwwphdvq"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bq7hia2dit80y" path="res://Entities/GroundTile/scripts/ground_tile.gd" id="1_uwxqs"]
|
||||
[ext_resource type="ArrayMesh" uid="uid://duj6747nq4qsk" path="res://Stages/Test3D/assets/stylizedGrassMeshes/grass.res" id="3_8mhad"]
|
||||
[ext_resource type="Script" uid="uid://cacp8ncwuofuj" path="res://Entities/GroundTile/scripts/grass.gd" id="3_224hx"]
|
||||
[ext_resource type="Material" uid="uid://b1miqvl8lus75" path="res://Stages/Test3D/GrassMaterialOverride.tres" id="3_f37ob"]
|
||||
[ext_resource type="Script" uid="uid://btju6b83mvgvk" path="res://Entities/GroundTile/scripts/grass_multimesh.gd" id="4_3wpcb"]
|
||||
|
|
@ -24,7 +23,6 @@ size = Vector3(2, 2, 2)
|
|||
|
||||
[sub_resource type="MultiMesh" id="MultiMesh_3wpcb"]
|
||||
transform_format = 1
|
||||
mesh = ExtResource("3_8mhad")
|
||||
|
||||
[sub_resource type="PlaneMesh" id="PlaneMesh_f37ob"]
|
||||
flip_faces = true
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ func _ready() -> void:
|
|||
|
||||
# Load mesh once and reuse
|
||||
if grass_mesh == null:
|
||||
grass_mesh = load("res://Stages/Test3D/assets/stylizedGrassMeshes/grass2_mesh.res")
|
||||
grass_mesh = load("res://Entities/Grass/assets/grass2_mesh.res")
|
||||
|
||||
func setup_multimesh() -> void:
|
||||
if parent_node == null:
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ func apply_tree_properties():
|
|||
func setup_outline_material() -> void:
|
||||
# Create outline material with your shader
|
||||
outline_material = ShaderMaterial.new()
|
||||
outline_material.shader = preload("res://outline.gdshader")
|
||||
outline_material.shader = preload("res://Common/shaders/outline.gdshader")
|
||||
outline_material.set_shader_parameter("color", Vector3(0.702, 0.557, 0.259))
|
||||
|
||||
func find_all_mesh_instances(node: Node):
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ func populate_bush_materials() -> void:
|
|||
func create_bush_material(color: Color, variation: Color, material_name: String) -> ShaderMaterial:
|
||||
var material = ShaderMaterial.new()
|
||||
|
||||
var shader = load("res://leaves.gdshader")
|
||||
var shader = load("res://Common/shaders/leaves.gdshader")
|
||||
|
||||
material.shader = shader
|
||||
material.resource_name = material_name
|
||||
|
|
|
|||
2
Utilities/GameManager/GameManager.gd
Normal file
2
Utilities/GameManager/GameManager.gd
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
class_name GameManagerClass
|
||||
extends Node
|
||||
1
Utilities/GameManager/GameManager.gd.uid
Normal file
1
Utilities/GameManager/GameManager.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cbpayrc0ep538
|
||||
|
|
@ -124,48 +124,12 @@ func generate_map():
|
|||
func generate_camp():
|
||||
print("Generating camp...")
|
||||
|
||||
var attempts = 0
|
||||
var placed = false
|
||||
var camp_x = (map_width - camp_size) / 2
|
||||
var camp_y = (map_height - camp_size) / 2
|
||||
|
||||
while attempts < camp_placement_attempts and not placed:
|
||||
# Random position with margin to ensure camp fits within map bounds
|
||||
var margin = camp_size + camp_buffer_zone
|
||||
var camp_x = randi_range(margin, map_width - margin - camp_size)
|
||||
var camp_y = randi_range(margin, map_height - margin - camp_size)
|
||||
place_camp(camp_x, camp_y)
|
||||
print("Camp placed at (", camp_x, ",", camp_y, ") with size ", camp_size, "x", camp_size)
|
||||
|
||||
# Check if this location is valid for camp placement
|
||||
if is_valid_camp_location(camp_x, camp_y):
|
||||
place_camp(camp_x, camp_y)
|
||||
placed = true
|
||||
print("Camp placed at (", camp_x, ",", camp_y, ") with size ", camp_size, "x", camp_size)
|
||||
|
||||
attempts += 1
|
||||
|
||||
if not placed:
|
||||
print("Could not place camp after ", camp_placement_attempts, " attempts")
|
||||
# Fallback: place camp in the center of the map
|
||||
var fallback_x = (map_width - camp_size) / 2
|
||||
var fallback_y = (map_height - camp_size) / 2
|
||||
place_camp(fallback_x, fallback_y)
|
||||
print("Camp placed at fallback location (", fallback_x, ",", fallback_y, ")")
|
||||
|
||||
func is_valid_camp_location(camp_x: int, camp_y: int) -> bool:
|
||||
# Check if the camp area and buffer zone are clear
|
||||
var check_size = camp_size + (camp_buffer_zone * 2)
|
||||
var start_x = camp_x - camp_buffer_zone
|
||||
var start_y = camp_y - camp_buffer_zone
|
||||
|
||||
for y in range(start_y, start_y + check_size):
|
||||
for x in range(start_x, start_x + check_size):
|
||||
if x >= 0 and x < map_width and y >= 0 and y < map_height:
|
||||
# For now, just check if we're within map bounds
|
||||
# Later we'll prevent paths and water from being placed here
|
||||
continue
|
||||
else:
|
||||
# Outside map bounds
|
||||
return false
|
||||
|
||||
return true
|
||||
|
||||
func place_camp(camp_x: int, camp_y: int):
|
||||
# Store camp position
|
||||
|
|
|
|||
8
Utilities/SceneManager/SceneManager.gd
Normal file
8
Utilities/SceneManager/SceneManager.gd
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
class_name SceneManagerClass
|
||||
extends Node
|
||||
|
||||
signal change_scene(scene_name: String)
|
||||
|
||||
func load_scene(scene_name: String) -> void:
|
||||
Log.pr("Sending signal to change scene", scene_name)
|
||||
emit_signal("change_scene", scene_name)
|
||||
1
Utilities/SceneManager/SceneManager.gd.uid
Normal file
1
Utilities/SceneManager/SceneManager.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://c43gwdbpsxxeh
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
shader_type canvas_item;
|
||||
|
||||
uniform sampler2D gradient_fallof;
|
||||
|
||||
void light() {
|
||||
float calculated_light_value = max(0.0, dot(NORMAL, LIGHT_DIRECTION));
|
||||
float sample = clamp(calculated_light_value * LIGHT_ENERGY, 0.05, 0.95);
|
||||
vec4 shaded_texture = texture(gradient_fallof, vec2(sample, 0));
|
||||
LIGHT = vec4(LIGHT_COLOR.rgb * COLOR.rgb * shaded_texture.rgb, LIGHT_COLOR.a);
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://ce7q2m8ux2l0j
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
shader_type spatial;
|
||||
render_mode cull_front, unshaded;
|
||||
|
||||
uniform vec3 color : source_color = vec3(0,0,0);
|
||||
uniform float thickness : hint_range(0.0, 1.0, 0.01) = 0.01;
|
||||
|
||||
void vertex() {
|
||||
VERTEX += thickness*NORMAL;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
ALBEDO = color;
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://os2r7dm88ofb
|
||||
|
|
@ -17,6 +17,7 @@ config/icon="res://icon.svg"
|
|||
|
||||
[autoload]
|
||||
|
||||
SceneMgr="*res://Utilities/SceneManager/SceneManager.gd"
|
||||
Debug="*res://Utilities/Debug/DebugHelper.gd"
|
||||
Global="*res://Config/Globals.gd"
|
||||
DebugMenu="*res://addons/debug_menu/debug_menu.tscn"
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
shader_type spatial;
|
||||
|
||||
// Uniforms that can be controlled from GDScript
|
||||
uniform float model_height : hint_range(0.1, 100.0) = 10.0;
|
||||
uniform float transition_width : hint_range(0.01, 0.5) = 0.1;
|
||||
uniform vec4 base_color : source_color = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
uniform float effect_strength : hint_range(0.0, 1.0) = 1.0;
|
||||
uniform sampler2D main_texture : source_color;
|
||||
uniform float metallic : hint_range(0.0, 1.0) = 0.0;
|
||||
uniform float roughness : hint_range(0.0, 1.0) = 0.5;
|
||||
|
||||
varying vec3 world_position;
|
||||
|
||||
void vertex() {
|
||||
world_position = VERTEX;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
// Get the base texture color
|
||||
vec4 tex_color = texture(main_texture, UV);
|
||||
|
||||
// Calculate normalized Y position (0.0 at bottom, 1.0 at top)
|
||||
// This uses the local vertex position - adjust based on your model's bounds
|
||||
float normalized_y = (world_position.y + model_height * 0.5) / model_height;
|
||||
|
||||
// Define fade boundaries - top 80% invisible, bottom 20% visible
|
||||
float fade_start = 0.2; // Start fading at 20% from bottom
|
||||
float fade_end = fade_start - transition_width;
|
||||
|
||||
// Calculate position-based alpha
|
||||
float position_alpha = smoothstep(fade_end, fade_start, normalized_y);
|
||||
|
||||
// Blend between full visibility and position-based alpha based on effect strength
|
||||
float final_alpha = mix(1.0, position_alpha, effect_strength);
|
||||
|
||||
// Set material properties
|
||||
ALBEDO = base_color.rgb * tex_color.rgb;
|
||||
ALPHA = base_color.a * tex_color.a * final_alpha;
|
||||
METALLIC = metallic;
|
||||
ROUGHNESS = roughness;
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://djv8r207ldqn1
|
||||
609
stages/MainMenu/MainMenu.tscn
Normal file
609
stages/MainMenu/MainMenu.tscn
Normal file
File diff suppressed because one or more lines are too long
14
stages/SceneManager/SceneManager.tscn
Normal file
14
stages/SceneManager/SceneManager.tscn
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://cn41yepyhvwsd"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bqtnrs6cjoyj6" path="res://Stages/SceneManager/scripts/scene_manager.gd" id="1_scgkw"]
|
||||
[ext_resource type="PackedScene" uid="uid://bon4rtm4rv1rf" path="res://Stages/SceneManager/TransitionScene.tscn" id="2_fe7gw"]
|
||||
[ext_resource type="PackedScene" uid="uid://dkucysn167kp6" path="res://Stages/MainMenu/MainMenu.tscn" id="3_obg8q"]
|
||||
|
||||
[node name="SceneManager" type="Node3D"]
|
||||
script = ExtResource("1_scgkw")
|
||||
|
||||
[node name="CurrentScene" type="Node" parent="."]
|
||||
|
||||
[node name="MainMenu" parent="CurrentScene" instance=ExtResource("3_obg8q")]
|
||||
|
||||
[node name="TransitionScene" parent="." instance=ExtResource("2_fe7gw")]
|
||||
76
stages/SceneManager/TransitionScene.tscn
Normal file
76
stages/SceneManager/TransitionScene.tscn
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://bon4rtm4rv1rf"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cem1lps8uxlya" path="res://Stages/SceneManager/scripts/transition_scene.gd" id="1_pt42a"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_skyqd"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("ColorRect:color")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(0, 0, 0, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ehfi2"]
|
||||
resource_name = "fade_to_black"
|
||||
length = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("ColorRect:color")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(0, 0, 0, 0), Color(0, 0, 0, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_n8kpy"]
|
||||
resource_name = "fade_to_normal"
|
||||
length = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("ColorRect:color")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(0, 0, 0, 1), Color(0, 0, 0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_lyb8n"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_skyqd"),
|
||||
&"fade_to_black": SubResource("Animation_ehfi2"),
|
||||
&"fade_to_normal": SubResource("Animation_n8kpy")
|
||||
}
|
||||
|
||||
[node name="TransitionScene" type="CanvasLayer"]
|
||||
script = ExtResource("1_pt42a")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_lyb8n")
|
||||
}
|
||||
|
||||
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_animation_player_animation_finished"]
|
||||
32
stages/SceneManager/scripts/scene_manager.gd
Normal file
32
stages/SceneManager/scripts/scene_manager.gd
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
extends Node3D
|
||||
class_name SceneManager
|
||||
|
||||
const SCENES: Dictionary = {
|
||||
"MAINMENU": "res://Stages/MainMenu/MainMenu.tscn",
|
||||
"HIGHSCORES": "res://scenes/high_scores.tscn"
|
||||
}
|
||||
|
||||
var loading_scene_res: Resource = null
|
||||
|
||||
func _ready() -> void:
|
||||
## LOAD GAME DATA
|
||||
#HighScoreMgr.load()
|
||||
#HighScoreMgr.debug_output()
|
||||
# HighScoreMgr.debug_save_high_score()
|
||||
Log.pr("SceneManager is ready.")
|
||||
SceneMgr.connect("change_scene", Callable(self, "_on_change_scene"))
|
||||
$TransitionScene.connect("transitioned", Callable(self, "_on_transition_scene_transitioned"))
|
||||
|
||||
func _on_change_scene(scene_name: String) -> void:
|
||||
Log.pr("Going to load a scene.", scene_name)
|
||||
if SCENES.has(scene_name):
|
||||
#GameState.reset()
|
||||
loading_scene_res = load(SCENES[scene_name])
|
||||
Log.pr("Loading scene: ", loading_scene_res)
|
||||
$TransitionScene.transition()
|
||||
else:
|
||||
loading_scene_res = null
|
||||
|
||||
func _on_transition_scene_transitioned() -> void:
|
||||
$CurrentScene.get_child(0).queue_free()
|
||||
$CurrentScene.add_child(loading_scene_res.instantiate())
|
||||
1
stages/SceneManager/scripts/scene_manager.gd.uid
Normal file
1
stages/SceneManager/scripts/scene_manager.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bqtnrs6cjoyj6
|
||||
18
stages/SceneManager/scripts/transition_scene.gd
Normal file
18
stages/SceneManager/scripts/transition_scene.gd
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
extends CanvasLayer
|
||||
|
||||
signal transitioned
|
||||
|
||||
func _ready() -> void:
|
||||
$AnimationPlayer.play("fade_to_normal")
|
||||
|
||||
func transition() -> void:
|
||||
$AnimationPlayer.play("fade_to_black")
|
||||
Log.pr("Fading to black")
|
||||
|
||||
func _on_animation_player_animation_finished(anim_name: StringName) -> void:
|
||||
if anim_name == "fade_to_black":
|
||||
Log.pr("Sending transitioned signal...")
|
||||
emit_signal("transitioned")
|
||||
$AnimationPlayer.play("fade_to_normal")
|
||||
if anim_name == "fade_to_normal":
|
||||
Log.pr("Faded to normal")
|
||||
1
stages/SceneManager/scripts/transition_scene.gd.uid
Normal file
1
stages/SceneManager/scripts/transition_scene.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cem1lps8uxlya
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
[gd_resource type="ShaderMaterial" load_steps=4 format=3 uid="uid://b1miqvl8lus75"]
|
||||
|
||||
[ext_resource type="Shader" uid="uid://dbduq0qcaxmyi" path="res://grass.gdshader" id="1_vnnwo"]
|
||||
[ext_resource type="Shader" uid="uid://dbduq0qcaxmyi" path="res://Common/shaders/grass.gdshader" id="1_vnnwo"]
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_vnnwo"]
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
[ext_resource type="Texture2D" uid="uid://c6mugqvfn8ihk" path="res://addons/AllSkyFree/Skyboxes/AllSkyFree_Sky_ClearBlueSky_Equirect.png" id="1_fm6lr"]
|
||||
[ext_resource type="AnimationLibrary" uid="uid://bwnn7vpd0dqds" path="res://Common/animations/basic-movement.res" id="1_tfa5t"]
|
||||
[ext_resource type="Script" uid="uid://bbjv6a7yg7m02" path="res://Stages/Test3D/camera_pivot.gd" id="2_sdmks"]
|
||||
[ext_resource type="Shader" uid="uid://bsemnmdracd4m" path="res://Common/shaders/outline.gdshader" id="4_feu7y"]
|
||||
[ext_resource type="Shader" uid="uid://bsemnmdracd4m" path="res://Common/shaders/pixel_outline.gdshader" id="4_feu7y"]
|
||||
[ext_resource type="Script" uid="uid://cjbk6jnxla4mn" path="res://Stages/Test3D/camera_3d.gd" id="5_fm6lr"]
|
||||
[ext_resource type="PackedScene" uid="uid://isogcpkb8su4" path="res://Entities/Tree/assets/temp/tent_detailedOpen.glb" id="9_4jb6r"]
|
||||
[ext_resource type="Script" uid="uid://bjco8musjqog4" path="res://Stages/Test3D/particles.gd" id="9_oiyue"]
|
||||
|
|
@ -149,6 +149,13 @@ func _process(_delta):
|
|||
radius = 0.2
|
||||
height = 0.5
|
||||
|
||||
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_fm6lr"]
|
||||
dof_blur_far_enabled = true
|
||||
dof_blur_far_distance = 5.0
|
||||
dof_blur_far_transition = 10.0
|
||||
dof_blur_near_distance = 0.87
|
||||
dof_blur_amount = 0.08
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_hbd03"]
|
||||
resource_name = "shoes(Clone)mat"
|
||||
cull_mode = 2
|
||||
|
|
@ -475,13 +482,6 @@ material = SubResource("ShaderMaterial_tfa5t")
|
|||
flip_faces = true
|
||||
size = Vector2(2, 2)
|
||||
|
||||
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_fm6lr"]
|
||||
dof_blur_far_enabled = true
|
||||
dof_blur_far_distance = 5.0
|
||||
dof_blur_far_transition = 10.0
|
||||
dof_blur_near_distance = 0.87
|
||||
dof_blur_amount = 0.08
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_tfa5t"]
|
||||
size = Vector3(60, 0, 20)
|
||||
|
||||
|
|
@ -603,6 +603,14 @@ script = SubResource("GDScript_fm6lr")
|
|||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.257867, 0)
|
||||
shape = SubResource("CapsuleShape3D_tfa5t")
|
||||
|
||||
[node name="FirstPersonCamera" type="Camera3D" parent="SubViewportContainer/SubViewport/Player"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.359, -0.2)
|
||||
attributes = SubResource("CameraAttributesPractical_fm6lr")
|
||||
current = true
|
||||
fov = 35.0
|
||||
near = 0.103
|
||||
far = 125.41
|
||||
|
||||
[node name="Pivot" type="Node3D" parent="SubViewportContainer/SubViewport/Player"]
|
||||
|
||||
[node name="Character" type="Node3D" parent="SubViewportContainer/SubViewport/Player/Pivot"]
|
||||
|
|
@ -879,14 +887,6 @@ mesh = SubResource("QuadMesh_tfa5t")
|
|||
[node name="RayCast3D" type="RayCast3D" parent="SubViewportContainer/SubViewport/Player/CameraPivot/Camera3D"]
|
||||
collision_mask = 3
|
||||
|
||||
[node name="FirstPersonCamera" type="Camera3D" parent="SubViewportContainer/SubViewport/Player"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.359, -0.2)
|
||||
attributes = SubResource("CameraAttributesPractical_fm6lr")
|
||||
current = true
|
||||
fov = 35.0
|
||||
near = 0.103
|
||||
far = 125.41
|
||||
|
||||
[node name="Environment" type="Node3D" parent="SubViewportContainer/SubViewport"]
|
||||
|
||||
[node name="Ground" type="StaticBody3D" parent="SubViewportContainer/SubViewport/Environment"]
|
||||
|
|
@ -937,7 +937,7 @@ draw_pass_1 = SubResource("QuadMesh_hvb1l")
|
|||
[node name="OmniLight3D" type="OmniLight3D" parent="SubViewportContainer/SubViewport/Camp/Objects/Camp/Campfire/Fire"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.000509977, 0.121094, -0.00151992)
|
||||
light_color = Color(0.89, 0.461613, 0.2136, 1)
|
||||
light_energy = 0.816855
|
||||
light_energy = 0.921402
|
||||
light_indirect_energy = 1.084
|
||||
light_volumetric_fog_energy = 3.764
|
||||
light_size = 0.105
|
||||
|
|
@ -967,6 +967,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.727, -0.05, 0.611)
|
|||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.609, -0.05, 0.72)
|
||||
|
||||
[node name="VFX" type="Node3D" parent="SubViewportContainer/SubViewport/Camp"]
|
||||
visible = false
|
||||
|
||||
[node name="Rain" type="GPUParticles3D" parent="SubViewportContainer/SubViewport/Camp/VFX"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.545105, 10.1451, 0.937134)
|
||||
|
|
|
|||
Binary file not shown.
BIN
stages/Test3D/assets/stylizedGrassMeshes/grass2.res.depren
Normal file
BIN
stages/Test3D/assets/stylizedGrassMeshes/grass2.res.depren
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue