- m2_material: Metin2-style ShaderMaterial. blend_mix shader (opaque /
alpha-blend / alpha-test-cutout via `mode` uniform) + blend_add shader
(additive glow). modulate(tex, COORD) * COLOR, diffuse_lambert.
- Metin2Model: material_mode prop ("metin2" ShaderMaterial | "standard");
_resolve_texture does filename-convention + case-insensitive dir scan of
*.dds (face/hair keyword slots, stem match, fallback); set_surface_texture
override; guess_blend heuristic (hair->cutout, cape->alpha, effect->add).
Texture cache. Fixed opaque path to NOT alpha-discard (was hiding bodies).
- harness: AABB-based camera framing, engine depth fog (MTGODOT_FOG=1),
MTGODOT_ANIM_T fixed-pose capture (needs explicit anim reload first),
MTGODOT_AUTOSHOT batch screenshot.
Verified: warrior 5/5 surfaces textured under the shader (t=9 dance pose,
lit, fogged). assassin 17/17 textured via dir scan. shaman_lord (gr2 v7)
renders. Screenshots test/golden/m25-*.png, m2c-t*.png.
Gap (M2.5 gate not closed): libgr2 POD API exposes no material/texture-name/
blend data, so multi-slot -> texture/blend mapping is heuristic only. Needs
a libgr2 material API (gr2_material.cpp walking the type tree) — same gap as
xrender-poc M1 T5. Documented in docs/GODOT-POC-PLAN.md §M2.5 T2.5.6.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WaHYEY9rwLWt21PULiYjeJ
42 lines
1.8 KiB
CMake
42 lines
1.8 KiB
CMake
# mtgodot GDExtension — M0' skeleton (registers Metin2Model, links libgr2).
|
|
|
|
# --- godot-cpp (submodule @ master) ---
|
|
# master has no per-minor branch; it ships bundled extension_api-4-*.json.
|
|
# Pin to 4.7 to match the installed editor (4.7.1; patch-level ABI is compatible).
|
|
set(GODOTCPP_API_VERSION "4.7" CACHE STRING "Target Godot API version" FORCE)
|
|
add_subdirectory(godot-cpp)
|
|
|
|
# --- libgr2 from the sibling xrender-poc repo ---
|
|
# M0': plain sibling-directory reference (both repos live under .../mt/).
|
|
# For a portable checkout, either git-submodule xrender-poc or vendor libgr2,
|
|
# then pass -DXRENDER_POC_DIR=/path/to/xrender-poc.
|
|
set(XRENDER_POC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../xrender-poc"
|
|
CACHE PATH "Path to the xrender-poc repo (provides libgr2)")
|
|
if(NOT EXISTS "${XRENDER_POC_DIR}/libgr2/CMakeLists.txt")
|
|
message(FATAL_ERROR
|
|
"libgr2 not found at '${XRENDER_POC_DIR}/libgr2'. "
|
|
"Pass -DXRENDER_POC_DIR=/path/to/xrender-poc")
|
|
endif()
|
|
add_subdirectory("${XRENDER_POC_DIR}/libgr2" "${CMAKE_CURRENT_BINARY_DIR}/libgr2")
|
|
|
|
# --- the extension shared library ---
|
|
add_library(mtgodot SHARED
|
|
src/register_types.cpp
|
|
src/metin2_model.cpp
|
|
src/metin2_anim.cpp
|
|
src/gr2_bridge.cpp
|
|
src/m2_material.cpp
|
|
src/dxt.cpp
|
|
)
|
|
target_compile_features(mtgodot PRIVATE cxx_std_20)
|
|
target_link_libraries(mtgodot PRIVATE godot::cpp xrender::libgr2)
|
|
|
|
# Drop the dylib straight into the Godot project where the .gdextension expects it:
|
|
# project/bin/libmtgodot.macos.template_debug.dylib (Debug)
|
|
# project/bin/libmtgodot.macos.template_release.dylib (Release)
|
|
set_target_properties(mtgodot PROPERTIES
|
|
PREFIX "lib"
|
|
OUTPUT_NAME "mtgodot.macos.$<IF:$<CONFIG:Release>,template_release,template_debug>"
|
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/project/bin"
|
|
)
|