Kromster80/RecastNavigationDelphi

语言: Pascal

git: https://github.com/Kromster80/RecastNavigationDelphi

重建端口导航到Delphi
Port of Recast Navigation into Delphi
README.md (中文)

RecastNavigation Delphi

重建端口导航到Delphi

源代码位置: https://github.com/memononen/recastnavigation

源代码版本:    2014年11月1日左右

移植指南:   - RecastNavigationDelphi是RecastNavigation的直接克隆,尽可能少的更改,以便在将来保持项目同步。   - 对lib功能的任何更改/改进都应首先包含在C ++ master中,以避免分离。   - RND非常接近RN结构,除了GUI之外,为了简单而不是imGUI RN解决方案,这是VCL。   - 所有文件名都相同,但带有“RN_”前缀。   - 一些单元被拆分以避免循环依赖,它们被称为RN_UnitNameHelper。

关于代码的提示:   - 多条件“for”循环和循环,其中迭代器在循环内被更改,被转换为while / repeat循环。循环代码需要在任何“继续”之前重复。   - 移动方法前两个参数(Src,Dst)需要在Delphi中交换。   - Delphi需要使用{$ O}指令包装溢出操作以抑制错误。   - Delphi需要手动处理记录中创建的对象,因为它们没有内置的析构函数支持。   - 为了简化指针欺骗,必须在每个单元中启用{$ POINTERMATH ON}。   - 键入@运算符设置是很有帮助的,但遗憾的是它有时不起作用。

移植过程中常见的陷阱:   - 传递参数@SomePointer而不是SomePointer。键入@有助于捕获这些,但并非总是如此。   - 调用Move / FillChar方法而不交换参数位置。   - 为...编写循环而不是为... downto ..在极少数情况下。   -

待办事项:   - 修复代码周围的大量内存泄漏。   - TempObstacles演示。   - 某些部件已注释掉,等待移植。   - 与源代码的当前状态同步。

本文使用googletrans自动翻译,仅供参考, 原文来自github.com

en_README.md

RecastNavigationDelphi

Port of Recast Navigation into Delphi

Source code location:
https://github.com/memononen/recastnavigation

Source code version:
Around 01 Nov 2014

Porting guidelines:
- RecastNavigationDelphi is a straight clone of RecastNavigation with as little changes as possible, to allow to keep projects synced in the future.
- Any changes/improvements to the lib functionality should be first included into C++ master to avoid separation.
- RND follows RN structure very closely, except for GUI stuff, which is VCL for simplicity instead of imGUI RN solution.
- All file names are the same, but with an "RN_" prefix.
- Some units were split to avoid circular dependencies, they are called RN_UnitNameHelper.

Hints about the code:
- Multi-condition "for" loops and loops where iterator gets changed inside the loop, were converted to while/repeat loops. Loop code needs to be repeated before any "continue".
- Move method first two arguments (Src, Dst) need to be swapped in Delphi.
- Delphi needs to wrap overflowing manipulations with a {$O} directive to supress errors.
- Delphi needs manual disposal of objects created within record , as they dont have built-in destructor support in them.
- To simplify the pointer trickery, {$POINTERMATH ON} had to be enabled almost in every unit.
- Typed @ operator setting is great help, but sadly it does not work sometimes.

Common pitfalls during porting:
- Passing argument @SomePointer instead of SomePointer. Typed @ helps to catch those, but not always.
- Calling Move/FillChar methods without swapping arguments places.
- Writing for .. to .. do loop instead of for .. downto .. do in rare cases.
-

Todos:
- Fix plethora of memory leaks around the code.
- TempObstacles demo.
- Some parts are commented out, waiting to be ported.
- Sync with current state of the source code.