архитектура и цели для агентов
This commit is contained in:
@@ -0,0 +1,136 @@
|
||||
extends SceneTree
|
||||
|
||||
const STREAMING_SCENE := "res://src/scenes/streaming/eastern_kingdoms_streaming.tscn"
|
||||
|
||||
const CHECKPOINTS := [
|
||||
{
|
||||
"name": "elwynn_waterfall_front",
|
||||
"camera": Vector3(16445.0, 125.0, 26295.0),
|
||||
"target": Vector3(16518.84, 68.0, 26427.27),
|
||||
"player": Vector3(16518.84, 55.0, 26427.27),
|
||||
},
|
||||
{
|
||||
"name": "elwynn_waterfall_side",
|
||||
"camera": Vector3(16670.0, 115.0, 26320.0),
|
||||
"target": Vector3(16518.84, 72.0, 26427.27),
|
||||
"player": Vector3(16518.84, 55.0, 26427.27),
|
||||
},
|
||||
{
|
||||
"name": "goldshire_inn_windows",
|
||||
"camera": Vector3(16942.0, 82.0, 26503.0),
|
||||
"target": Vector3(17042.27, 66.0, 26530.91),
|
||||
"player": Vector3(17042.27, 58.0, 26530.91),
|
||||
},
|
||||
{
|
||||
"name": "goldshire_blacksmith_windows",
|
||||
"camera": Vector3(16892.0, 79.0, 26562.0),
|
||||
"target": Vector3(16972.46, 64.0, 26526.7),
|
||||
"player": Vector3(16972.46, 58.0, 26526.7),
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
func _initialize() -> void:
|
||||
_capture_async.call_deferred()
|
||||
|
||||
|
||||
func _capture_async() -> void:
|
||||
var args := OS.get_cmdline_user_args()
|
||||
var output_dir := _arg(args, "--output", "user://render_checkpoints")
|
||||
var only := _arg(args, "--only", "").to_lower()
|
||||
var wait_seconds := float(_arg(args, "--wait", "8.0"))
|
||||
var width := int(_arg(args, "--width", "1280"))
|
||||
var height := int(_arg(args, "--height", "900"))
|
||||
var headless := DisplayServer.get_name().to_lower() == "headless"
|
||||
var dry_run := args.has("--dry-run") or headless
|
||||
|
||||
get_root().size = Vector2i(maxi(16, width), maxi(16, height))
|
||||
var abs_output_dir := ProjectSettings.globalize_path(output_dir)
|
||||
if not dry_run:
|
||||
DirAccess.make_dir_recursive_absolute(abs_output_dir)
|
||||
elif headless and not args.has("--dry-run"):
|
||||
print("RENDER_CHECKPOINT dry-run: headless display cannot capture viewport PNGs.")
|
||||
|
||||
var packed: PackedScene = load(STREAMING_SCENE)
|
||||
if packed == null:
|
||||
push_error("Cannot load streaming scene: %s" % STREAMING_SCENE)
|
||||
quit(1)
|
||||
return
|
||||
|
||||
var world = packed.instantiate()
|
||||
if not (world is Node3D):
|
||||
push_error("Streaming scene root is not Node3D: %s" % STREAMING_SCENE)
|
||||
quit(1)
|
||||
return
|
||||
|
||||
var camera := Camera3D.new()
|
||||
camera.name = "CheckpointCamera"
|
||||
camera.current = true
|
||||
camera.fov = 62.0
|
||||
camera.far = 50000.0
|
||||
camera.position = CHECKPOINTS[0].get("camera", Vector3.ZERO)
|
||||
(world as Node3D).add_child(camera)
|
||||
world.set("camera_path", NodePath("CheckpointCamera"))
|
||||
world.set("debug_streaming", true)
|
||||
get_root().add_child(world)
|
||||
await process_frame
|
||||
await process_frame
|
||||
|
||||
var player := world.get_node_or_null("ThirdPersonPlayer") as Node3D
|
||||
if player != null:
|
||||
player.set_process(false)
|
||||
player.set_physics_process(false)
|
||||
var visual := player.get_node_or_null("Visual") as Node3D
|
||||
if visual != null:
|
||||
visual.visible = false
|
||||
|
||||
var captured := 0
|
||||
for checkpoint_variant in CHECKPOINTS:
|
||||
var checkpoint: Dictionary = checkpoint_variant
|
||||
var checkpoint_name := String(checkpoint.get("name", "checkpoint"))
|
||||
if not only.is_empty() and not checkpoint_name.to_lower().contains(only):
|
||||
continue
|
||||
|
||||
camera.global_position = checkpoint.get("camera", Vector3.ZERO)
|
||||
camera.look_at(checkpoint.get("target", Vector3.ZERO), Vector3.UP)
|
||||
if player != null:
|
||||
player.global_position = checkpoint.get("player", checkpoint.get("target", Vector3.ZERO))
|
||||
if world.has_method("_refresh_streaming_targets_at"):
|
||||
world.call("_refresh_streaming_targets_at", camera.global_position, true)
|
||||
|
||||
await create_timer(maxf(wait_seconds, 0.0)).timeout
|
||||
if dry_run:
|
||||
print("RENDER_CHECKPOINT dry_run name=%s camera=%s target=%s" % [
|
||||
checkpoint_name,
|
||||
camera.global_position,
|
||||
checkpoint.get("target", Vector3.ZERO),
|
||||
])
|
||||
captured += 1
|
||||
continue
|
||||
|
||||
await RenderingServer.frame_post_draw
|
||||
|
||||
var image := get_root().get_texture().get_image()
|
||||
var file_name := "%s.png" % checkpoint_name
|
||||
var abs_path := abs_output_dir.path_join(file_name)
|
||||
var err := image.save_png(abs_path)
|
||||
if err != OK:
|
||||
push_error("Failed to save checkpoint %s to %s (err=%d)" % [checkpoint_name, abs_path, err])
|
||||
quit(1)
|
||||
return
|
||||
print("RENDER_CHECKPOINT saved %s" % abs_path)
|
||||
captured += 1
|
||||
|
||||
world.queue_free()
|
||||
if captured <= 0:
|
||||
push_error("No checkpoints captured. --only filter was: %s" % only)
|
||||
quit(1)
|
||||
return
|
||||
quit(0)
|
||||
|
||||
|
||||
func _arg(args: PackedStringArray, name: String, default_value: String) -> String:
|
||||
var idx := args.find(name)
|
||||
if idx >= 0 and idx + 1 < args.size():
|
||||
return args[idx + 1]
|
||||
return default_value
|
||||
@@ -0,0 +1 @@
|
||||
uid://ct7wd7gtf8h6o
|
||||
@@ -0,0 +1,80 @@
|
||||
extends SceneTree
|
||||
|
||||
const DEFAULT_EXTRACTED_DIR := "res://data/extracted"
|
||||
const DEFAULT_MAP := "Azeroth"
|
||||
|
||||
|
||||
func _initialize() -> void:
|
||||
var args := OS.get_cmdline_user_args()
|
||||
var extracted_dir := _arg(args, "--extracted", DEFAULT_EXTRACTED_DIR)
|
||||
var map_name := _arg(args, "--map", DEFAULT_MAP)
|
||||
var kind := _arg(args, "--kind", "wmo").to_lower()
|
||||
var path_contains := _arg(args, "--path-contains", "").to_lower()
|
||||
var limit := int(_arg(args, "--limit", "25"))
|
||||
|
||||
if not ClassDB.class_exists("ADTLoader"):
|
||||
push_error("ADTLoader is not registered. Rebuild the native GDExtension first.")
|
||||
quit(1)
|
||||
return
|
||||
|
||||
var map_dir := ProjectSettings.globalize_path(
|
||||
extracted_dir.path_join("World/Maps").path_join(map_name)
|
||||
)
|
||||
var dir := DirAccess.open(map_dir)
|
||||
if dir == null:
|
||||
push_error("Cannot open map directory: %s" % map_dir)
|
||||
quit(1)
|
||||
return
|
||||
|
||||
var loader = ClassDB.instantiate("ADTLoader")
|
||||
var files := dir.get_files()
|
||||
files.sort()
|
||||
var printed := 0
|
||||
for file_name in files:
|
||||
if printed >= limit:
|
||||
break
|
||||
if not file_name.to_lower().ends_with(".adt"):
|
||||
continue
|
||||
if not file_name.begins_with("%s_" % map_name):
|
||||
continue
|
||||
var data: Dictionary = loader.call("load_adt", map_dir.path_join(file_name))
|
||||
var names: PackedStringArray = data.get("%s_names" % kind, PackedStringArray())
|
||||
var placements: Array = data.get("%s_placements" % kind, [])
|
||||
for placement_variant in placements:
|
||||
if printed >= limit:
|
||||
break
|
||||
if not (placement_variant is Dictionary):
|
||||
continue
|
||||
var placement: Dictionary = placement_variant
|
||||
var name_id := int(placement.get("name_id", -1))
|
||||
if name_id < 0 or name_id >= names.size():
|
||||
continue
|
||||
var rel_path := String(names[name_id]).replace("\\", "/")
|
||||
if not path_contains.is_empty() and not rel_path.to_lower().contains(path_contains):
|
||||
continue
|
||||
var rot: Vector3 = placement.get("rot", Vector3.ZERO)
|
||||
print("ADT_%s tile=%s uid=%d path=%s pos=%s rot_deg=%s scale=%.3f" % [
|
||||
kind.to_upper(),
|
||||
_tile_from_adt_filename(file_name),
|
||||
int(placement.get("unique_id", -1)),
|
||||
rel_path,
|
||||
placement.get("pos", Vector3.ZERO),
|
||||
Vector3(rad_to_deg(rot.x), rad_to_deg(rot.y), rad_to_deg(rot.z)),
|
||||
float(placement.get("scale", 1.0)),
|
||||
])
|
||||
printed += 1
|
||||
quit(0)
|
||||
|
||||
|
||||
func _tile_from_adt_filename(file_name: String) -> Vector2i:
|
||||
var parts := file_name.get_basename().split("_")
|
||||
if parts.size() < 3:
|
||||
return Vector2i(-1, -1)
|
||||
return Vector2i(int(parts[parts.size() - 2]), int(parts[parts.size() - 1]))
|
||||
|
||||
|
||||
func _arg(args: PackedStringArray, name: String, default_value: String) -> String:
|
||||
var idx := args.find(name)
|
||||
if idx >= 0 and idx + 1 < args.size():
|
||||
return args[idx + 1]
|
||||
return default_value
|
||||
@@ -0,0 +1 @@
|
||||
uid://bad7oihytwnq0
|
||||
@@ -0,0 +1,145 @@
|
||||
extends SceneTree
|
||||
|
||||
const DEFAULT_EXTRACTED_DIR := "res://data/extracted"
|
||||
const DEFAULT_MAP := "Azeroth"
|
||||
const DEFAULT_TARGET_UID := 11785
|
||||
|
||||
var _failures := 0
|
||||
|
||||
|
||||
func _initialize() -> void:
|
||||
var args := OS.get_cmdline_user_args()
|
||||
var extracted_dir := _arg(args, "--extracted", DEFAULT_EXTRACTED_DIR)
|
||||
var map_name := _arg(args, "--map", DEFAULT_MAP)
|
||||
var target_uid := int(_arg(args, "--uid", str(DEFAULT_TARGET_UID)))
|
||||
var path_contains := _arg(args, "--path-contains", "waterfall").to_lower()
|
||||
print("ADT M2 placement verification started. map=%s uid=%d path_contains=%s" % [
|
||||
map_name,
|
||||
target_uid,
|
||||
path_contains,
|
||||
])
|
||||
|
||||
var matches := _find_m2_placements(extracted_dir, map_name, target_uid, path_contains)
|
||||
if matches.is_empty():
|
||||
_fail("No matching ADT M2 placement found. map=%s uid=%d path_contains=%s" % [
|
||||
map_name,
|
||||
target_uid,
|
||||
path_contains,
|
||||
])
|
||||
else:
|
||||
print("ADT M2 placement verification matched %d placement(s)." % matches.size())
|
||||
for match in matches:
|
||||
print(_format_match(match))
|
||||
|
||||
if _failures > 0:
|
||||
quit(1)
|
||||
return
|
||||
quit(0)
|
||||
|
||||
|
||||
func _find_m2_placements(
|
||||
extracted_dir: String,
|
||||
map_name: String,
|
||||
target_uid: int,
|
||||
path_contains: String) -> Array:
|
||||
if not ClassDB.class_exists("ADTLoader"):
|
||||
_fail("ADTLoader is not registered. Rebuild the native GDExtension first.")
|
||||
return []
|
||||
|
||||
var map_dir := ProjectSettings.globalize_path(
|
||||
extracted_dir.path_join("World/Maps").path_join(map_name)
|
||||
)
|
||||
var dir := DirAccess.open(map_dir)
|
||||
if dir == null:
|
||||
_fail("Cannot open map directory: %s" % map_dir)
|
||||
return []
|
||||
|
||||
var files := _collect_adt_files(dir, map_name)
|
||||
if files.is_empty():
|
||||
_fail("No ADT files found in %s" % map_dir)
|
||||
return []
|
||||
|
||||
var loader = ClassDB.instantiate("ADTLoader")
|
||||
if loader == null:
|
||||
_fail("Cannot instantiate ADTLoader.")
|
||||
return []
|
||||
|
||||
var matches := []
|
||||
for file_name in files:
|
||||
var tile := _tile_from_adt_filename(file_name)
|
||||
var data: Dictionary = loader.call("load_adt", map_dir.path_join(file_name))
|
||||
var names: PackedStringArray = data.get("m2_names", PackedStringArray())
|
||||
var placements: Array = data.get("m2_placements", [])
|
||||
for placement_variant in placements:
|
||||
if not (placement_variant is Dictionary):
|
||||
continue
|
||||
var placement: Dictionary = placement_variant
|
||||
var uid := int(placement.get("unique_id", -1))
|
||||
if target_uid >= 0 and uid != target_uid:
|
||||
continue
|
||||
var name_id := int(placement.get("name_id", -1))
|
||||
if name_id < 0 or name_id >= names.size():
|
||||
continue
|
||||
var rel_path := String(names[name_id]).replace("\\", "/")
|
||||
if not path_contains.is_empty() and not rel_path.to_lower().contains(path_contains):
|
||||
continue
|
||||
matches.append({
|
||||
"tile": tile,
|
||||
"uid": uid,
|
||||
"path": rel_path,
|
||||
"pos": placement.get("pos", Vector3.ZERO),
|
||||
"rot": placement.get("rot", Vector3.ZERO),
|
||||
"scale": float(placement.get("scale", 1.0)),
|
||||
})
|
||||
return matches
|
||||
|
||||
|
||||
func _collect_adt_files(dir: DirAccess, map_name: String) -> Array:
|
||||
var result := []
|
||||
dir.list_dir_begin()
|
||||
while true:
|
||||
var file_name := dir.get_next()
|
||||
if file_name.is_empty():
|
||||
break
|
||||
if dir.current_is_dir():
|
||||
continue
|
||||
if not file_name.to_lower().ends_with(".adt"):
|
||||
continue
|
||||
if not file_name.begins_with("%s_" % map_name):
|
||||
continue
|
||||
result.append(file_name)
|
||||
dir.list_dir_end()
|
||||
result.sort()
|
||||
return result
|
||||
|
||||
|
||||
func _tile_from_adt_filename(file_name: String) -> Vector2i:
|
||||
var parts := file_name.get_basename().split("_")
|
||||
if parts.size() < 3:
|
||||
return Vector2i(-1, -1)
|
||||
return Vector2i(int(parts[parts.size() - 2]), int(parts[parts.size() - 1]))
|
||||
|
||||
|
||||
func _format_match(match: Dictionary) -> String:
|
||||
var rot: Vector3 = match.get("rot", Vector3.ZERO)
|
||||
var rot_deg := Vector3(rad_to_deg(rot.x), rad_to_deg(rot.y), rad_to_deg(rot.z))
|
||||
return "ADT_M2_PLACEMENT tile=%s uid=%d path=%s pos=%s rot_deg=%s scale=%.3f" % [
|
||||
match.get("tile", Vector2i(-1, -1)),
|
||||
int(match.get("uid", -1)),
|
||||
String(match.get("path", "")),
|
||||
match.get("pos", Vector3.ZERO),
|
||||
rot_deg,
|
||||
float(match.get("scale", 1.0)),
|
||||
]
|
||||
|
||||
|
||||
func _arg(args: PackedStringArray, name: String, default_value: String) -> String:
|
||||
var idx := args.find(name)
|
||||
if idx >= 0 and idx + 1 < args.size():
|
||||
return args[idx + 1]
|
||||
return default_value
|
||||
|
||||
|
||||
func _fail(message: String) -> void:
|
||||
_failures += 1
|
||||
push_error(message)
|
||||
@@ -0,0 +1 @@
|
||||
uid://bbg18pmk3svu2
|
||||
@@ -0,0 +1,54 @@
|
||||
extends SceneTree
|
||||
|
||||
const STREAMING_WORLD_LOADER := preload("res://src/scenes/streaming/streaming_world_loader.gd")
|
||||
|
||||
var _failures := 0
|
||||
|
||||
|
||||
func _initialize() -> void:
|
||||
var loader = STREAMING_WORLD_LOADER.new()
|
||||
var placement := {
|
||||
"name_id": 0,
|
||||
"unique_id": 11785,
|
||||
"pos": Vector3.ZERO,
|
||||
"rot": Vector3.ZERO,
|
||||
"scale": 1.0,
|
||||
}
|
||||
|
||||
var first: Dictionary = loader.call("_reserve_tile_m2_placements", "30_49", [placement])
|
||||
_expect((first.get("placements", []) as Array).size() == 1, "first tile should reserve unique M2 placement")
|
||||
_expect((first.get("unique_keys", []) as Array).has("uid:11785"), "first tile should own uid:11785")
|
||||
_expect((first.get("skipped_unique_keys", []) as Array).is_empty(), "first tile should not skip uid:11785")
|
||||
|
||||
var duplicate: Dictionary = loader.call("_reserve_tile_m2_placements", "31_49", [placement])
|
||||
_expect((duplicate.get("placements", []) as Array).is_empty(), "second tile should skip duplicate uid:11785")
|
||||
_expect((duplicate.get("skipped_unique_keys", []) as Array).has("uid:11785"), "second tile should remember skipped uid:11785")
|
||||
|
||||
loader.call("_release_tile_m2_unique_keys", {
|
||||
"key": "30_49",
|
||||
"m2_unique_keys": ["uid:11785"],
|
||||
"m2_skipped_unique_keys": [],
|
||||
}, false)
|
||||
var after_release: Dictionary = loader.call("_reserve_tile_m2_placements", "31_49", [placement])
|
||||
_expect((after_release.get("placements", []) as Array).size() == 1, "second tile should reserve uid:11785 after owner release")
|
||||
_expect((after_release.get("unique_keys", []) as Array).has("uid:11785"), "second tile should own uid:11785 after release")
|
||||
|
||||
var same_tile_loader = STREAMING_WORLD_LOADER.new()
|
||||
var same_tile_duplicate: Dictionary = same_tile_loader.call("_reserve_tile_m2_placements", "31_49", [placement, placement])
|
||||
_expect((same_tile_duplicate.get("placements", []) as Array).size() == 1, "same tile should keep only one copy of duplicate uid:11785")
|
||||
|
||||
loader.free()
|
||||
same_tile_loader.free()
|
||||
if _failures > 0:
|
||||
push_error("M2 unique dedupe verification failed: %d issue(s)" % _failures)
|
||||
quit(1)
|
||||
return
|
||||
print("M2 unique dedupe verification passed.")
|
||||
quit(0)
|
||||
|
||||
|
||||
func _expect(condition: bool, message: String) -> void:
|
||||
if condition:
|
||||
return
|
||||
_failures += 1
|
||||
push_error(message)
|
||||
@@ -0,0 +1 @@
|
||||
uid://b2xmxm1dxmx10
|
||||
@@ -0,0 +1,142 @@
|
||||
extends SceneTree
|
||||
|
||||
const WOW_M2_MATERIAL := preload("res://addons/mpq_extractor/loaders/wow_m2_material.gd")
|
||||
const WOW_WMO_MATERIAL := preload("res://addons/mpq_extractor/loaders/wow_wmo_material.gd")
|
||||
|
||||
var _failures := 0
|
||||
|
||||
|
||||
func _initialize() -> void:
|
||||
_check_project_descriptor_setting()
|
||||
_check_wmo_window_material()
|
||||
_check_wmo_wall_material()
|
||||
_check_wmo_glass_material()
|
||||
_check_m2_alpha_material()
|
||||
_check_m2_billboard_and_uv_rotation_shader()
|
||||
|
||||
if _failures > 0:
|
||||
push_error("Renderer material verification failed: %d issue(s)" % _failures)
|
||||
quit(1)
|
||||
return
|
||||
|
||||
print("Renderer material verification passed.")
|
||||
quit(0)
|
||||
|
||||
|
||||
func _check_project_descriptor_setting() -> void:
|
||||
var descriptors := int(ProjectSettings.get_setting(
|
||||
"rendering/rendering_device/d3d12/max_resource_descriptors",
|
||||
0
|
||||
))
|
||||
_expect(
|
||||
descriptors >= 1048576,
|
||||
"D3D12 resource descriptor heap setting should be at least 1048576, got %d" % descriptors
|
||||
)
|
||||
|
||||
|
||||
func _check_wmo_window_material() -> void:
|
||||
var mat := WOW_WMO_MATERIAL.build(
|
||||
null,
|
||||
null,
|
||||
0x11,
|
||||
0,
|
||||
0,
|
||||
"DUNGEONS/TEXTURES/WINDOWS/MM_ELWYNN_WND_EXT__01.BLP"
|
||||
)
|
||||
var code := mat.shader.code
|
||||
_expect(bool(mat.get_meta("wow_wmo_window_material", false)), "Elwynn exterior window should be tagged as a WMO window material")
|
||||
_expect(not bool(mat.get_meta("wow_wmo_glass_blend_material", false)), "Opaque Elwynn exterior window should not be tagged as glass blend")
|
||||
_expect(float(mat.get_shader_parameter("unlit_material")) > 0.5, "WMO flag 0x01 should make Elwynn exterior window unlit")
|
||||
_expect(code.contains("cull_back"), "Opaque WMO window atlas shader should use cull_back")
|
||||
_expect(not code.contains("cull_disabled"), "Opaque WMO window atlas shader should not use cull_disabled")
|
||||
_expect(code.contains("depth_draw_opaque"), "Opaque WMO window atlas shader should use opaque depth draw")
|
||||
_expect(code.contains("filter_linear, repeat_disable"), "WMO window atlas shader should use stable non-mipmapped albedo sampler")
|
||||
_expect(not code.contains("ALPHA ="), "Opaque WMO window atlas shader should not write ALPHA")
|
||||
|
||||
|
||||
func _check_wmo_wall_material() -> void:
|
||||
var mat := WOW_WMO_MATERIAL.build(
|
||||
null,
|
||||
null,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
"DUNGEONS/TEXTURES/WALLS/MM_STRMWND_WALL_03.BLP"
|
||||
)
|
||||
var code := mat.shader.code
|
||||
_expect(not bool(mat.get_meta("wow_wmo_window_material", false)), "Stormwind wall texture name must not be matched as a window")
|
||||
_expect(float(mat.get_shader_parameter("unlit_material")) < 0.5, "Ordinary WMO wall should not be unlit")
|
||||
_expect(code.contains("cull_disabled"), "Ordinary WMO wall should keep cull_disabled")
|
||||
_expect(code.contains("filter_linear_mipmap_anisotropic, repeat_enable"), "Ordinary WMO wall should keep mipmapped repeating albedo sampler")
|
||||
|
||||
|
||||
func _check_wmo_glass_material() -> void:
|
||||
var mat := WOW_WMO_MATERIAL.build(
|
||||
null,
|
||||
null,
|
||||
0,
|
||||
0,
|
||||
2,
|
||||
"DUNGEONS/TEXTURES/WINDOWS/MM_ELWYNN_WND_EXT__01.BLP"
|
||||
)
|
||||
var code := mat.shader.code
|
||||
_expect(bool(mat.get_meta("wow_wmo_glass_blend_material", false)), "BlendMode 2 WMO window should be tagged as glass")
|
||||
_expect(code.contains("cull_back"), "WMO glass shader should use cull_back")
|
||||
_expect(code.contains("depth_draw_never"), "WMO glass shader should avoid depth writes")
|
||||
_expect(code.contains("ALPHA = clamp"), "WMO glass shader should write alpha")
|
||||
|
||||
|
||||
func _check_m2_alpha_material() -> void:
|
||||
var mat := WOW_M2_MATERIAL.build(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
"NewWaterfall",
|
||||
{}
|
||||
)
|
||||
var code := mat.shader.code
|
||||
_expect(code.contains("blend_mix"), "M2 alpha shader should use blend_mix")
|
||||
_expect(code.contains("depth_draw_never"), "M2 alpha shader should avoid depth writes")
|
||||
_expect(code.contains("ALPHA = clamp"), "M2 alpha shader should write alpha")
|
||||
|
||||
|
||||
func _check_m2_billboard_and_uv_rotation_shader() -> void:
|
||||
var mat := WOW_M2_MATERIAL.build(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
0x04,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
"BillboardProbe",
|
||||
{
|
||||
"billboard_enabled": true,
|
||||
"stage0_uv_rotation": Vector4(0.0, -1.0, 1.0, 0.0),
|
||||
"stage0_uv_rotation_speed": 0.25,
|
||||
}
|
||||
)
|
||||
var code := mat.shader.code
|
||||
_expect(bool(mat.get_meta("wow_m2_billboard_enabled", false)), "M2 material should preserve billboard metadata")
|
||||
_expect(bool(mat.get_shader_parameter("billboard_enabled")), "M2 material should enable billboard shader parameter")
|
||||
_expect(code.contains("apply_m2_billboard"), "M2 shader should keep billboard vertex path")
|
||||
_expect(code.contains("CUSTOM0"), "M2 shader should consume CUSTOM0 billboard data")
|
||||
_expect(code.contains("stage0_uv_rotation"), "M2 shader should keep UV rotation uniforms")
|
||||
_expect(code.contains("uv_rotation_speed * TIME"), "M2 shader should keep animated UV rotation path")
|
||||
|
||||
|
||||
func _expect(condition: bool, message: String) -> void:
|
||||
if condition:
|
||||
return
|
||||
_failures += 1
|
||||
push_error(message)
|
||||
@@ -0,0 +1 @@
|
||||
uid://c58bfxr64yglq
|
||||
Reference in New Issue
Block a user