port/common: platform-independent D3DX8 math layer

D3DXVECTOR2/3/4, D3DXMATRIX, D3DXQUATERNION, D3DXPLANE, D3DXCOLOR with
d3dx8math.inl operator semantics, plus the D3DX* functions the 2V3 slice
logic uses. Covered by port.common; port_gate passes on macOS, Android,
iOS and Windows (mingw).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-22 20:02:15 +09:00
co-authored by Claude Opus 5
parent 2bae8d7644
commit 0f2eee0b24
4 changed files with 775 additions and 1 deletions
+9 -1
View File
@@ -126,7 +126,15 @@ extension/third_party/cpython-2.7.18/ # 静态库(2P 批次
单独构建;每个 `port/**.h` 独立编译两次的门禁 `port_header_gate`;`port.common` 测试。编译宏取 40250 发布版
`Metin2Distribute.exe` 的 `Distribute|Win32` 配置:所有库 `NDEBUG`,GameLib 加 `USE_LOD`,UserInterface 加
`USE_LOD;_DISTRIBUTE`;不定义 `WIN32`。
- 未完成:D3DX 数学层、闭包头文件照抄(步骤 2)、platform 接口骨架(步骤 4)。
- 已完成:D3DX 数学层 `port/common/D3DXMath.{h,cpp}`。内容包括:
- 基础结构 `D3DVECTOR`/`D3DCOLORVALUE`/`D3DMATRIX`;
- 类型 `D3DXVECTOR2/3/4`、`D3DXMATRIX`、`D3DXQUATERNION`、`D3DXPLANE`、`D3DXCOLOR`,运算符照 `d3dx8math.inl`
(例如 `v / f` 实现为乘以 `1/f`);
- 2V3 切片用到的 `D3DXVec*`、`D3DXMatrix*`、`D3DXQuaternion*` 函数,采用行向量、左手旋转、D3DX 的乘法顺序;
后续单元用到新函数时再按需补。
这一层不包含 D3D8 渲染枚举和结构(`D3DLIGHT8`、`D3DRS_*` 等),它们归 platform 层。测试在 `port.common` 里。
- 未完成:闭包头文件照抄(步骤 2)、platform 接口骨架(步骤 4)。
| 平台 | port_gate |
| --- | --- |