master
chendian 8 months ago
parent 1cecae382a
commit 29b456c805

@ -1,3 +1,3 @@
{
"godotTools.editorPath.godot4": "c:\\Users\\Administrator\\Desktop\\Godot_v4.4-beta1_win64.exe"
"godotTools.editorPath.godot4": "c:\\Users\\Administrator\\Desktop\\Godot_v4.4-beta4_win64.exe"
}

@ -87,7 +87,10 @@ func short_cut_index_pressed(index: int):
material_name = "null"
print("[", item_id, "]", mesh_library.get_item_name(item_id), "::", material_name)
elif short_cut_path == "func_fix_mesh":
var material: Material = ResourceLoader.load("res://render/material/level_grid_block.tres")
var material_grid_block: Material = load("res://render/material/level_grid_block.tres") as Material
var material_grid_water: Material = load("res://render/material/level_grid_water.tres") as Material
var material_grass: Material = load("res://render/material/level_grass.tres") as Material
var dir_path: String = "res://resource/mesh_library"
var dir: DirAccess = DirAccess.open(dir_path)
for file: String in dir.get_files():
@ -99,10 +102,16 @@ func short_cut_index_pressed(index: int):
var mesh_library: MeshLibrary = res as MeshLibrary
for item_id: int in mesh_library.get_item_list():
var mesh: Mesh = mesh_library.get_item_mesh(item_id)
var mesh_name: String = mesh_library.get_item_name(item_id)
var material_set: Material = material_grid_block
if mesh_name.contains("water"):
material_set = material_grid_water
if mesh_name.contains("grass"):
material_set = material_grass
for surface_id: int in range(mesh.get_surface_count()):
if not mesh.surface_get_material(surface_id) == material:
if not mesh.surface_get_material(surface_id) == material_set:
fix_count += 1
mesh.surface_set_material(surface_id, material)
mesh.surface_set_material(surface_id, material_set)
ResourceSaver.save(mesh, mesh.get_path())
ResourceSaver.save(res, path)
print("修复meshlib材质(", fix_count, "):", path)

@ -19,9 +19,9 @@ shader_parameter/wind_strength = 0.2
shader_parameter/wind_texture_tile_size = 20.0
shader_parameter/wind_vertical_strength = 0.05
shader_parameter/wind_horizontal_direction = Vector2(1, 0.5)
shader_parameter/character_position = Vector3(19.0101, 0.670344, 79.6646)
shader_parameter/character_radius = 0.5
shader_parameter/character_push_strength = 0.75
shader_parameter/color_ramp = ExtResource("2_eyk30")
shader_parameter/wind_noise = ExtResource("3_183e7")
shader_parameter/character_position = Vector3(19.0101, 0.670344, 79.6646)
shader_parameter/character_radius = 0.5
shader_parameter/character_distance_falloff_curve = SubResource("CurveTexture_cknys")
shader_parameter/character_push_strength = 0.75

