From 1ad383448b8061ab29aa3e6a799241744c4138e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thea=20Sch=C3=B6bl?= Date: Mon, 29 May 2023 22:16:16 +0200 Subject: [PATCH] cleanup --- README.md | 2 +- godot/starforce/starforce.gdshader | 6 +++--- godot/starforce/test.tscn | 18 ++++++++++++++++-- rust/mhgd/src/lwo/clips.rs | 4 ++-- rust/mhgd/src/lwo/material.rs | 1 + 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 499b4e0..11d5cae 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Support of games primarily depends on who developed them - Games with structural * [x] Moorhuhn Schatzjäger 3 * [ ] Moorhuhn Invasion * `.sar` Starforce 3D Engine (Visual Imagination Software "VIS" GbR): LightWave 3D + Open Dynamics Engine + CEGUI - * [ ] Moorhuhn Kart 3 + * [x] Moorhuhn Kart 3 * [ ] Moorhuhn Director's Cut * [ ] Moorhuhn Kart Thunder * `*.dat` "Phenomedia 2D Engine" diff --git a/godot/starforce/starforce.gdshader b/godot/starforce/starforce.gdshader index 718f374..fdfa7db 100644 --- a/godot/starforce/starforce.gdshader +++ b/godot/starforce/starforce.gdshader @@ -50,17 +50,17 @@ vec3 project( case 4: // Front Projection return vec3(0.0, 1.0, 0.0); case 3: - vec3 p = (transform * vec4(position, 1.0)).xyz / 10.0; + vec3 p = (transform * vec4(position, 1.0)).xyz; vec3 n = normalize(abs(mat3(transform) * normal)); vec2 uv2 = (n.x > n.y && n.x > n.z) ? vec2(p.z, p.y) : ((n.y > n.x && n.y > n.z) ? vec2(p.x, p.z) : vec2(p.x, p.y)); - return texture(tex, uv2).rgb; + return texture(tex, uv2 + 0.5).rgb; case 2: // Spherical return vec3(0.0, 0.0, 1.0); case 1: // Cylindrical return vec3(1.0, 1.0, 0.0); case 0: // Planar - return texture(tex, (transform * vec4(position, 1.0)).xz / 10.0).rgb; + return texture(tex, (transform * vec4(position, 1.0)).xz).rgb; default: return vec3(0.0); } diff --git a/godot/starforce/test.tscn b/godot/starforce/test.tscn index c08ec58..07489ff 100644 --- a/godot/starforce/test.tscn +++ b/godot/starforce/test.tscn @@ -5,9 +5,23 @@ resource_name = "load" script/source = "@tool extends Node3D +@export var load_list = [ + \"anlagen\", + \"boden\", + \"bok\", + \"fensterscheiben\", + \"gelaender\", + \"kraftfelder\", + \"rundgang\", + \"stampfer\", + \"timetunnel\", + \"waende\", +] + func _ready(): - var scene = load(\"sar://D:/Moorhuhnkart/3dobjects_tracks/track07_ufo/waende.lwo\").instantiate() - add_child(scene) + for item in load_list: + var scene = load(\"sar://D:/Moorhuhnkart/3dobjects_tracks/track07_ufo/%s.lwo\" % item).instantiate() + add_child(scene) " [node name="test" type="Node3D"] diff --git a/rust/mhgd/src/lwo/clips.rs b/rust/mhgd/src/lwo/clips.rs index 5e2e63c..1953d15 100644 --- a/rust/mhgd/src/lwo/clips.rs +++ b/rust/mhgd/src/lwo/clips.rs @@ -34,12 +34,12 @@ pub fn collect_clip(target: &mut HashMap>, clip: ImageClip) { if sequence.data.flags & 0x1 != 1 { godot_error!("Non-looping animated textures are not supported!") } - let mut frame_duration = 15.0 / 60.0; + let mut frame_duration = 1.0 / 15.0; for meta in attributes { match meta { ImageClipSubChunk::Time(time) => { - frame_duration = time.frame_rate as f64 / 60.0; + frame_duration = 1.0 / time.frame_rate as f64; } x => godot_error!("TODO: {:?}", x), } diff --git a/rust/mhgd/src/lwo/material.rs b/rust/mhgd/src/lwo/material.rs index 0ea747f..b885dbe 100644 --- a/rust/mhgd/src/lwo/material.rs +++ b/rust/mhgd/src/lwo/material.rs @@ -163,6 +163,7 @@ impl MaterialUvInfo { .scaled(size), origin: pos, } + .affine_inverse() .to_variant(), )); }