новая структура проекта

This commit is contained in:
2026-04-20 21:04:25 +04:00
parent 1fe2a72ef1
commit 1a56b22e38
1932 changed files with 1886 additions and 22779 deletions
@@ -0,0 +1,41 @@
[gd_scene format=3 uid="uid://f1nqi4emji47"]
[ext_resource type="Script" uid="uid://yi6lawwjgocg" path="res://src/scenes/streaming/streaming_world_loader.gd" id="1_stream"]
[ext_resource type="Script" uid="uid://bauggobg40psr" path="res://src/scenes/camera/fly_camera.gd" id="2_flycam"]
[sub_resource type="Sky" id="Sky_1"]
[sub_resource type="Environment" id="Environment_1"]
background_mode = 2
sky = SubResource("Sky_1")
ambient_light_source = 3
ambient_light_color = Color(1, 1, 1, 1)
ambient_light_energy = 0.5
[node name="StreamingWorld" type="Node3D" unique_id=1063159974]
script = ExtResource("1_stream")
camera_path = NodePath("Camera3D")
update_interval = 0.1
max_concurrent_tile_tasks = 4
chunk_ops_per_tick = 64
cached_tile_mesh_limit = 48
use_baked_tile_cache = false
enable_water = true
terrain_cast_shadows = true
m2_cast_shadows = null
[node name="Camera3D" type="Camera3D" parent="." unique_id=502573687]
transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, 300, 300)
current = true
far = 50000.0
script = ExtResource("2_flycam")
speed = 1200.0
fast_mult = 8.0
[node name="Sun" type="DirectionalLight3D" parent="." unique_id=1436804627]
transform = Transform3D(0.866025, -0.353553, 0.353553, 0, 0.707107, 0.707107, -0.5, -0.612372, 0.612372, 0, 0, 0)
light_energy = 1.5
shadow_enabled = true
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=12906896]
environment = SubResource("Environment_1")
File diff suppressed because it is too large Load Diff
@@ -0,0 +1 @@
uid://yi6lawwjgocg
+26
View File
@@ -0,0 +1,26 @@
[gd_scene format=3 uid="uid://chk8oerov1xve"]
[ext_resource type="Script" uid="uid://dq3t6tfy5wa0r" path="res://src/scenes/streaming/test_world_loader.gd" id="1_gyc4i"]
[ext_resource type="Script" path="res://src/scenes/camera/fly_camera.gd" id="2_flycam"]
[sub_resource type="Sky" id="sky_1"]
[sub_resource type="Environment" id="env_1"]
background_mode = 2
sky = SubResource("sky_1")
[node name="World" type="Node3D"]
script = ExtResource("1_gyc4i")
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.857, 0.515, 0, -0.515, 0.857, 0, 500, 500)
far = 20000.0
current = true
script = ExtResource("2_flycam")
[node name="Sun" type="DirectionalLight3D" parent="."]
transform = Transform3D(0.866, -0.353, 0.354, 0, 0.707, 0.707, -0.5, -0.612, 0.612, 0, 0, 0)
light_energy = 1.5
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("env_1")
+85
View File
@@ -0,0 +1,85 @@
## Загрузчик Элвиннского леса — 3×3 ADT тайла из extracted/
extends Node3D
const ADT_BUILDER_SCRIPT := preload("res://addons/mpq_extractor/loaders/adt_builder.gd")
@export var extracted_dir : String = "res://data/extracted"
@export var map_name : String = "Azeroth"
## Центр Элвиннского леса (тайл 32,48), загружаем 3×3 вокруг него
@export var center_x : int = 32
@export var center_y : int = 48
@export var radius : int = 1 ## 1 = 3×3, 2 = 5×5
func _ready() -> void:
if not ClassDB.class_exists("ADTLoader"):
push_error("ADTLoader не найден — пересобери GDExtension")
return
var abs_extracted := ProjectSettings.globalize_path(extracted_dir)
print("Папка extracted: ", abs_extracted)
var loader = ClassDB.instantiate("ADTLoader")
var loaded := 0
for dy in range(-radius, radius + 1):
for dx in range(-radius, radius + 1):
var tx := center_x + dx
var ty := center_y + dy
var path := "%s/World/Maps/%s/%s_%d_%d.adt" % [
abs_extracted, map_name, map_name, tx, ty]
print("Проверяю: ", path, "", FileAccess.file_exists(path))
if not FileAccess.file_exists(path):
continue
var data: Dictionary = loader.call("load_adt", path)
if data.is_empty() or not data.has("chunks"):
push_warning("Не удалось загрузить: ", path)
continue
# Debug first chunk of first tile only
if loaded == 0:
var chunks: Array = data.get("chunks", [])
if chunks.size() > 0:
var c0 = chunks[0]
var origin0: Vector3 = c0.get("origin", Vector3.ZERO)
var h: PackedFloat32Array = c0.get("heights", PackedFloat32Array())
print("DEBUG chunk[0] origin=", origin0)
if h.size() > 0:
print("DEBUG heights[0]=", h[0], " [72]=", h[72] if h.size()>72 else 0.0)
var builder := ADT_BUILDER_SCRIPT.new()
var terrain: Node3D = builder.build_scene(data, abs_extracted)
add_child(terrain)
loaded += 1
print("Загружен тайл %d,%d (%d чанков)" % [tx, ty, terrain.get_child_count()])
print("Всего тайлов загружено: ", loaded)
# Print terrain AABB so you know where to fly
await get_tree().process_frame
var aabb := AABB(); var first := true
for child in get_children():
if not (child is Node3D): continue
for chunk in child.get_children():
if chunk is MeshInstance3D and chunk.mesh:
var b: AABB = chunk.get_aabb()
b.position += chunk.global_position
if first: aabb = b; first = false
else: aabb = aabb.merge(b)
var bad_count := 0
for child in get_children():
if not (child is Node3D): continue
for chunk in child.get_children():
if not (chunk is MeshInstance3D): continue
var gpos: Vector3 = chunk.global_position
var local_aabb: AABB = chunk.get_aabb()
if abs(gpos.y) > 1000.0 or abs(local_aabb.position.y) > 1000.0 or local_aabb.size.y > 1000.0:
if bad_count < 5:
print("BAD chunk ", chunk.name, " gpos=", gpos, " local_aabb=", local_aabb)
bad_count += 1
if bad_count > 0:
print("Total bad chunks: ", bad_count)
if not first:
print("Terrain AABB center=", aabb.get_center(), " size=", aabb.size)
print("Fly to: ", aabb.get_center() + Vector3(0, aabb.size.length() * 0.3, 0))
@@ -0,0 +1 @@
uid://dq3t6tfy5wa0r