@ -47,29 +47,19 @@ void vertex() {
bump_wind *= vec3(wind_strength, wind_vertical_strength, wind_strength);
VERTEX += bump_wind * displacement_affect;
// At the moment the blades are pushed away in a perfectly circular manner.
// We could distort the distance to the character based on a noise, to break a bit the
// circular shape. We could distort the falloff by sampling in a noise based on the xz coordinates.
// The task is left to the reader
vec3 dir_to_character = character_position - MODEL_MATRIX[3].xyz;
// uncomment the following line to have a horizontal only character push
//dir_to_character.y = 0.0;
float distance_to_character = length(dir_to_character);
float falloff = 1.0 - smoothstep(0.0, 1.0, distance_to_character/character_radius);
// Because we operate in vertex space, we need to convert the direction to the character
// in vertex space. Otherwise, it wouldn't work for rotated blades of grass.
// comment the next line to observe how the blades are not all facing away from the character.
dir_to_character = (inverse(MODEL_MATRIX) * vec4(dir_to_character, 0.0)).xyz;
dir_to_character = normalize(dir_to_character);
// sample the curve based on how far we are from the character, in normalized coordinates
float falloff_curve = texture(character_distance_falloff_curve, vec2(falloff)).x;
// direction to character is inverted because we want to point away from it
VERTEX += normalize(-dir_to_character) * falloff_curve * character_push_strength * displacement_affect;
vec3 vertex_offset = bump_wind * displacement_affect + normalize(-dir_to_character) * falloff_curve * character_push_strength * displacement_affect;
vertex_offset = smoothstep(0.0, 1.0, vertex_offset); // VERTEX.y越大扰动幅度越大
VERTEX += normalize(-dir_to_character) * falloff_curve * character_push_strength * displacement_affect;
}
void fragment() {

@ -36,7 +36,7 @@ void fragment() {
if (is_focus && !is_in_focus(focus_min,focus_max)){
discard;
}
vec3 c = COLOR.rgb;
if(c.r+c.g+c.b<0.1){
ALBEDO = vec3(0.0);
@ -57,7 +57,7 @@ void fragment() {
if(!is_light && world_normal.y<0.1){
brightness = brightness*0.6;
}
//通用网格纹理
float noise_value1 = texture(tex_noise1,floor(uv1 /0.02) *0.02).r;
float discrete_noise_value1 = floor(noise_value1 / 0.5) * 0.5;
@ -65,7 +65,7 @@ void fragment() {
float discrete_noise_value2 = floor(noise_value2 / 0.5) * 0.5;
float noise_value3 = texture(tex_noise3,floor(uv3 /0.02) *0.02).r;
float discrete_noise_value3 = floor(noise_value3 / 0.1) * 0.1;
float noise_value_sub = texture(tex_noise_sub,floor(uv_sub /0.02) *0.02).r;
if (noise_value_sub > 0.2){
c.rgb = mix(c.rgb,tex_noise_sub_color.rgb,tex_noise_sub_color.a);
@ -74,7 +74,7 @@ void fragment() {
c += discrete_noise_value2 * 0.2;
c -= discrete_noise_value3 * 0.08;
}
//应用亮度
c.rgb = mix(vec3(0.0), c.rgb, brightness);
ALBEDO = c.rgb;

@ -6,6 +6,6 @@ void fragment() {
vec2 screen_size = vec2(640,360);
vec2 uv = UV;
uv = floor(uv * screen_size / 0.2) * 0.2 / screen_size;
COLOR = texture(screenTexture, uv);
}

@ -5,6 +5,6 @@ uniform sampler2D mask_texture;
void fragment() {
vec4 colour = texture(TEXTURE, UV);
colour.a *= texture(mask_texture, UV).a;
COLOR = colour;
}

Binary file not shown.

@ -0,0 +1,18 @@
[remap]
importer="MagicaVoxel.With.Extensions.To.Mesh"
type="Mesh"
uid="uid://br8t5hqrax0gq"
path="res://.godot/imported/sub_grass.vox-02f4f01ca790a4bfefb33ce31c52d03a.mesh"
[deps]
source_file="res://resource/mesh_level/sub_grass.vox"
dest_files=["res://.godot/imported/sub_grass.vox-02f4f01ca790a4bfefb33ce31c52d03a.mesh"]
[params]
Scale=0.02
GreedyMeshGenerator=true
SnapToGround=false
FirstKeyframeOnly=true

Binary file not shown.

@ -0,0 +1,18 @@
[remap]
importer="MagicaVoxel.With.Extensions.To.Mesh"
type="Mesh"
uid="uid://ioh8eayxto03"
path="res://.godot/imported/sub_water.vox-15e65b0d001c8f576f5550056f968414.mesh"
[deps]
source_file="res://resource/mesh_level/sub_water.vox"
dest_files=["res://.godot/imported/sub_water.vox-15e65b0d001c8f576f5550056f968414.mesh"]
[params]
Scale=0.02
GreedyMeshGenerator=true
SnapToGround=false
FirstKeyframeOnly=true

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -168,7 +168,7 @@ unique_name_in_owner = true
collision_layer = 4
collision_mask = 3
script = ExtResource("11_sox5o")
metadata/_custom_type_script = ExtResource("11_sox5o")
metadata/_custom_type_script = "uid://dqsadncw4srh6"
[node name="BattleAttackAreaCollision" type="CollisionShape3D" parent="Battle/BattleAttackArea"]
unique_name_in_owner = true

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
[gd_scene load_steps=7 format=3 uid="uid://y56utpi0ouet"]
[ext_resource type="Script" path="res://script/level/level_active_plat_lift.gd" id="1_ibdg3"]
[ext_resource type="Script" uid="uid://dem2qvx352fra" path="res://script/level/level_active_plat_lift.gd" id="1_ibdg3"]
[ext_resource type="PackedScene" uid="uid://ddsegosfqo0a1" path="res://scene/level_active/button01.tscn" id="2_1npfg"]
[ext_resource type="ArrayMesh" uid="uid://c8yvc57f6euxy" path="res://resource/mesh_level/chara_active_lift01.vox" id="3_2jayo"]
[ext_resource type="ArrayMesh" uid="uid://bk4x7bpw6iwv3" path="res://resource/mesh_level/chara_active_box.vox" id="4_08hge"]

@ -136,6 +136,8 @@ func refresh_mesh_library(path_list: Array, from_editor_tool: bool = false):
var mesh_library_chara_id_list: Array[int] = []
var material_grid_block: Material = load("res://render/material/level_grid_block.tres") as Material
var material_grid_water: Material = load("res://render/material/level_grid_water.tres") as Material
var material_grass: Material = load("res://render/material/level_grass.tres") as Material
var reimport_files: Array[String] = []
for file_name_full in path_list:
@ -171,15 +173,17 @@ func refresh_mesh_library(path_list: Array, from_editor_tool: bool = false):
mesh_library.set_item_mesh(mesh_id, mesh)
if has_material:
var material: Material = mesh.surface_get_material(0) as Material
var material_set: Material = material_grid_block
if (mesh.get_surface_count() > 0) and ((not material) or (material.get_path() != material_set.get_path())):
if from_editor_tool:
reimport_files.append(file_name_full)
else:
print("surface_set_material")
mesh.surface_set_material(0, material_grid_block)
ResourceSaver.save(mesh, file_name_full)
if mesh_name.contains("water"):
material_set = material_grid_water
if mesh_name.contains("grass"):
material_set = material_grass
if from_editor_tool:
reimport_files.append(file_name_full)
else:
print("surface_set_material")
mesh.surface_set_material(0, material_set)
ResourceSaver.save(mesh, file_name_full)
if has_shape:
var item_shapes: Array

@ -0,0 +1 @@
uid://clcab7k11urg

@ -109,13 +109,14 @@ func enter_level() -> void:
for level_active_spot: Node in level_active_spots:
level_active_spot.queue_free()
for level_active_spot: LevelInstance.LevelActiveSpot in cur_level_instance.get_level_active_spots():
var new_level_active: LevelActive = level_active_spot.scene.instantiate()
var new_level_active: Node = level_active_spot.scene.instantiate()
add_child(new_level_active)
new_level_active.global_position = level_active_spot.pos
level_active_spots.append(new_level_active)
if new_level_active is LevelActive:
new_level_active.init()
if new_level_active is LevelDoor:
level_doors.append(new_level_active)
new_level_active.init()
#更新刷怪数据
level_character_born_spots = cur_level_instance.get_character_born_spots()
level_enemy_cfgs = cur_level_instance.get_enemy_cfgs()

Loading…
Cancel
Save