Fix tree rendering and authored collision, add FPS display and packaging safeguards

This commit is contained in:
shen
2026-10-14 19:16:39 -07:00
parent b3808d8d0c
commit 3166b61321
35 changed files with 31336 additions and 49 deletions
+14 -3
View File
@@ -78,6 +78,9 @@ class Stage:
def add(self, rel, source): def add(self, rel, source):
key = str(rel).lower() key = str(rel).lower()
# Saved accounts are user data, never part of a development asset install.
if key == "lib/wa_ac.py":
return
old = self.files.pop(key, None) old = self.files.pop(key, None)
if old is not None: if old is not None:
old.unlink() old.unlink()
@@ -91,13 +94,21 @@ class Stage:
def walk(top, pack_maker, missing): def walk(top, pack_maker, missing):
"""Yields (relative path, real file) under top, following and remapping symlinks.""" """Yields (relative path, real file) under top, following and remapping symlinks."""
stack = [(Path(top), Path())] stack = [(Path(top), Path(), frozenset())]
while stack: while stack:
directory, rel = stack.pop() directory, rel, ancestors = stack.pop()
identity = directory.resolve()
if identity in ancestors:
continue
ancestors = ancestors | {identity}
for entry in sorted(os.scandir(directory), key=lambda e: e.name): for entry in sorted(os.scandir(directory), key=lambda e: e.name):
path, child = Path(entry.path), rel / entry.name path, child = Path(entry.path), rel / entry.name
if entry.name == ".DS_Store": if entry.name == ".DS_Store":
continue continue
# This local convenience link points to the entire decoded pack tree;
# its runtime files are already supplied by the flattened rundir.
if Path(top) == ROOT / "upstream/python-root" and child == Path("pack_maker"):
continue
if entry.is_symlink() and not path.exists(): if entry.is_symlink() and not path.exists():
link = os.readlink(path) link = os.readlink(path)
mark = link.find(PACK_MAKER_MARK) mark = link.find(PACK_MAKER_MARK)
@@ -108,7 +119,7 @@ def walk(top, pack_maker, missing):
continue continue
path = remapped path = remapped
if path.is_dir(): if path.is_dir():
stack.append((path, child)) stack.append((path, child, ancestors))
elif path.is_file(): elif path.is_file():
yield child, path yield child, path
+34
View File
@@ -1931,3 +1931,37 @@ UpdateGame 更新阶段建立缓存,渲染阶段尾迹读取该快照。相机
参考 d2r-mobile 的交互思路,移除闲置固定摇杆,真实落点与绘制中心分离,补齐技能独立多指归属、拖动方向提示、按住遵守冷却重试、最近敌人选择、完整快捷按钮热区及物品拖拽抬高。增加 NPC/入口和掉落物热区、接近交互、失焦取消与实例/物品 generation 防复用。保留原版双击/长按物品面板及报文,新增真实 HUD、库存和目标/技能/NPC 字节测试。详见 [移动交互调整](MOBILE-INTERACTION-2026-10-13.md)。真机多指、精确模型点击体、完整寻路和技能范围预览仍待验证/实现。 参考 d2r-mobile 的交互思路,移除闲置固定摇杆,真实落点与绘制中心分离,补齐技能独立多指归属、拖动方向提示、按住遵守冷却重试、最近敌人选择、完整快捷按钮热区及物品拖拽抬高。增加 NPC/入口和掉落物热区、接近交互、失焦取消与实例/物品 generation 防复用。保留原版双击/长按物品面板及报文,新增真实 HUD、库存和目标/技能/NPC 字节测试。详见 [移动交互调整](MOBILE-INTERACTION-2026-10-13.md)。真机多指、精确模型点击体、完整寻路和技能范围预览仍待验证/实现。
本批最终验证:完整构建成功,62/62 CTest(63.67 秒),移动专项 4/4,严格 ASan/UBSan 4/4(19.86 秒),无执行路径诊断。Python C 代码未全部同等插桩。方法/协议审计及 git diff --check 通过。SDK/参考/服务器未修改,尚未提交或推送。 本批最终验证:完整构建成功,62/62 CTest(63.67 秒),移动专项 4/4,严格 ASan/UBSan 4/4(19.86 秒),无执行路径诊断。Python C 代码未全部同等插桩。方法/协议审计及 git diff --check 通过。SDK/参考/服务器未修改,尚未提交或推送。
### 2026-10-14 树木:包围裁剪、透明测试、静态网格与资源碰撞
改为实际 min/max 包围及整树冠距离裁剪;默认树干/frond 使用共享静态流和实例 world 矩阵,材质路径模板缓存,叶片仍按相机/摇摆更新。接通原版森林/实例/环境风强生命周期并移除 ×0.05;修复树干 alpha=84 GREATER、软件 alpha reference 0/调制时序/浮点边界。接通 authored 球/圆柱到角色 BODY 与飞行物查询,保留忽略 box 和平移规则,防高速完整跨越;生命周期删除和真实 SPT 加载失败不产生假树。485 个当前真实 SPT 两次全 LOD 快照一致且无截断。详见 [树木修复记录](TREE-RENDERING-2026-10-14.md)。原 DLL 数值、GPU 叶片/风 shader、真机性能和完整球体响应仍待对齐。
验证:62/62 完整 CTest(48.61 秒)、专项 6/6、严格 ASan/UBSan 5/5(4.07 秒)通过,包含实际 GPU 回读;方法/协议与 diff 检查通过。资源审计额外确认 280 个文件在 token 22000 处停止扩展解析,不能将无截断视为元数据完整;客户端已记录诊断,未知扩展继续保留为明确待办。SDK/参考/服务器未修改,尚未提交/推送。
### 2026-10-14 — Game FPS display and movement altitude check
Added an always-visible, non-interactive FPS badge at the safe top centre of the game screen. It counts completed SDL presentations over half-second windows (including pacing/render cost), resets on phase transitions and foreground resume, and remains hidden outside the game. It does not use the existing app.GetRenderFPS stub, which currently returns the requested rate.
Corrected MapObjectManager movement collision to test actor BODY sphere altitude against the 3D mesh OBB instead of an infinitely tall 2D footprint. Added real-model regression checks for solid obstruction, passage above/below geometry and ActorInstance walking above an object. Added rate-limited device logs for attempted movement that produces no displacement, including map, position, next position and terrain block flag.
Verified: desktop and Android builds; 4/4 focused CTests (player_motion, touch_game, flying_target, speedtree_forest); capped desktop 10 FPS measured 10.0 and displayed 10; desktop 30 FPS cap under scene load measured 16.4 and displayed 17; physical PJZ110 Android preview displayed 10 at a 10 FPS cap. Updated APK installed with existing data retained, then restored normal login launch. Evidence: build/verification/fps-movement-2026-10-14/.
Remaining: the user's specific blocked region still needs a live retest after login; this change alone does not prove its cause. Static objects still use mesh OBB proxies rather than original authored .mdatr primitives, which can incorrectly cover openings. The original Python FPS getters and app.SetFPS host integration remain separate parity gaps.
### 2026-10-14 — Reported town gate falsely sealed by mesh OBB
Live device logs pinpointed the continuing movement obstruction to metin2_map_a1 near (66041.5, 71337.5), with terrainBlock=0. The corresponding a1-middledam-01.gr2 instance at (66907.429688, 19664.039063, 72199.484375), yaw 30 degrees, has six authored planes in its companion .mdatr. The former whole-mesh OBB incorrectly seals its doorway.
MapObjectManager now reads validated little-endian AttributeData plane sets, transforms quaternion axes and centres with the same (x,z,-y) basis and object transform as the rendered model, and uses source plane crossing/radius/rectangle tests for movement and flying collision. Movement permits escape from a plane overlap. Broad-phase candidates include authored plane extents. Valid empty attributes suppress dummy collision; missing, truncated or mixed/non-plane files retain the existing OBB fallback.
Verified with the reported real gate and coordinates: the old 2D footprint intersects the doorway; the authored-plane movement test clears it; ActorInstance moves 2000 units through the entire opening; all six wall planes still block approaching spheres and allow escape. Empty/truncated attribute and above/below-OBB regressions pass. Desktop/Android builds and 4/4 focused CTests passed. APK: build/verification/fps-movement-2026-10-14/ava2-gate-fix.apk.
Deployment pending: USB disconnected before this gate-fix APK could install. The phone currently has the earlier FPS/3D-altitude fix. Reconnect and install gate-fix APK, then verify the reported passage on the live device. Remaining parity gaps: authored non-plane .mdatr primitives and height meshes, mesh-proxy camera/2D collision queries, original Python FPS getter values.
### 2026-10-14 — Mac test package and gate-fix device installation
After USB reconnection, installed the gate-fix Android APK successfully with adb install --user 0 -r (application data retained). Live passage/movement retest remains separate; the user reports additional running issues and requested a Mac package first.
Built the current workspace as macOS arm64 RelWithDebInfo and packaged full game resources into dist/AVA2.app, with dist/AVA2-macOS-arm64.tar.gz for transfer. Bundled/relocated all non-system dylibs and applied ad-hoc signatures for local testing. Verified strict deep codesign, all 88,052 asset-manifest hashes, internal bundle links, and inclusion of the reported gate .mdatr. Isolated-data packaged executable checks exited successfully in normal login (45 frames) and game preview (35 frames); opened the normal application for manual login and gameplay testing. Evidence: build/verification/macos-package-2026-10-14/.
Packager now excludes saved-account lib/wa_ac.py and optional no.py auto-login overrides from both manifest and adapted-script layers, preventing host user state from entering the test package; packaging regression passed. This is a local Apple Silicon test build, not a notarized release. Live running/animation correctness is still under investigation.
+37
View File
@@ -0,0 +1,37 @@
# 树木渲染与碰撞修复 — 2026-10-14
本批在 `b3808d8d` 之后修改客户端,参考本地 AVA2 `SpeedTreeForestDirectX8.cpp`、`SpeedTreeWrapper.cpp`、`SpeedTreeForest.cpp`、`GameLib/MapUtil.cpp / MapOutdoor.cpp` 和 `EterLib/CollisionData.cpp`。SDK、Windows 参考和服务器未修改。
## 修改位置
- `src/eter_render/SpeedTreeRT.h/.cpp`:使用 SDK 实际 min/max(包含 authored 叶卡旋转余量)计算实例包围球中心、半径,支持当前场景 yaw/scale。默认无风模式允许共享静态树干/frond 顶点、法线、索引、UV 与 diffuse;通过实例 world 矩阵定位,叶片仍按相机及摇摆更新。模板只解析一次材质路径,减少每实例每帧的文件检查。树干与叶片/frond 均使用原版 GREATER / alpha=84,不再把树干当作没有透明测试的完全不透明网格。
- `src/eter_render/SpeedTreeForest.h/.cpp`:视锥使用实际包围中心,距离裁剪只剔除整棵树冠都在距离之外的实例;CPU 风力选项用以原点为中心的保守球涵盖加权旋转。森林与实例分别维护风状态,取消未经原版定义的 ×0.05 换算。森林初始强度 0,实例 LoadTree 初始强度 1;不同环境强度更新现有实例,并保持叶片相位连续;相同强度 setter 不重复更新之后新建的实例,保留原版生命周期规则。
- 同文件:新增 SPT 球体及有限圆柱的连续碰撞。使用 source XYZ→当前 engine XZY 和实例平移,按 Wrapper 的规则不额外旋转/缩放碰撞图元;CO_BOX 忽略。球相切使用严格 `<`,圆柱使用 `<=`,保留圆柱高度筛选。移动允许退出重叠,并补充两端在外的完整跨越检测,防止帧间跨过树干;飞行物使用无退出豁免的检测。无 authored 碰撞数据时不虚构树干障碍。
- 同文件:真实资源加载失败不再伪装成程序化树;直接给定 `.spt` 名称时实际加载文件并使用 authored size,而不是按文件名生成无关树。仅没有真实资源声明的预览调用继续支持程序化树;拒绝非有限实例位置/yaw。
- `SpeedTreeRT.cpp` 在模板加载时明确报告未完整解析的 token,保留 SDK 已恢复的元数据和 `metadata_complete=false` 状态,不通过跳过未知字节伪装为完整解析。
- `src/eter_render/MapObjectManager.h/.cpp`:关联森林并用 weak lifetime 防止析构后访问;将树碰撞接到三维移动与飞行物查询。AreaData 的树加载失败不计为成功实例。
- `src/eter_render/ActorInstance.cpp`:实际移动使用 BODY 球扫掠检测树木,缺少 BODY 的模型保留当前半径 30 的备用探针;点地移动最后一步也检测树木。原有建筑/地形及滑动路径继续使用。
- `src/eter_render/EnvironmentData.h`、`src/scripting/python_background.cpp`:接通原版环境默认强度 0.2、森林初始化和环境切换;地图没有环境文件也能取得默认环境强度。
- `src/eter_render/Gr2ModelRenderer.cpp`:软件 alpha test 改为纹理/顶点/材质 alpha 调制之后的 GREATER;reference 0 不再替换为 70;使用差值式插值,避免恒定 alpha=84 因浮点权重和误差变成略大于 84,和现有 GPU 管线统一。
- `tests/speedtree_forest_test.cpp`:网格包围、yaw/scale 世界变换、部分树冠可见、130 实例共享一份树干流、CPU 模式切换、风强及相位连续、新实例与同值 setter、真实名称加载/失败、球/圆柱/忽略 box、高度/相切/高速跨越/退出重叠、角色阻挡、删除/析构后的查询。
- `tests/background_test.cpp`:默认环境风强接通及原有帧步长回归。
- `tests/flying_target_test.cpp`:软件透明阈值等于/大于 84、reference 0、透明片元不写深度、材质 alpha 调制之后再判断。
- `tests/hardware_scene_test.cpp`:实际 GPU 像素回读核对纹理 alpha 84/85/0/1 的颜色与深度遮挡边界。
## 资源与验证
日志位于 `build/verification/tree-rendering-2026-10-14/`。使用 `generation_baseline` 对当前真实资源目录的 485 个 SPT 跑两次快照,包含所有 LOD 的顶点、索引、几何/pivot hash、包围范围、节点数和限制状态;两次几何与包围结果无变化,均无截断。这证明当前恢复实现的可重复性与本资源集的完整生成,不能证明与 Windows DLL 随机序列或树形等价。
额外元数据审计:205 个完全解析,280 个报告未知扩展 token 22000(已有 REVERSE-ENGINEERING 中的待办)。这些文件的已知主数据可生成几何,但 22000 及后续扩展没有恢复;生成无截断不能掩盖这一缺口。详见 `metadata-summary.log` 与 `incomplete-metadata.jsonl`。
共享树干流测试直接核对世界变换后顶点与原展开路径一致,以及 130 个实例复用相同几何指针;不把此结果当作手机 FPS 或耗电测量。
最终验证:完整构建通过;专项 6/6(6.82 秒);完整 CTest 62/62(48.61 秒);严格 ASan/UBSan 5/5(4.07 秒),含实际执行的 GPU alpha 像素回读,无跳过或执行路径诊断。Python C 代码未全部同等插桩。46 模块方法无缺失/占位,395 映射协议常量无不匹配/未匹配,git diff --check 通过。
## 剩余边界
完整树形/随机调用分布、叶片摆幅/绝对首帧时间、原 DLL 输出尚未动态对齐。本批维持原版全几何 LOD 行为,没有启用会改变画面的自动降级。当前共享静态几何能交给原有 SDL_GPU resident/实例管线;专用叶片 GPU placement/风力 shader 尚未接入,叶片仍由 CPU 更新。密集森林真机 FPS、CPU/GPU 时间和耗电仍待测量。
碰撞数据来自资源元数据,requested tree size 对原 DLL 返回图元的内部缩放仍缺少动态证据;本批按 Wrapper 可见的平移规则实现。自定义 yaw/scale 的画面与 source 不旋转/缩放图元规则可能不同,不能宣称这些扩展变换的碰撞完全贴合。完整动态球推开/滑动响应、矿石交互、空间 culling 候选顺序及不在本资源集内的资产仍待对照;缺少 BODY 时的探针是当前移植的备用方案。
以上改动未提交或推送;设备与原版实机画面对照尚未完成。
+2
View File
@@ -1,5 +1,7 @@
# AVA2 Windows 逐模块对照与修复 — 2026-10-13 # AVA2 Windows 逐模块对照与修复 — 2026-10-13
> 2026-10-14 树木后续:[树木渲染与碰撞](TREE-RENDERING-2026-10-14.md)。实际包围/整树冠距离、共享静态几何、树干/软件透明边界、环境风强和球/圆柱碰撞已接通;旧记录中的 ×0.05 和未接树碰撞状态为历史状态。原 DLL 随机/摆幅、GPU 叶片和真机性能仍待验证。
> 最新状态进展:[第二十批视锥缓存与尾迹深度](WINDOWS-TAIL-STATE-2026-10-13.md)。更新阶段缓存、正交/偏轴粗球元数据及 LESS/继承深度写入已接通,并加入 GPU 像素回读;Windows 浮点逐位与全局相机切换仍待动态对照。以下旧记录保留各批当时状态。 > 最新状态进展:[第二十批视锥缓存与尾迹深度](WINDOWS-TAIL-STATE-2026-10-13.md)。更新阶段缓存、正交/偏轴粗球元数据及 LESS/继承深度写入已接通,并加入 GPU 像素回读;Windows 浮点逐位与全局相机切换仍待动态对照。以下旧记录保留各批当时状态。
> 最新裁剪进展:[第十九批尾迹逐段视锥裁剪](WINDOWS-TAIL-FRUSTUM-2026-10-13.md)。六平面、线段球和标准透视粗球已接通,并保留原版 FOV 单位混用;全局缓存时序、非标准投影粗球及 GPU 深度继承仍待对照。 > 最新裁剪进展:[第十九批尾迹逐段视锥裁剪](WINDOWS-TAIL-FRUSTUM-2026-10-13.md)。六平面、线段球和标准透视粗球已接通,并保留原版 FOV 单位混用;全局缓存时序、非标准投影粗球及 GPU 深度继承仍待对照。
+1 -1
View File
@@ -133,7 +133,7 @@
}, },
{ {
"file": "src/scripting/python_background.cpp", "file": "src/scripting/python_background.cpp",
"line": 1019, "line": 1024,
"api": "RenderDungeon", "api": "RenderDungeon",
"handler": "background_RenderDungeon", "handler": "background_RenderDungeon",
"status": "constant-return candidate; compare original behavior before treating as a defect" "status": "constant-return candidate; compare original behavior before treating as a defect"
+62
View File
@@ -1305,6 +1305,11 @@ ava2::app::AppLoop::Frame RunClient(ava2::app::AppLoop* loop, int argc, char** a
bool chat_input_active = false; bool chat_input_active = false;
std::string chat_input_buffer; std::string chat_input_buffer;
auto prev_frame_time = std::chrono::steady_clock::now(); auto prev_frame_time = std::chrono::steady_clock::now();
auto fps_sample_start = prev_frame_time;
unsigned fps_sample_frames = 0;
int measured_fps = -1;
bool fps_sample_started = false;
std::string fps_phase;
auto cap_period = fps_cap > 0 ? std::chrono::nanoseconds(1'000'000'000LL / fps_cap) auto cap_period = fps_cap > 0 ? std::chrono::nanoseconds(1'000'000'000LL / fps_cap)
: std::chrono::nanoseconds(0); : std::chrono::nanoseconds(0);
@@ -1846,6 +1851,8 @@ const auto profileActiveStart = std::chrono::steady_clock::now();
ava2::SoundManager::Instance().SetPaused(false); ava2::SoundManager::Instance().SetPaused(false);
// The first foreground frame must not see the whole pause as one frame. // The first foreground frame must not see the whole pause as one frame.
prev_frame_time = std::chrono::steady_clock::now(); prev_frame_time = std::chrono::steady_clock::now();
fps_sample_started = false;
measured_fps = -1;
break; break;
default: break; default: break;
} }
@@ -2198,7 +2205,22 @@ const auto profileActiveStart = std::chrono::steady_clock::now();
actor.SetSpeed(340.0f * actor.GetMoveAnimationSpeed()); actor.SetSpeed(340.0f * actor.GetMoveAnimationSpeed());
if (keyboardMoving) { if (keyboardMoving) {
actor.ClearMoveTarget(); actor.ClearMoveTarget();
const float previousX = actor.GetX(), previousZ = actor.GetZ();
actor.MoveInDirection(moveYaw, dt, active_terrain, active_map_objects); actor.MoveInDirection(moveYaw, dt, active_terrain, active_map_objects);
if (dt > 0 && std::hypot(actor.GetX()-previousX,actor.GetZ()-previousZ) < 0.001f) {
// Keep a bounded diagnostic for invisible-obstacle reports on devices.
static auto lastBlockedLog = std::chrono::steady_clock::time_point{};
const auto now = std::chrono::steady_clock::now();
if (now-lastBlockedLog >= std::chrono::seconds(1)) {
const float angle = moveYaw * 3.14159265358979323846f / 180.0f;
const float nextX = previousX + std::sin(angle)*340.0f*actor.GetMoveAnimationSpeed()*dt;
const float nextZ = previousZ + std::cos(angle)*340.0f*actor.GetMoveAnimationSpeed()*dt;
SDL_Log("Movement blocked: map=%s position=(%.1f,%.1f,%.1f) next=(%.1f,%.1f) terrainBlock=%d",
ava2::CPythonBackground::Instance().GetCurrentMapName().c_str(),previousX,actor.GetY(),previousZ,nextX,nextZ,
active_terrain && active_terrain->IsAttrOn(nextX,nextZ,ava2::TerrainHeightmap::ATTR_FLAG_BLOCK));
lastBlockedLog = now;
}
}
} else { } else {
if (wasKeyboardMoving) actor.StopMoving(); if (wasKeyboardMoving) actor.StopMoving();
if (actor.CanAct() && !attacking && ava2::IsPlayerMouseMoving() && renderer3d && active_terrain) { if (actor.CanAct() && !attacking && ava2::IsPlayerMouseMoving() && renderer3d && active_terrain) {
@@ -2647,6 +2669,31 @@ const auto profileActiveStart = std::chrono::steady_clock::now();
} }
#endif #endif
if (fps_phase != last_phase) {
fps_phase = last_phase;
fps_sample_started = false;
measured_fps = -1;
}
if (last_phase == "game") {
// Always visible, independent of the original debug-info toggle. Native
// drawing leaves touch hit testing unchanged and survives HUD rebuilds.
const auto safe = ava2::platform::QuerySafeInsets(window.get(), renderer.get());
const std::string label = measured_fps < 0 ? "FPS: --" : "FPS: " + std::to_string(measured_fps);
constexpr float scale = 1.5f;
const float width = float(label.size()) * 8.0f * scale;
const float x = safe.left + (float(screen_width) - safe.left - safe.right - width) * 0.5f;
const float y = safe.top + 8.0f;
SDL_BlendMode oldBlend;
SDL_GetRenderDrawBlendMode(renderer.get(), &oldBlend);
SDL_SetRenderDrawBlendMode(renderer.get(), SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(renderer.get(), 0, 0, 0, 160);
const SDL_FRect backing{x - 6.0f, y - 4.0f, width + 12.0f, 20.0f};
SDL_RenderFillRect(renderer.get(), &backing);
SDL_SetRenderDrawColor(renderer.get(), 255, 255, 255, 255);
text(renderer.get(), x, y, label, scale);
SDL_SetRenderDrawBlendMode(renderer.get(), oldBlend);
}
bool finished = frame_limit && (frames + 1 == frame_limit); bool finished = frame_limit && (frames + 1 == frame_limit);
#ifdef AVA2_HAS_PYTHON #ifdef AVA2_HAS_PYTHON
if (view_script.empty()) { if (view_script.empty()) {
@@ -2687,6 +2734,21 @@ const auto profileActiveStart = std::chrono::steady_clock::now();
} }
const auto profilePresentStart = std::chrono::steady_clock::now(); const auto profilePresentStart = std::chrono::steady_clock::now();
if (!SDL_RenderPresent(renderer.get())) throw std::runtime_error(SDL_GetError()); if (!SDL_RenderPresent(renderer.get())) throw std::runtime_error(SDL_GetError());
const auto presented_at = std::chrono::steady_clock::now();
if (!fps_sample_started) {
fps_sample_start = presented_at;
fps_sample_frames = 0;
fps_sample_started = true;
} else {
++fps_sample_frames;
const double elapsed = std::chrono::duration<double>(presented_at - fps_sample_start).count();
if (elapsed >= 0.5) {
// Count completed presentations, including pacing and rendering cost.
measured_fps = int(std::lround(double(fps_sample_frames) / elapsed));
fps_sample_start = presented_at;
fps_sample_frames = 0;
}
}
if (until_game && last_phase == "game" && rendered_game_frames % 20 == 0) if (until_game && last_phase == "game" && rendered_game_frames % 20 == 0)
SDL_Log("Frame profile total=%.2f build=%.2f raster=%.2f active=%.2f present=%.2f ms", SDL_Log("Frame profile total=%.2f build=%.2f raster=%.2f active=%.2f present=%.2f ms",
std::chrono::duration<double, std::milli>(std::chrono::steady_clock::now()-profileFrameStart).count(), profileBuildMs, profileRasterMs, std::chrono::duration<double, std::milli>(std::chrono::steady_clock::now()-profileFrameStart).count(), profileBuildMs, profileRasterMs,
+13 -3
View File
@@ -758,8 +758,15 @@ void ActorInstance::MoveInDirection(float moveYaw, float dt, const TerrainHeight
if (terrain && terrain->HasAttrMap() && terrain->IsAttrOn(testX, testZ, TerrainHeightmap::ATTR_FLAG_BLOCK)) { if (terrain && terrain->HasAttrMap() && terrain->IsAttrOn(testX, testZ, TerrainHeightmap::ATTR_FLAG_BLOCK)) {
return true; return true;
} }
if (mapObjects && mapObjects->CheckCollision(testX, testZ, 30.0f)) { if(mapObjects) {
return true; const auto body=GetBodyCollisionSpheres();
if(body.empty()) {
const float start[3]={m_posX,m_posY+30,m_posZ},end[3]={testX,m_posY+30,testZ};
if(mapObjects->CheckMovementCollision(start,end,30))return true;
} else for(const auto& sphere:body) {
const float end[3]={sphere.position[0]+testX-m_posX,sphere.position[1],sphere.position[2]+testZ-m_posZ};
if(mapObjects->CheckMovementCollision(sphere.position.data(),end,sphere.radius))return true;
}
} }
return false; return false;
}; };
@@ -825,7 +832,10 @@ void ActorInstance::Update(float dt, const TerrainHeightSource* terrain, const M
if (dist <= 15.0f || dist <= step) { if (dist <= 15.0f || dist <= step) {
bool blocked = false; bool blocked = false;
if (terrain && terrain->HasAttrMap() && terrain->IsAttrOn(m_targetX, m_targetZ, TerrainHeightmap::ATTR_FLAG_BLOCK)) blocked = true; if (terrain && terrain->HasAttrMap() && terrain->IsAttrOn(m_targetX, m_targetZ, TerrainHeightmap::ATTR_FLAG_BLOCK)) blocked = true;
if (mapObjects && mapObjects->CheckCollision(m_targetX, m_targetZ, 30.0f)) blocked = true; if(mapObjects) {
const float start[3]={m_posX,m_posY+30,m_posZ},end[3]={m_targetX,m_posY+30,m_targetZ};
if(mapObjects->CheckMovementCollision(start,end,30))blocked=true;
}
if (!blocked) { if (!blocked) {
m_posX = m_targetX; m_posX = m_targetX;
m_posZ = m_targetZ; m_posZ = m_targetZ;
+1
View File
@@ -71,6 +71,7 @@ struct LensFlareData {
struct EnvironmentData { struct EnvironmentData {
std::string name; std::string name;
float wind_strength = 0.2f; // AVA2 MapUtil.cpp Environment_Init default.
bool reserve = false; // MapUtil.cpp Environment_Load "reserved" (bReserve) bool reserve = false; // MapUtil.cpp Environment_Load "reserved" (bReserve)
DirectionalLight dir_light; DirectionalLight dir_light;
MaterialData material; MaterialData material;
+4 -6
View File
@@ -602,10 +602,6 @@ void Gr2SceneRenderer::RenderDraw(SDL_Surface* targetSurface, const Render3DDraw
int tex_idx = (ty * diffuse_tex->width + tx) * 4; int tex_idx = (ty * diffuse_tex->width + tx) * 4;
uint8_t ta = diffuse_tex->rgba[tex_idx + 3]; uint8_t ta = diffuse_tex->rgba[tex_idx + 3];
if (draw.alpha_test) {
uint32_t aref = draw.alpha_ref ? draw.alpha_ref : 70;
if (ta < aref) continue;
}
pr = diffuse_tex->rgba[tex_idx + 0]; pr = diffuse_tex->rgba[tex_idx + 0];
pg = diffuse_tex->rgba[tex_idx + 1]; pg = diffuse_tex->rgba[tex_idx + 1];
@@ -617,7 +613,7 @@ void Gr2SceneRenderer::RenderDraw(SDL_Surface* targetSurface, const Render3DDraw
float vr = (b0 * ((d0 >> 16) & 0xFF) + b1 * ((d1 >> 16) & 0xFF) + b2 * ((d2 >> 16) & 0xFF)) / 255.0f; float vr = (b0 * ((d0 >> 16) & 0xFF) + b1 * ((d1 >> 16) & 0xFF) + b2 * ((d2 >> 16) & 0xFF)) / 255.0f;
float vg = (b0 * ((d0 >> 8) & 0xFF) + b1 * ((d1 >> 8) & 0xFF) + b2 * ((d2 >> 8) & 0xFF)) / 255.0f; float vg = (b0 * ((d0 >> 8) & 0xFF) + b1 * ((d1 >> 8) & 0xFF) + b2 * ((d2 >> 8) & 0xFF)) / 255.0f;
float vb = (b0 * (d0 & 0xFF) + b1 * (d1 & 0xFF) + b2 * (d2 & 0xFF)) / 255.0f; float vb = (b0 * (d0 & 0xFF) + b1 * (d1 & 0xFF) + b2 * (d2 & 0xFF)) / 255.0f;
float va = (b0 * ((d0 >> 24) & 0xFF) + b1 * ((d1 >> 24) & 0xFF) + b2 * ((d2 >> 24) & 0xFF)) / 255.0f; float va = (float((d0 >> 24) & 0xFF) + b1 * (int((d1 >> 24) & 0xFF)-int((d0 >> 24) & 0xFF)) + b2 * (int((d2 >> 24) & 0xFF)-int((d0 >> 24) & 0xFF))) / 255.0f;
if (draw.lighting) { if (draw.lighting) {
// D3D8 fixed-function: Emissive + MatAmb*LightAmb + Diffuse*LightDiff*N.L. // D3D8 fixed-function: Emissive + MatAmb*LightAmb + Diffuse*LightDiff*N.L.
float lr = std::clamp(draw.material_emissive[0] + draw.material_ambient[0] * draw.light_ambient[0] + vr * draw.light_diffuse[0] * ndotl, 0.0f, 1.0f); float lr = std::clamp(draw.material_emissive[0] + draw.material_ambient[0] * draw.light_ambient[0] + vr * draw.light_diffuse[0] * ndotl, 0.0f, 1.0f);
@@ -638,7 +634,7 @@ void Gr2SceneRenderer::RenderDraw(SDL_Surface* targetSurface, const Render3DDraw
pr = b0 * ((d0 >> 16) & 0xFF) + b1 * ((d1 >> 16) & 0xFF) + b2 * ((d2 >> 16) & 0xFF); pr = b0 * ((d0 >> 16) & 0xFF) + b1 * ((d1 >> 16) & 0xFF) + b2 * ((d2 >> 16) & 0xFF);
pg = b0 * ((d0 >> 8) & 0xFF) + b1 * ((d1 >> 8) & 0xFF) + b2 * ((d2 >> 8) & 0xFF); pg = b0 * ((d0 >> 8) & 0xFF) + b1 * ((d1 >> 8) & 0xFF) + b2 * ((d2 >> 8) & 0xFF);
pb = b0 * (d0 & 0xFF) + b1 * (d1 & 0xFF) + b2 * (d2 & 0xFF); pb = b0 * (d0 & 0xFF) + b1 * (d1 & 0xFF) + b2 * (d2 & 0xFF);
frag_alpha = b0 * ((d0 >> 24) & 0xFF) + b1 * ((d1 >> 24) & 0xFF) + b2 * ((d2 >> 24) & 0xFF); frag_alpha = float((d0 >> 24) & 0xFF) + b1 * (int((d1 >> 24) & 0xFF)-int((d0 >> 24) & 0xFF)) + b2 * (int((d2 >> 24) & 0xFF)-int((d0 >> 24) & 0xFF));
if (draw.lighting) { if (draw.lighting) {
pr = 255.0f * std::clamp(draw.material_emissive[0] + draw.material_ambient[0] * draw.light_ambient[0] + pr / 255.0f * draw.light_diffuse[0] * ndotl, 0.0f, 1.0f); pr = 255.0f * std::clamp(draw.material_emissive[0] + draw.material_ambient[0] * draw.light_ambient[0] + pr / 255.0f * draw.light_diffuse[0] * ndotl, 0.0f, 1.0f);
pg = 255.0f * std::clamp(draw.material_emissive[1] + draw.material_ambient[1] * draw.light_ambient[1] + pg / 255.0f * draw.light_diffuse[1] * ndotl, 0.0f, 1.0f); pg = 255.0f * std::clamp(draw.material_emissive[1] + draw.material_ambient[1] * draw.light_ambient[1] + pg / 255.0f * draw.light_diffuse[1] * ndotl, 0.0f, 1.0f);
@@ -659,6 +655,8 @@ void Gr2SceneRenderer::RenderDraw(SDL_Surface* targetSurface, const Render3DDraw
pb = (1.0f - fog_factor) * fog_b + fog_factor * pb; pb = (1.0f - fog_factor) * fog_b + fog_factor * pb;
} }
if(!mesh.diffuse.empty())frag_alpha*=std::clamp(draw.material_diffuse[3],0.f,1.f);
if(draw.alpha_test && frag_alpha<=float(draw.alpha_ref))continue;
bool is_blended = draw.alpha_blend || (draw.blend_mode != 0) || (!diffuse_tex && frag_alpha < 250.0f); bool is_blended = draw.alpha_blend || (draw.blend_mode != 0) || (!diffuse_tex && frag_alpha < 250.0f);
if (is_blended) { if (is_blended) {
uint32_t bg = dst_pixels[py * dst_pitch_pixels + px]; uint32_t bg = dst_pixels[py * dst_pitch_pixels + px];
+105 -6
View File
@@ -7,6 +7,7 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <cstring>
namespace ava2 { namespace ava2 {
@@ -48,6 +49,75 @@ inline void MakeFullTransformMatrix(float yawDeg, float pitchDeg, float rollDeg,
} // namespace } // namespace
bool MapCollisionPlane::Intersects(const float* start,const float* end,float radius,bool movement) const {
float before=0,after=0,u=0,v=0;
for(int k=0;k<3;++k) {
before+=(start[k]-center[k])*normal[k];after+=(end[k]-center[k])*normal[k];
u+=(end[k]-center[k])*axisU[k];v+=(end[k]-center[k])*axisV[k];
}
// EterLib/CollisionData.cpp CPlaneCollisionInstance: endpoint rectangle,
// plane crossing/radius band, and approaching-only movement (permits escape).
const bool crossing=(before<0 && after>0)||(before>0 && after<0);
return (crossing || std::abs(after)<=radius) && std::abs(u)<halfWidth+radius && std::abs(v)<halfHeight+radius
&& (!movement || std::abs(after)<std::abs(before));
}
bool MapObjectManager::LoadAuthoredPlanes(MapObjectInstance& obj) {
auto path=std::filesystem::path(MapObjectManager::NormalizePath(obj.model_path));
path.replace_extension(".mdatr");
std::ifstream file(path,std::ios::binary);
if(!file)return false;
const std::vector<char> bytes{std::istreambuf_iterator<char>(file),{}};
if(bytes.size()<22 || std::memcmp(bytes.data(),"AttributeData\0",14)!=0)return false;
size_t cursor=14;
auto read32=[&](uint32_t& value) {
if(bytes.size()-cursor<4)return false;
const auto* p=reinterpret_cast<const unsigned char*>(bytes.data()+cursor);
value=uint32_t(p[0])|(uint32_t(p[1])<<8)|(uint32_t(p[2])<<16)|(uint32_t(p[3])<<24);cursor+=4;return true;
};
auto readFloat=[&](float& value) {uint32_t bits;if(!read32(bits))return false;std::memcpy(&value,&bits,4);return std::isfinite(value);};
uint32_t count,heightCount;if(!read32(count)||!read32(heightCount)||count>(bytes.size()-cursor)/68)return false;
float world[16];MakeFullTransformMatrix(obj.yaw,obj.pitch,obj.roll,obj.x,obj.y,obj.z,obj.scale,world);
std::vector<MapCollisionPlane> planes;
for(uint32_t i=0;i<count;++i) {
uint32_t type;if(!read32(type)||bytes.size()-cursor<32)return false;cursor+=32;
// This pass supports the authored plane sets used by town gates/walls.
// Mixed primitive files retain their existing proxy until all types are ported.
if(type!=0)return false;
float position[3],dimensions[2],q[4];
for(float& v:position)if(!readFloat(v))return false;
for(float& v:dimensions)if(!readFloat(v)||v<0)return false;
for(float& v:q)if(!readFloat(v))return false;
const float qnorm=std::sqrt(q[0]*q[0]+q[1]*q[1]+q[2]*q[2]+q[3]*q[3]);
if(!std::isfinite(qnorm)||qnorm<1e-6f)return false;for(float& v:q)v/=qnorm;
const float x=q[0],y=q[1],z=q[2],w=q[3];
const float u[3]={1-2*(y*y+z*z),2*(x*y+z*w),2*(x*z-y*w)};
const float v[3]={2*(x*y-z*w),1-2*(x*x+z*z),2*(y*z+x*w)};
auto transform=[&](const float* native,std::array<float,3>& result,bool point) {
// Same Granny Z-up -> engine Y-up basis as the rendered mesh: (x,z,-y).
const float local[3]={native[0],native[2],-native[1]};
for(int k=0;k<3;++k)result[k]=local[0]*world[k]+local[1]*world[4+k]+local[2]*world[8+k]+(point?world[12+k]:0);
};
MapCollisionPlane plane;transform(position,plane.center,true);transform(u,plane.axisU,false);transform(v,plane.axisV,false);
auto normalize=[](std::array<float,3>& a) {const float len=std::sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);if(len>0)for(float& n:a)n/=len;return len;};
plane.halfWidth=dimensions[0]*0.5f*normalize(plane.axisU);
plane.halfHeight=dimensions[1]*0.5f*normalize(plane.axisV);
if(!std::isfinite(plane.halfWidth)||!std::isfinite(plane.halfHeight)||plane.halfWidth<=0 || plane.halfHeight<=0)return false;
for(float value:plane.center)if(!std::isfinite(value))return false;
plane.normal={plane.axisU[1]*plane.axisV[2]-plane.axisU[2]*plane.axisV[1],
plane.axisU[2]*plane.axisV[0]-plane.axisU[0]*plane.axisV[2],
plane.axisU[0]*plane.axisV[1]-plane.axisU[1]*plane.axisV[0]};
planes.push_back(plane);
}
// Validate the height records too before replacing a solid proxy with authored data.
for(uint32_t i=0;i<heightCount;++i) {
if(bytes.size()-cursor<32)return false;cursor+=32;
uint32_t vertices;if(!read32(vertices)||vertices>(bytes.size()-cursor)/12)return false;cursor+=size_t(vertices)*12;
}
obj.collision_planes=std::move(planes);obj.has_authored_planes=true;obj.has_collision=!obj.collision_planes.empty();
return true;
}
MapObjectManager::MapObjectManager() = default; MapObjectManager::MapObjectManager() = default;
std::string MapObjectManager::NormalizePath(const std::string& path) { std::string MapObjectManager::NormalizePath(const std::string& path) {
@@ -132,6 +202,7 @@ std::shared_ptr<Gr2ModelInstance> MapObjectManager::GetOrLoadModel(const std::st
} }
bool MapObjectManager::LoadAreaData(const std::string& areadata_path, float coord_scale, SpeedTreeForest* forest, bool native_y) { bool MapObjectManager::LoadAreaData(const std::string& areadata_path, float coord_scale, SpeedTreeForest* forest, bool native_y) {
if(forest)SetTreeForest(forest);
std::ifstream file(areadata_path); std::ifstream file(areadata_path);
if (!file.is_open()) { if (!file.is_open()) {
std::cerr << "MapObjectManager::LoadAreaData failed to open: " << areadata_path << std::endl; std::cerr << "MapObjectManager::LoadAreaData failed to open: " << areadata_path << std::endl;
@@ -202,8 +273,7 @@ bool MapObjectManager::LoadAreaData(const std::string& areadata_path, float coor
} }
if (forest && forest->HasMainTree(crc)) { if (forest && forest->HasMainTree(crc)) {
forest->CreateInstance(px * coord_scale, (pz + bias) * coord_scale, py * coord_scale, crc, yaw, coord_scale); if(forest->CreateInstance(px * coord_scale, (pz + bias) * coord_scale, py * coord_scale, crc, yaw, coord_scale))loaded_count++;
loaded_count++;
continue; continue;
} }
@@ -211,8 +281,7 @@ bool MapObjectManager::LoadAreaData(const std::string& areadata_path, float coor
if (prop_it != m_property_map.end()) { if (prop_it != m_property_map.end()) {
const std::string& mfile = prop_it->second; const std::string& mfile = prop_it->second;
if (forest && (mfile.find(".spt") != std::string::npos || mfile.find(".SPT") != std::string::npos)) { if (forest && (mfile.find(".spt") != std::string::npos || mfile.find(".SPT") != std::string::npos)) {
forest->CreateInstance(px * coord_scale, (pz + bias) * coord_scale, py * coord_scale, crc, yaw, coord_scale, mfile.c_str()); if(forest->CreateInstance(px * coord_scale, (pz + bias) * coord_scale, py * coord_scale, crc, yaw, coord_scale, mfile.c_str()))loaded_count++;
loaded_count++;
continue; continue;
} }
@@ -230,6 +299,7 @@ bool MapObjectManager::LoadAreaData(const std::string& areadata_path, float coor
obj.scale = coord_scale; obj.scale = coord_scale;
obj.model = model; obj.model = model;
ComputeObjectOBB(obj); ComputeObjectOBB(obj);
LoadAuthoredPlanes(obj);
m_objects.push_back(std::move(obj)); m_objects.push_back(std::move(obj));
loaded_count++; loaded_count++;
} }
@@ -301,6 +371,7 @@ bool MapObjectManager::AddObject(const std::string& model_path, float x, float y
obj.scale = scale; obj.scale = scale;
obj.model = model; obj.model = model;
ComputeObjectOBB(obj); ComputeObjectOBB(obj);
LoadAuthoredPlanes(obj);
m_objects.push_back(std::move(obj)); m_objects.push_back(std::move(obj));
return true; return true;
} }
@@ -312,7 +383,11 @@ const std::vector<size_t>& MapObjectManager::CollisionCandidates(float x,float z
for(size_t i=0;i<m_objects.size();++i) { for(size_t i=0;i<m_objects.size();++i) {
const auto& obj=m_objects[i];if(!obj.has_collision)continue; const auto& obj=m_objects[i];if(!obj.has_collision)continue;
m_allCollisionObjects.push_back(i); m_allCollisionObjects.push_back(i);
const double r=std::max(std::abs(obj.obb.halfExtents[0]),std::abs(obj.obb.halfExtents[2]))*1.5; double r=std::max(std::abs(obj.obb.halfExtents[0]),std::abs(obj.obb.halfExtents[2]))*1.5;
for(const auto& plane:obj.collision_planes)for(int axis:{0,2}) {
const float center=axis==0?obj.obb.centerX:obj.obb.centerZ;
r=std::max(r,double(std::abs(plane.center[axis]-center)+std::abs(plane.axisU[axis])*plane.halfWidth+std::abs(plane.axisV[axis])*plane.halfHeight));
}
const double cx=obj.obb.centerX,cz=obj.obb.centerZ; const double cx=obj.obb.centerX,cz=obj.obb.centerZ;
if(!std::isfinite(r) || !std::isfinite(cx) || !std::isfinite(cz) || std::abs(cx)+r>1e9 || std::abs(cz)+r>1e9 || r>4096) { if(!std::isfinite(r) || !std::isfinite(cx) || !std::isfinite(cz) || std::abs(cx)+r>1e9 || std::abs(cz)+r>1e9 || r>4096) {
m_largeCollisionObjects.push_back(i);continue; m_largeCollisionObjects.push_back(i);continue;
@@ -357,12 +432,36 @@ bool MapObjectManager::CheckCollision(float worldX, float worldZ, float actorRad
} }
// FlyingInstance FCheckBackgroundDuringFlying uses radius 1 and the two // FlyingInstance FCheckBackgroundDuringFlying uses radius 1 and the two
// endpoints for OBBs. These are current mesh OBB proxies; .mdatr primitives remain a gap. // endpoints for OBBs. Authored .mdatr plane sets use source plane tests; other
// primitive types still use mesh OBB proxies.
void MapObjectManager::SetTreeForest(SpeedTreeForest* forest) {
m_treeForest=forest;m_treeLifetime=forest?forest->GetLifetimeToken():std::weak_ptr<const uint8_t>{};
}
bool MapObjectManager::CheckMovementCollision(const float* start,const float* end,float radius) const {
if(!start || !end || !std::isfinite(radius) || radius<0)return false;
// Actor BODY spheres have an altitude. Flattening them to a circle turns
// platforms, bridge decks and overhead geometry into infinitely tall walls.
// AVA2 CollisionData.cpp tests the dynamic sphere against a 3D box.
for(auto index:CollisionCandidates(end[0],end[2],radius)) {
const auto& object=m_objects[index];
if(object.has_authored_planes) {
for(const auto& plane:object.collision_planes)if(plane.Intersects(start,end,radius,true))return true;
continue;
}
if(object.has_collision && object.obb.IntersectsSphere3D(end,radius))return true;
}
return !m_treeLifetime.expired() && m_treeForest->CheckMovementCollision(start,end,radius,true);
}
bool MapObjectManager::CheckFlyingCollision(const float* start,const float* end,float radius) const { bool MapObjectManager::CheckFlyingCollision(const float* start,const float* end,float radius) const {
if(!m_treeLifetime.expired() && m_treeForest->CheckMovementCollision(start,end,radius,false))return true;
const float dx=end[0]-start[0],dy=end[1]-start[1],dz=end[2]-start[2]; const float dx=end[0]-start[0],dy=end[1]-start[1],dz=end[2]-start[2];
const float query=2*std::sqrt(dx*dx+dy*dy+dz*dz)+radius; const float query=2*std::sqrt(dx*dx+dy*dy+dz*dz)+radius;
for(auto index:CollisionCandidates(start[0],start[2],query)) { for(auto index:CollisionCandidates(start[0],start[2],query)) {
const auto& object=m_objects[index]; const auto& object=m_objects[index];
if(object.has_authored_planes) {
for(const auto& plane:object.collision_planes)if(plane.Intersects(start,end,radius,false))return true;
continue;
}
if(object.has_collision && (object.obb.IntersectsSphere3D(start,radius) || object.obb.IntersectsSphere3D(end,radius)))return true; if(object.has_collision && (object.obb.IntersectsSphere3D(start,radius) || object.obb.IntersectsSphere3D(end,radius)))return true;
} }
return false; return false;
+14
View File
@@ -12,6 +12,7 @@
#include <cmath> #include <cmath>
#include <algorithm> #include <algorithm>
#include <array>
namespace ava2 { namespace ava2 {
@@ -92,6 +93,12 @@ struct OrientedBoundingBox {
} }
}; };
struct MapCollisionPlane {
std::array<float,3> center{}, axisU{}, axisV{}, normal{};
float halfWidth = 0, halfHeight = 0;
bool Intersects(const float* start,const float* end,float radius,bool movement) const;
};
struct MapObjectInstance { struct MapObjectInstance {
std::string model_path; std::string model_path;
uint32_t property_crc = 0; uint32_t property_crc = 0;
@@ -105,6 +112,8 @@ struct MapObjectInstance {
std::shared_ptr<Gr2ModelInstance> model; std::shared_ptr<Gr2ModelInstance> model;
OrientedBoundingBox obb; OrientedBoundingBox obb;
bool has_collision = true; bool has_collision = true;
bool has_authored_planes = false;
std::vector<MapCollisionPlane> collision_planes;
mutable float bounds_min[3]{}, bounds_max[3]{}; mutable float bounds_min[3]{}, bounds_max[3]{};
mutable bool draws_cached = false; mutable bool draws_cached = false;
mutable std::vector<Render3DDraw> cached_draws; mutable std::vector<Render3DDraw> cached_draws;
@@ -137,6 +146,8 @@ public:
// 3D Oriented Bounding Box (OBB) Building Collision Detection // 3D Oriented Bounding Box (OBB) Building Collision Detection
bool CheckCollision(float worldX, float worldZ, float actorRadius = 30.0f) const; bool CheckCollision(float worldX, float worldZ, float actorRadius = 30.0f) const;
void SetTreeForest(SpeedTreeForest* forest);
bool CheckMovementCollision(const float* start,const float* end,float radius=30) const;
bool CheckFlyingCollision(const float* start,const float* end,float radius=1) const; bool CheckFlyingCollision(const float* start,const float* end,float radius=1) const;
bool CheckCollisionNormal(float worldX, float worldZ, float actorRadius, float& outNx, float& outNz) const; bool CheckCollisionNormal(float worldX, float worldZ, float actorRadius, float& outNx, float& outNz) const;
@@ -162,12 +173,15 @@ public:
void SetLoadingCenter(float x, float z, float maxDistance) { m_centerX = x; m_centerZ = z; m_maxDistanceSq = maxDistance > 0.0f ? maxDistance * maxDistance : 0.0f; } void SetLoadingCenter(float x, float z, float maxDistance) { m_centerX = x; m_centerZ = z; m_maxDistanceSq = maxDistance > 0.0f ? maxDistance * maxDistance : 0.0f; }
private: private:
SpeedTreeForest* m_treeForest=nullptr;
std::weak_ptr<const uint8_t> m_treeLifetime;
const std::vector<size_t>& CollisionCandidates(float x,float z,float radius) const; const std::vector<size_t>& CollisionCandidates(float x,float z,float radius) const;
mutable size_t m_collisionCount=std::numeric_limits<size_t>::max(); mutable size_t m_collisionCount=std::numeric_limits<size_t>::max();
mutable std::map<std::pair<int64_t,int64_t>,std::vector<size_t>> m_collisionCells; mutable std::map<std::pair<int64_t,int64_t>,std::vector<size_t>> m_collisionCells;
mutable std::vector<size_t> m_largeCollisionObjects,m_allCollisionObjects,m_collisionCandidates; mutable std::vector<size_t> m_largeCollisionObjects,m_allCollisionObjects,m_collisionCandidates;
std::shared_ptr<Gr2ModelInstance> GetOrLoadModel(const std::string& path); std::shared_ptr<Gr2ModelInstance> GetOrLoadModel(const std::string& path);
static std::string NormalizePath(const std::string& path); static std::string NormalizePath(const std::string& path);
static bool LoadAuthoredPlanes(MapObjectInstance& obj);
std::unordered_map<uint32_t, std::string> m_property_map; std::unordered_map<uint32_t, std::string> m_property_map;
std::unordered_map<std::string, std::shared_ptr<Gr2ModelInstance>> m_model_cache; std::unordered_map<std::string, std::shared_ptr<Gr2ModelInstance>> m_model_cache;
+84 -18
View File
@@ -82,6 +82,7 @@ bool IsSphereInFrustum(const float planes[6][4], float cx, float cy, float cz, f
SpeedTreeForest::SpeedTreeForest() {} SpeedTreeForest::SpeedTreeForest() {}
SpeedTreeForest::~SpeedTreeForest() { SpeedTreeForest::~SpeedTreeForest() {
m_lifetime.reset();
Clear(); Clear();
} }
@@ -132,11 +133,17 @@ SpeedTreeForest::TreeInstance* SpeedTreeForest::CreateInstance(float x, float y,
uint32_t dwTreeCRC, uint32_t dwTreeCRC,
float yaw, float scale, float yaw, float scale,
const char* name) { const char* name) {
if(!std::isfinite(x) || !std::isfinite(y) || !std::isfinite(z) || !std::isfinite(yaw))return nullptr;
std::shared_ptr<SpeedTreeModel> model = GetMainTree(dwTreeCRC); std::shared_ptr<SpeedTreeModel> model = GetMainTree(dwTreeCRC);
if (!model) { if (!model) {
// Fallback procedural model
std::string tname = name ? name : ("Tree_" + std::to_string(dwTreeCRC)); std::string tname = name ? name : ("Tree_" + std::to_string(dwTreeCRC));
model = SpeedTreeModel::CreateProcedural(tname, 1000.0f); auto extension=std::filesystem::path(tname).extension().string();
std::transform(extension.begin(),extension.end(),extension.begin(),[](unsigned char c){return char(std::tolower(c));});
// A failed real resource must not silently turn into an unrelated procedural tree.
if(m_properties.count(dwTreeCRC)) {std::cerr<<"SpeedTreeForest: failed tree property "<<dwTreeCRC<<'\n';return nullptr;}
if(extension==".spt")model=SpeedTreeModel::Create(tname,0,0);
else model=SpeedTreeModel::CreateProcedural(tname,1000);
if(!model)return nullptr;
m_tree_templates[dwTreeCRC] = model; m_tree_templates[dwTreeCRC] = model;
} }
@@ -151,6 +158,7 @@ SpeedTreeForest::TreeInstance* SpeedTreeForest::CreateInstance(float x, float y,
inst->model = model; inst->model = model;
TreeInstance* ptr = inst.get(); TreeInstance* ptr = inst.get();
inst->leafWind.Update(m_wind_time,inst->windStrength);
m_instances.push_back(std::move(inst)); m_instances.push_back(std::move(inst));
return ptr; return ptr;
} }
@@ -189,15 +197,23 @@ bool SpeedTreeForest::HasMainTree(uint32_t crc) const {
m_properties.find(crc) != m_properties.end(); m_properties.find(crc) != m_properties.end();
} }
void SpeedTreeForest::SetWindStrength(float strength) {
if(!std::isfinite(strength) || strength<0 || strength==m_wind_strength)return;
m_wind_strength=strength;
for(auto& instance:m_instances) {
instance->windStrength=strength;instance->leafWind.Update(m_wind_time,strength);
}
}
void SpeedTreeForest::UpdateSystem(float dt) { void SpeedTreeForest::UpdateSystem(float dt) {
if (!std::isfinite(dt) || dt<0 || !std::isfinite(m_wind_time+dt)) return; if (!std::isfinite(dt) || dt<0 || !std::isfinite(m_wind_time+dt)) return;
m_wind_time += dt; m_wind_time += dt;
m_frame_wind.time = m_wind_time; m_frame_wind.time = m_wind_time;
m_frame_wind.strength = m_wind_strength * 0.05f; m_frame_wind.strength = m_wind_strength;
m_wind_controller.Update(m_frame_wind.time, m_frame_wind.strength); m_wind_controller.Update(m_frame_wind.time, m_frame_wind.strength);
m_frame_wind.matrices = m_wind_controller.GetMatrices(); m_frame_wind.matrices = m_wind_controller.GetMatrices();
m_frame_wind.legacy_leaf_rocking = true; m_frame_wind.legacy_leaf_rocking = true;
m_frame_wind.legacy_leaf_phase = m_wind_controller.GetLeafPhase(); m_frame_wind.legacy_leaf_phase = m_wind_controller.GetLeafPhase();
for(auto& instance:m_instances)instance->leafWind.Update(m_wind_time,instance->windStrength);
} }
std::vector<Render3DDraw> SpeedTreeForest::BuildDrawCommands(const float* viewMatrix, std::vector<Render3DDraw> SpeedTreeForest::BuildDrawCommands(const float* viewMatrix,
@@ -212,31 +228,31 @@ std::vector<Render3DDraw> SpeedTreeForest::BuildDrawCommands(const float* viewMa
float planes[6][4]; float planes[6][4];
ExtractFrustumPlanes(vp, planes); ExtractFrustumPlanes(vp, planes);
float maxDistSq = maxDist * maxDist;
for (const auto& inst : m_instances) { for (const auto& inst : m_instances) {
if (!inst || !inst->model) continue; if (!inst || !inst->model) continue;
float dx = inst->x - camEyeX; std::array<float,3> center;float radius;
float dy = inst->y - camEyeY; inst->model->GetWorldBounds(inst->x,inst->y,inst->z,inst->yaw,inst->scale,center,radius);
float dz = inst->z - camEyeZ; if(m_cpuWind) {
float distSq = dx * dx + dz * dz; // Weighted rigid wind matrices rotate around the local origin. An origin sphere
if (distSq > maxDistSq) continue; // also contains every rotated leaf/card and the convex weighted interpolation.
radius+=std::sqrt((center[0]-inst->x)*(center[0]-inst->x)+(center[1]-inst->y)*(center[1]-inst->y)+(center[2]-inst->z)*(center[2]-inst->z));
// Frustum culling bounding sphere center={inst->x,inst->y,inst->z};
float h = inst->model->GetHeight() * inst->scale;
float r = std::max(inst->model->GetRadius() * inst->scale, h * 0.5f);
float cy = inst->y + h * 0.5f;
if (!IsSphereInFrustum(planes, inst->x, cy, inst->z, r)) {
continue;
} }
const float dx=center[0]-camEyeX,dz=center[2]-camEyeZ;
// Cull only when the whole crown is beyond the distance, not just its origin.
if(maxDist>0 && std::hypot(dx,dz)>maxDist+radius)continue;
if(!IsSphereInFrustum(planes,center[0],center[1],center[2],radius))continue;
const std::array<float,3> camera{camEyeX,camEyeY,camEyeZ}; const std::array<float,3> camera{camEyeX,camEyeY,camEyeZ};
auto frame=m_frame_wind;frame.strength=inst->windStrength;
frame.legacy_leaf_phase=inst->leafWind.GetLeafPhase();frame.legacy_leaf_rocking=true;
auto inst_draws = inst->model->BuildDrawCommands(inst->x, inst->y, inst->z, auto inst_draws = inst->model->BuildDrawCommands(inst->x, inst->y, inst->z,
inst->yaw, inst->scale, inst->yaw, inst->scale,
m_wind_time, m_wind_strength, m_wind_time, m_wind_strength,
m_frame_wind.matrices.empty() ? nullptr : &m_frame_wind, &camera, m_cpuWind); &frame, &camera, m_cpuWind,true);
for (auto& id : inst_draws) { for (auto& id : inst_draws) {
draws.push_back(std::move(id)); draws.push_back(std::move(id));
} }
@@ -245,4 +261,54 @@ std::vector<Render3DDraw> SpeedTreeForest::BuildDrawCommands(const float* viewMa
return draws; return draws;
} }
namespace {
float SegmentDistance(const std::array<float,3>& a,const std::array<float,3>& b,const std::array<float,3>& c,const std::array<float,3>& d) {
std::array<float,3> u,v,w;float uu=0,vv=0,uv=0,uw=0,vw=0;
for(int k=0;k<3;++k){u[k]=b[k]-a[k];v[k]=d[k]-c[k];w[k]=a[k]-c[k];uu+=u[k]*u[k];vv+=v[k]*v[k];uv+=u[k]*v[k];uw+=u[k]*w[k];vw+=v[k]*w[k];}
float s=0,t=0;
if(uu<=1e-8f){if(vv>1e-8f)t=std::clamp(vw/vv,0.f,1.f);}
else if(vv<=1e-8f)s=std::clamp(-uw/uu,0.f,1.f);
else {
const float denom=uu*vv-uv*uv;
if(denom>1e-8f)s=std::clamp((uv*vw-uw*vv)/denom,0.f,1.f);
t=(uv*s+vw)/vv;
if(t<0){t=0;s=std::clamp(-uw/uu,0.f,1.f);}
else if(t>1){t=1;s=std::clamp((uv-uw)/uu,0.f,1.f);}
}
float result=0;for(int k=0;k<3;++k){const float delta=w[k]+s*u[k]-t*v[k];result+=delta*delta;}return result;
}
}
bool SpeedTreeForest::CheckMovementCollision(const float* start,const float* end,float radius,bool approachingOnly) const {
if(!start || !end || !std::isfinite(radius) || radius<0)return false;
for(int k=0;k<3;++k)if(!std::isfinite(start[k]) || !std::isfinite(end[k]))return false;
const std::array<float,3> a{start[0],start[1],start[2]},b{end[0],end[1],end[2]};
for(const auto& instance:m_instances) {
if(!instance || !instance->model)continue;
for(const auto& object:instance->model->GetSptInfo().collision_objects) {
// AVA2 OnUpdateCollisionData ignores CO_BOX and translates primitives only.
if(object.type==speedtree::CollisionObject::Type::Box)continue;
const std::array<float,3> center{instance->x+object.position[0],instance->y+object.position[2],instance->z+object.position[1]};
const float r=object.dimensions[0];if(!std::isfinite(r) || r<0)continue;
auto top=center;const bool cylinder=object.type==speedtree::CollisionObject::Type::Cylinder;
if(cylinder) {
const float h=object.dimensions[1];if(!std::isfinite(h) || h<0)continue;
top[1]+=h;
if(b[1]+radius<center[1] || b[1]-radius>top[1])continue;
}
bool separated=false;
for(int k=0;k<3;++k)if(std::max(a[k],b[k])+radius<std::min(center[k],top[k])-r
|| std::min(a[k],b[k])-radius>std::max(center[k],top[k])+r) {separated=true;break;}
if(separated)continue;
const float distance=SegmentDistance(a,b,center,top),reach=(r+radius)*(r+radius);
if(cylinder?distance<=reach:distance<reach) {
// Original movement sphere test permits escaping an overlap; flying test doesn't.
float before=0,after=0;for(int k=0;k<3;++k){before+=(a[k]-center[k])*(a[k]-center[k]);after+=(b[k]-center[k])*(b[k]-center[k]);}
const bool crossing=SegmentDistance(a,a,center,top)>reach && SegmentDistance(b,b,center,top)>reach;
// Complete crossings must not tunnel through a trunk at mobile frame gaps.
if(!approachingOnly || after<before || crossing)return true;
}
}
}
return false;
}
} // namespace ava2 } // namespace ava2
+7 -2
View File
@@ -19,6 +19,8 @@ public:
float scale = 1.0f; float scale = 1.0f;
std::string name; std::string name;
std::shared_ptr<SpeedTreeModel> model; std::shared_ptr<SpeedTreeModel> model;
float windStrength=1; // Original Wrapper::LoadTree; environment changes update existing instances.
speedtree::LegacyWindController leafWind;
}; };
SpeedTreeForest(); SpeedTreeForest();
@@ -41,6 +43,8 @@ public:
float camEyeX, float camEyeY, float camEyeZ, float camEyeX, float camEyeY, float camEyeZ,
float maxDist = 6500.0f) const; float maxDist = 6500.0f) const;
std::weak_ptr<const uint8_t> GetLifetimeToken() const {return m_lifetime;}
bool CheckMovementCollision(const float* start,const float* end,float radius=30,bool approachingOnly=true) const;
size_t GetInstanceCount() const { return m_instances.size(); } size_t GetInstanceCount() const { return m_instances.size(); }
size_t GetMainTreeCount() const { return m_tree_templates.size(); } size_t GetMainTreeCount() const { return m_tree_templates.size(); }
const std::vector<std::unique_ptr<TreeInstance>>& GetInstances() const { return m_instances; } const std::vector<std::unique_ptr<TreeInstance>>& GetInstances() const { return m_instances; }
@@ -48,18 +52,19 @@ public:
std::shared_ptr<SpeedTreeModel> GetMainTree(uint32_t crc); std::shared_ptr<SpeedTreeModel> GetMainTree(uint32_t crc);
bool HasMainTree(uint32_t crc) const; bool HasMainTree(uint32_t crc) const;
void SetWindStrength(float s) { m_wind_strength = s; } void SetWindStrength(float s);
float GetWindStrength() const { return m_wind_strength; } float GetWindStrength() const { return m_wind_strength; }
// The shipped AVA2 configuration uses WIND_NONE. CPU deformation is opt-in. // The shipped AVA2 configuration uses WIND_NONE. CPU deformation is opt-in.
void SetCpuWindEnabled(bool enabled) { m_cpuWind = enabled; } void SetCpuWindEnabled(bool enabled) { m_cpuWind = enabled; }
bool IsCpuWindEnabled() const { return m_cpuWind; } bool IsCpuWindEnabled() const { return m_cpuWind; }
private: private:
std::shared_ptr<const uint8_t> m_lifetime=std::make_shared<const uint8_t>(0);
speedtree::LegacyWindController m_wind_controller; speedtree::LegacyWindController m_wind_controller;
speedtree::WindParameters m_frame_wind; speedtree::WindParameters m_frame_wind;
bool m_cpuWind = false; bool m_cpuWind = false;
float m_wind_time = 0.0f; float m_wind_time = 0.0f;
float m_wind_strength = 16.0f; float m_wind_strength = 0.0f;
std::map<uint32_t, SpeedTreeProperty> m_properties; std::map<uint32_t, SpeedTreeProperty> m_properties;
std::map<uint32_t, std::shared_ptr<SpeedTreeModel>> m_tree_templates; std::map<uint32_t, std::shared_ptr<SpeedTreeModel>> m_tree_templates;
+36 -7
View File
@@ -3,6 +3,7 @@
#include <filesystem> #include <filesystem>
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <iostream>
namespace ava2 { namespace ava2 {
@@ -13,6 +14,8 @@ std::shared_ptr<SpeedTreeModel> SpeedTreeModel::Create(const std::string& sptPat
} }
auto impl = speedtree::SpeedTreeModel::CreateFromSpt(resolved, treeSize, treeVariance); auto impl = speedtree::SpeedTreeModel::CreateFromSpt(resolved, treeSize, treeVariance);
if (!impl) return nullptr; if (!impl) return nullptr;
if(!impl->GetSptInfo().metadata_complete)
std::cerr<<"SpeedTree: partial metadata, token "<<impl->GetSptInfo().unsupported_token<<", "<<resolved<<'\n';
auto model = std::make_shared<SpeedTreeModel>(std::move(impl)); auto model = std::make_shared<SpeedTreeModel>(std::move(impl));
model->m_textureDirectory = std::filesystem::path(resolved).parent_path().string(); model->m_textureDirectory = std::filesystem::path(resolved).parent_path().string();
return model; return model;
@@ -29,13 +32,13 @@ std::shared_ptr<SpeedTreeModel> SpeedTreeModel::CreateProcedural(const std::stri
std::vector<Render3DDraw> SpeedTreeModel::BuildDrawCommands(float worldX, float worldY, float worldZ, std::vector<Render3DDraw> SpeedTreeModel::BuildDrawCommands(float worldX, float worldY, float worldZ,
float yawDeg, float scale, float yawDeg, float scale,
float windTime, float windStrength, const speedtree::WindParameters* frameWind, float windTime, float windStrength, const speedtree::WindParameters* frameWind,
const std::array<float,3>* camera, bool cpuWind) const { const std::array<float,3>* camera, bool cpuWind,bool shareStatic) const {
std::vector<Render3DDraw> results; std::vector<Render3DDraw> results;
if (!m_impl) return results; if (!m_impl) return results;
speedtree::WindParameters wind; speedtree::WindParameters wind;
wind.time = windTime; wind.time = windTime;
wind.strength = windStrength * 0.05f; wind.strength = std::isfinite(windStrength)?std::max(0.f,windStrength):0;
if (frameWind) wind = *frameWind; if (frameWind) wind = *frameWind;
if (!cpuWind) { if (!cpuWind) {
// WRAPPER_USE_NO_WIND disables branch/frond deformation and leaf-center // WRAPPER_USE_NO_WIND disables branch/frond deformation and leaf-center
@@ -47,9 +50,19 @@ std::vector<Render3DDraw> SpeedTreeModel::BuildDrawCommands(float worldX, float
auto build_draw = [&](const speedtree::SpeedTreeMesh& mesh, bool is_canopy, float alpha = 84) { auto build_draw = [&](const speedtree::SpeedTreeMesh& mesh, bool is_canopy, float alpha = 84) {
if (mesh.vertices.empty() || mesh.indices.empty()) return; if (mesh.vertices.empty() || mesh.indices.empty()) return;
const bool shared=shareStatic && !cpuWind && !mesh.is_leaf;
auto cached=m_staticDraws.find(&mesh);
if(shared && cached!=m_staticDraws.end()) {
auto draw=cached->second;
const float a=yawDeg*speedtree::kPI/180,c=std::cos(a)*scale,s=std::sin(a)*scale;
const float world[16]={c,0,-s,0,0,scale,0,0,s,0,c,0,worldX,worldY,worldZ,1};
std::copy_n(world,16,draw.world);results.push_back(std::move(draw));return;
}
Render3DDraw draw; Render3DDraw draw;
draw.texture0 = mesh.texture; draw.texture0 = mesh.texture;
if (!m_textureDirectory.empty() && !mesh.texture.empty()) { auto texture=m_resolvedTextures.find(mesh.texture);
if(texture!=m_resolvedTextures.end())draw.texture0=texture->second;
if (texture==m_resolvedTextures.end() && !m_textureDirectory.empty() && !mesh.texture.empty()) {
// CSpeedTreeWrapper::LoadTree: GetPath(spt) + NoExtension(texture name) + ".dds". SPT // CSpeedTreeWrapper::LoadTree: GetPath(spt) + NoExtension(texture name) + ".dds". SPT
// materials hold a bare name, often without extension ("CompositeMap", "plant_grass"). // materials hold a bare name, often without extension ("CompositeMap", "plant_grass").
auto name = CResourceManager::NormalizePath(mesh.texture.c_str()); auto name = CResourceManager::NormalizePath(mesh.texture.c_str());
@@ -59,11 +72,12 @@ std::vector<Render3DDraw> SpeedTreeModel::BuildDrawCommands(float worldX, float
if (std::filesystem::is_regular_file(candidate)) { draw.texture0 = candidate.string(); break; } if (std::filesystem::is_regular_file(candidate)) { draw.texture0 = candidate.string(); break; }
} }
} }
m_resolvedTextures[mesh.texture]=draw.texture0;
draw.indices = mesh.indices; draw.indices = mesh.indices;
m_impl->EvaluateCpuTransformedVertices(mesh, draw.positions, draw.normals, m_impl->EvaluateCpuTransformedVertices(mesh, draw.positions, draw.normals,
worldX, worldY, worldZ, shared?0:worldX, shared?0:worldY, shared?0:worldZ,
yawDeg, scale, wind, camera); shared?0:yawDeg, shared?1:scale, wind, camera);
size_t nverts = mesh.vertices.size(); size_t nverts = mesh.vertices.size();
draw.uv0.resize(nverts * 2); draw.uv0.resize(nverts * 2);
@@ -82,12 +96,18 @@ std::vector<Render3DDraw> SpeedTreeModel::BuildDrawCommands(float worldX, float
draw.cull_mode = 1; // Double sided draw.cull_mode = 1; // Double sided
draw.lighting = false; draw.lighting = false;
} else { } else {
draw.alpha_test = alpha>84; draw.alpha_test = true;
draw.alpha_ref = alpha>84 ? static_cast<uint8_t>(std::clamp(alpha,0.0f,255.0f)) : 0; draw.alpha_ref = static_cast<uint8_t>(std::clamp(alpha,0.0f,255.0f));
draw.cull_mode = 2; // CW draw.cull_mode = 2; // CW
draw.lighting = false; draw.lighting = false;
} }
if(shared) {
draw=Render3DDraw::ShareGeometry(std::move(draw));m_staticDraws.emplace(&mesh,draw);
const float a=yawDeg*speedtree::kPI/180,c=std::cos(a)*scale,s=std::sin(a)*scale;
const float world[16]={c,0,-s,0,0,scale,0,0,s,0,c,0,worldX,worldY,worldZ,1};
std::copy_n(world,16,draw.world);
}
results.push_back(std::move(draw)); results.push_back(std::move(draw));
}; };
@@ -103,4 +123,13 @@ std::vector<Render3DDraw> SpeedTreeModel::BuildDrawCommands(float worldX, float
return results; return results;
} }
void SpeedTreeModel::GetWorldBounds(float x,float y,float z,float yaw,float scale,std::array<float,3>& center,float& radius) const {
if(!m_impl){center={x,y,z};radius=0;return;}
const auto& lo=m_impl->GetBoundsMin();const auto& hi=m_impl->GetBoundsMax();
const float a=yaw*speedtree::kPI/180,c=std::cos(a),s=std::sin(a);
const float lx=(lo[0]+hi[0])*0.5f*scale,ly=(lo[1]+hi[1])*0.5f*scale,lz=(lo[2]+hi[2])*0.5f*scale;
center={x+c*lx+s*lz,y+ly,z-s*lx+c*lz};
const float ex=(hi[0]-lo[0])*0.5f,ey=(hi[1]-lo[1])*0.5f,ez=(hi[2]-lo[2])*0.5f;
radius=std::sqrt(ex*ex+ey*ey+ez*ez)*std::abs(scale);
}
} // namespace ava2 } // namespace ava2
+5 -2
View File
@@ -27,10 +27,11 @@ public:
std::vector<Render3DDraw> BuildDrawCommands(float worldX, float worldY, float worldZ, std::vector<Render3DDraw> BuildDrawCommands(float worldX, float worldY, float worldZ,
float yawDeg, float scale, float yawDeg, float scale,
float windTime, float windStrength = 15.0f, float windTime, float windStrength = 1.0f,
const speedtree::WindParameters* frameWind = nullptr, const speedtree::WindParameters* frameWind = nullptr,
const std::array<float,3>* camera = nullptr, const std::array<float,3>* camera = nullptr,
bool cpuWind = false) const; bool cpuWind = false, bool shareStatic = false) const;
void GetWorldBounds(float x,float y,float z,float yaw,float scale,std::array<float,3>& center,float& radius) const;
float GetHeight() const { return m_impl ? m_impl->GetHeight() : 1000.0f; } float GetHeight() const { return m_impl ? m_impl->GetHeight() : 1000.0f; }
float GetRadius() const { return m_impl ? m_impl->GetRadius() : 350.0f; } float GetRadius() const { return m_impl ? m_impl->GetRadius() : 350.0f; }
@@ -45,6 +46,8 @@ public:
private: private:
std::shared_ptr<speedtree::SpeedTreeModel> m_impl; std::shared_ptr<speedtree::SpeedTreeModel> m_impl;
std::string m_textureDirectory; std::string m_textureDirectory;
mutable std::map<const speedtree::SpeedTreeMesh*,Render3DDraw> m_staticDraws;
mutable std::map<std::string,std::string> m_resolvedTextures;
}; };
} // namespace ava2 } // namespace ava2
+6 -1
View File
@@ -123,7 +123,11 @@ void CPythonBackground::Create() {
if (!m_terrain) m_terrain = std::make_unique<TerrainHeightmap>(); if (!m_terrain) m_terrain = std::make_unique<TerrainHeightmap>();
if (!m_mapObjects) m_mapObjects = std::make_unique<MapObjectManager>(); if (!m_mapObjects) m_mapObjects = std::make_unique<MapObjectManager>();
if (!m_skybox) m_skybox = std::make_unique<SkyBox>(); if (!m_skybox) m_skybox = std::make_unique<SkyBox>();
if (!m_forest) m_forest = std::make_unique<SpeedTreeForest>(); if (!m_forest) {
m_forest = std::make_unique<SpeedTreeForest>();
if(m_pCurrentEnvironment)m_forest->SetWindStrength(m_pCurrentEnvironment->wind_strength);
}
m_mapObjects->SetTreeForest(m_forest.get());
} }
bool CPythonBackground::IsMapReady() const { bool CPythonBackground::IsMapReady() const {
@@ -566,6 +570,7 @@ bool CPythonBackground::SetEnvironmentData(int iIndex) {
auto it = m_mapEnvironmentData.find(iIndex); auto it = m_mapEnvironmentData.find(iIndex);
if (it != m_mapEnvironmentData.end()) { if (it != m_mapEnvironmentData.end()) {
m_pCurrentEnvironment = &it->second; m_pCurrentEnvironment = &it->second;
if(m_forest)m_forest->SetWindStrength(it->second.wind_strength);
if (m_skybox) { if (m_skybox) {
m_skybox->SetEnvironment(it->second); m_skybox->SetEnvironment(it->second);
} }
+1
View File
@@ -236,6 +236,7 @@ int main(int argc, char** argv) {
require(!background.LoadMap("reset_map") && !background.IsMapReady(),"non-finite terrain heights accepted"); require(!background.LoadMap("reset_map") && !background.IsMapReady(),"non-finite terrain heights accepted");
background.Destroy(); background.Destroy();
require(background.LoadMap("test_bg_map"),"forest clock map load"); require(background.LoadMap("test_bg_map"),"forest clock map load");
require(background.GetForest()->GetWindStrength()==0.2f,"environment default wind not propagated");
SpeedTreeForest reference; SpeedTreeForest reference;
reference.CreateInstance(0,0,300,191919,0,1,"clock"); reference.CreateInstance(0,0,300,191919,0,1,"clock");
background.GetForest()->CreateInstance(0,0,300,191919,0,1,"clock"); background.GetForest()->CreateInstance(0,0,300,191919,0,1,"clock");
+7
View File
@@ -250,6 +250,13 @@ int main(){
triangle.depth_less=false;scene.RenderDraw(surface,triangle);check(static_cast<uint32_t*>(surface->pixels)[pixel]!=before,"LESSEQUAL rejected equal depth"); triangle.depth_less=false;scene.RenderDraw(surface,triangle);check(static_cast<uint32_t*>(surface->pixels)[pixel]!=before,"LESSEQUAL rejected equal depth");
scene.Clear(0,1);triangle.depth_less=true;scene.RenderDraw(surface,triangle);check(scene.GetDepthBuffer()[pixel]<1,"additive depth-write state ignored"); scene.Clear(0,1);triangle.depth_less=true;scene.RenderDraw(surface,triangle);check(scene.GetDepthBuffer()[pixel]<1,"additive depth-write state ignored");
scene.Clear(0,1);triangle.z_write=false;scene.RenderDraw(surface,triangle);check(scene.GetDepthBuffer()[pixel]==1,"disabled additive depth-write changed depth"); scene.Clear(0,1);triangle.z_write=false;scene.RenderDraw(surface,triangle);check(scene.GetDepthBuffer()[pixel]==1,"disabled additive depth-write changed depth");
triangle.z_write=true;triangle.alpha_test=true;triangle.alpha_ref=84;triangle.diffuse={0x54FFFFFF,0x54FFFFFF,0x54FFFFFF};
scene.Clear(0,1);scene.RenderDraw(surface,triangle);check(scene.GetDepthBuffer()[pixel]==1,"software alpha accepted equal reference");
triangle.diffuse={0x55FFFFFF,0x55FFFFFF,0x55FFFFFF};scene.RenderDraw(surface,triangle);check(scene.GetDepthBuffer()[pixel]<1,"software alpha rejected greater reference");
scene.Clear(0,1);triangle.alpha_ref=0;triangle.diffuse={0x01FFFFFF,0x01FFFFFF,0x01FFFFFF};scene.RenderDraw(surface,triangle);check(scene.GetDepthBuffer()[pixel]<1,"zero alpha reference replaced by fallback threshold");
scene.Clear(0,1);triangle.diffuse={0x00FFFFFF,0x00FFFFFF,0x00FFFFFF};scene.RenderDraw(surface,triangle);check(scene.GetDepthBuffer()[pixel]==1,"fully transparent fragment wrote depth");
scene.Clear(0,1);triangle.alpha_ref=84;triangle.diffuse={0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF};triangle.material_diffuse[3]=0.25f;scene.RenderDraw(surface,triangle);
check(scene.GetDepthBuffer()[pixel]==1,"alpha tested before material modulation");
SDL_DestroySurface(surface); SDL_DestroySurface(surface);
trace.Clear();check(trace.IsEmpty(),"tail clear retained history"); trace.Clear();check(trace.IsEmpty(),"tail clear retained history");
// Actor resolver weak identity must reject deletion and same-VID replacement. // Actor resolver weak identity must reject deletion and same-VID replacement.
+7
View File
@@ -76,6 +76,13 @@ int main() {
equal.depth=false;color=center({near,equal});assert(color[0]>245 && color[1]>245); equal.depth=false;color=center({near,equal});assert(color[0]>245 && color[1]>245);
for(int i=3;i<6;++i)vertices[i].position[2]=.8f; for(int i=3;i<6;++i)vertices[i].position[2]=.8f;
for(int i=6;i<9;++i){vertices[i].position[2]=.1f;vertices[i].color[3]=51;} for(int i=6;i<9;++i){vertices[i].position[2]=.1f;vertices[i].color[3]=51;}
// Tree bark/canopy use the same strict alpha=84 mask. Equal must not write depth.
auto maskedTree=near;maskedTree.cull=1;maskedTree.alphaRef=84.f/255;
const Uint8 alpha84[4]={255,0,0,84},alpha85[4]={255,0,0,85},alpha0[4]={255,0,0,0},alpha1[4]={255,0,0,1};
maskedTree.texture=scene.Texture("tree-alpha84",1,1,alpha84);color=center({maskedTree,far});assert(color[1]>245&&color[0]<5);
maskedTree.texture=scene.Texture("tree-alpha85",1,1,alpha85);color=center({maskedTree,far});assert(color[0]>245&&color[1]<5);
maskedTree.alphaRef=0;maskedTree.texture=scene.Texture("tree-alpha0",1,1,alpha0);color=center({maskedTree,far});assert(color[1]>245&&color[0]<5);
maskedTree.texture=scene.Texture("tree-alpha1",1,1,alpha1);color=center({maskedTree,far});assert(color[0]>245&&color[1]<5);
// Perspective-correct color interpolation: top W=2 doubles its reciprocal denominator. // Perspective-correct color interpolation: top W=2 doubles its reciprocal denominator.
auto saved=vertices; auto saved=vertices;
vertices[2].position[1]*=2;vertices[2].position[2]*=2;vertices[2].position[3]=2; vertices[2].position[1]*=2;vertices[2].position[2]*=2;vertices[2].position[3]=2;
+5
View File
@@ -14,6 +14,9 @@ class PackagingTests(unittest.TestCase):
scripts = source / 'upstream/python-root' scripts = source / 'upstream/python-root'
scripts.mkdir(parents=True) scripts.mkdir(parents=True)
(scripts / 'uiCommon.py').write_text('class Dialog: pass\n') (scripts / 'uiCommon.py').write_text('class Dialog: pass\n')
(scripts / 'no.py').write_text('autoLogin = 1\n')
(scripts / 'lib').mkdir()
(scripts / 'lib/wa_ac.py').write_text('saved account fixture\n')
(scripts / 'pack_maker').symlink_to(base / 'outside') (scripts / 'pack_maker').symlink_to(base / 'outside')
packs = base / 'pack_maker' packs = base / 'pack_maker'
packs.mkdir() packs.mkdir()
@@ -30,6 +33,8 @@ class PackagingTests(unittest.TestCase):
self.assertIn('root/uiCommon.py', manifest['files']) self.assertIn('root/uiCommon.py', manifest['files'])
self.assertTrue((output / 'root/uiCommon.py').is_file()) self.assertTrue((output / 'root/uiCommon.py').is_file())
self.assertFalse((output / 'root/pack_maker').exists()) self.assertFalse((output / 'root/pack_maker').exists())
self.assertFalse((output / 'root/no.py').exists())
self.assertFalse((output / 'root/lib/wa_ac.py').exists())
self.assertEqual((output / 'svside/empty.jpg').read_bytes(), loose.read_bytes()) self.assertEqual((output / 'svside/empty.jpg').read_bytes(), loose.read_bytes())
self.assertIn('rework_inv/new_equipment_bg.tga', manifest['files']) self.assertIn('rework_inv/new_equipment_bg.tga', manifest['files'])
self.assertEqual((output / 'rework_inv/new_equipment_bg.tga').read_bytes(), data.read_bytes()) self.assertEqual((output / 'rework_inv/new_equipment_bg.tga').read_bytes(), data.read_bytes())
+44
View File
@@ -29,6 +29,8 @@ int main(int argc,char** argv) {
if(!ava2_test::EnterTestRunDir()) return ava2_test::kSkip; if(!ava2_test::EnterTestRunDir()) return ava2_test::kSkip;
const auto stdlib=fs::absolute(argv[1]); const auto stdlib=fs::absolute(argv[1]);
const auto model=fs::absolute("ymir work/pc/warrior/warrior_assasin1.gr2"); const auto model=fs::absolute("ymir work/pc/warrior/warrior_assasin1.gr2");
const auto gateModel=fs::absolute("ymir work/zone/a/building/a1-middledam-01.gr2");
const auto gateAttribute=fs::absolute("ymir work/zone/a/building/a1-middledam-01.mdatr");
const auto animation=fs::absolute("ymir work/pc/warrior/general/wait.gr2"); const auto animation=fs::absolute("ymir work/pc/warrior/general/wait.gr2");
const std::array<fs::path,3> variantAnimations={animation,fs::absolute("ymir work/pc/warrior/general/walk.gr2"),fs::absolute("ymir work/pc/warrior/general/run.gr2")}; const std::array<fs::path,3> variantAnimations={animation,fs::absolute("ymir work/pc/warrior/general/walk.gr2"),fs::absolute("ymir work/pc/warrior/general/run.gr2")};
if(!fs::exists(model) || !fs::exists(animation) || !fs::exists(variantAnimations[1]) || !fs::exists(variantAnimations[2])) return ava2_test::kSkip; if(!fs::exists(model) || !fs::exists(animation) || !fs::exists(variantAnimations[1]) || !fs::exists(variantAnimations[2])) return ava2_test::kSkip;
@@ -243,6 +245,48 @@ int main(int argc,char** argv) {
const float obstacleStart[3]={center[0]-5000,center[1],center[2]},after[3]={center[0]+5000,center[1],center[2]}; const float obstacleStart[3]={center[0]-5000,center[1],center[2]},after[3]={center[0]+5000,center[1],center[2]};
const float aboveBox[3]={center[0],center[1]+box.halfExtents[1]+10,center[2]}; const float aboveBox[3]={center[0],center[1]+box.halfExtents[1]+10,center[2]};
require(obstacles.CheckFlyingCollision(obstacleStart,center) && !obstacles.CheckFlyingCollision(aboveBox,aboveBox),"real OBB endpoint/height check"); require(obstacles.CheckFlyingCollision(obstacleStart,center) && !obstacles.CheckFlyingCollision(aboveBox,aboveBox),"real OBB endpoint/height check");
require(obstacles.CheckMovementCollision(obstacleStart,center,1),"movement passed through a solid box");
require(!obstacles.CheckMovementCollision(aboveBox,aboveBox,1),"overhead movement blocked by flattened box");
const float belowBox[3]={center[0],center[1]-box.halfExtents[1]-40,center[2]};
require(!obstacles.CheckMovementCollision(belowBox,belowBox,30),"movement below a box blocked by its footprint");
ActorInstance overheadWalker;overheadWalker.SetPosition(center[0]-100,center[1]+box.halfExtents[1]+50,center[2]);overheadWalker.SetSpeed(100);
overheadWalker.MoveInDirection(90,1,nullptr,&obstacles);
require(std::abs(overheadWalker.GetX()-center[0])<0.01f,"actor could not walk above an object footprint");
if(fs::exists(gateModel) && fs::exists(gateAttribute)) {
fs::copy_file(gateModel,root/"gate.gr2");fs::copy_file(gateAttribute,root/"gate.mdatr");
MapObjectManager gates;
require(gates.AddObject("gate.gr2",66907.429688f,19664.039063f,72199.484375f,30),"reported town gate fixture");
const auto& gate=gates.GetObjects().front();
require(gate.has_authored_planes && gate.collision_planes.size()==6,"town gate authored collision planes missing");
const float entrance[3]={66041.5f,19725.5f,71337.5f},advance[3]={66048.5f,19725.5f,71348.9f};
require(gates.CheckCollision(advance[0],advance[2],30),"reported gate no longer reproduces old solid footprint");
require(!gates.CheckMovementCollision(entrance,advance,30),"authored planes still seal reported gate opening");
ActorInstance gateWalker;gateWalker.SetPosition(entrance[0],entrance[1]-30,entrance[2]);gateWalker.SetSpeed(100);
gateWalker.MoveInDirection(31.55f,0.15f,nullptr,&gates);
require(std::hypot(gateWalker.GetX()-entrance[0],gateWalker.GetZ()-entrance[2])>14,"actor still stuck at reported gate opening");
gateWalker.SetPosition(entrance[0],entrance[1]-30,entrance[2]);
for(int step=0;step<200;++step)gateWalker.MoveInDirection(31.55f,0.1f,nullptr,&gates);
require(std::hypot(gateWalker.GetX()-entrance[0],gateWalker.GetZ()-entrance[2])>1999,"actor blocked while crossing entire gate opening");
for(const auto& plane:gate.collision_planes) {
float nearWall[3],intoWall[3];
for(int k=0;k<3;++k){nearWall[k]=plane.center[k]+plane.normal[k]*40;intoWall[k]=plane.center[k]+plane.normal[k]*20;}
require(gates.CheckMovementCollision(nearWall,intoWall,30),"authored gate wall lost collision");
require(!plane.Intersects(intoWall,nearWall,30,true),"authored plane prevents escaping overlap");
}
std::cout<<"Reported town gate opening and all 6 walls verified\n";
}
{
// A real empty attribute file intentionally disables dummy collisions;
// a truncated attribute must retain the existing solid fallback.
const char emptyAttribute[22]="AttributeData";
std::ofstream(root/"obstacle.mdatr",std::ios::binary).write(emptyAttribute,22);
MapObjectManager emptyObstacles;require(emptyObstacles.AddObject("obstacle.gr2",500,50,0,30),"empty attribute fixture");
require(emptyObstacles.GetObjects().front().has_authored_planes && !emptyObstacles.CheckMovementCollision(obstacleStart,center,30),"empty authored attribute replaced by solid dummy");
std::ofstream(root/"obstacle.mdatr",std::ios::binary).write(emptyAttribute,18);
MapObjectManager brokenObstacles;require(brokenObstacles.AddObject("obstacle.gr2",500,50,0,30),"broken attribute fixture");
require(!brokenObstacles.GetObjects().front().has_authored_planes && brokenObstacles.CheckMovementCollision(obstacleStart,center,30),"truncated attribute removed solid collision");
fs::remove(root/"obstacle.mdatr");
}
require(!obstacles.CheckFlyingCollision(obstacleStart,after),"OBB changed to continuous sweep instead of source endpoints"); require(!obstacles.CheckFlyingCollision(obstacleStart,after),"OBB changed to continuous sweep instead of source endpoints");
auto collisionData=std::make_shared<FlyingData>();collisionData->initial_velocity=100;collisionData->range=10000;collisionData->hit_on_background=true; auto collisionData=std::make_shared<FlyingData>();collisionData->initial_velocity=100;collisionData->range=10000;collisionData->hit_on_background=true;
FlyingInstance obstacleFlight(collisionData,center,after);unsigned obstacleHits=0;FlyCollisionCallbacks collisionCallbacks; FlyingInstance obstacleFlight(collisionData,center,after);unsigned obstacleHits=0;FlyCollisionCallbacks collisionCallbacks;
+77
View File
@@ -10,6 +10,7 @@
#include <chrono> #include <chrono>
#include <limits> #include <limits>
#include <filesystem> #include <filesystem>
#include "src/eter_render/ActorInstance.h"
using namespace ava2; using namespace ava2;
@@ -306,6 +307,80 @@ void TestAuthoredLeafRendering() {
assert(cpu[0].positions!=rocking[0].positions && cpu[1].positions!=rocking[1].positions); assert(cpu[0].positions!=rocking[0].positions && cpu[1].positions!=rocking[1].positions);
} }
void TestBoundsSharingAndWindPropagation() {
SptFixtures fixtures;SpeedTreeForest forest;
forest.RegisterPropertyData({12345,"Wide",fixtures.write("wide.spt",1000),1000,0});
auto* first=forest.CreateInstance(300,0,500,12345,90,2);
auto model=first->model;std::array<float,3> center;float radius;
model->GetWorldBounds(first->x,first->y,first->z,first->yaw,first->scale,center,radius);
auto expanded=model->BuildDrawCommands(first->x,first->y,first->z,first->yaw,first->scale,1,1);
for(const auto& draw:expanded)for(size_t i=0;i<draw.positions.size();i+=3) {
float distance=0;for(int k=0;k<3;++k){float delta=draw.positions[i+k]-center[k];distance+=delta*delta;}
assert(distance<=radius*radius+1);
}
float view[16]={1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1};
float proj[16]={0.0001f,0,0,0,0,0.0001f,0,0,0,0,0.00005f,0,0,0,0.5f,1};
auto visible=forest.BuildDrawCommands(view,proj,0,50,0,50);
assert(!visible.empty()); // Origin beyond 50, crown still intersects distance sphere.
assert(visible[0].geometry && visible[0].positions.empty());
assert(visible[0].alpha_test && visible[0].alpha_ref==84 && !visible[0].alpha_blend);
auto shared=visible[0].geometry;
auto again=forest.BuildDrawCommands(view,proj,0,50,0,50);
assert(again[0].geometry==shared);
const auto& local=visible[0].Mesh().positions;
for(size_t i=0;i<local.size();i+=3) {
const float* m=visible[0].world;
const float actual[3]={local[i]*m[0]+local[i+1]*m[4]+local[i+2]*m[8]+m[12],local[i]*m[1]+local[i+1]*m[5]+local[i+2]*m[9]+m[13],local[i]*m[2]+local[i+1]*m[6]+local[i+2]*m[10]+m[14]};
for(int k=0;k<3;++k)assert(std::abs(actual[k]-expanded[0].positions[i+k])<0.01f);
}
assert(first->windStrength==1 && forest.GetWindStrength()==0);
forest.UpdateSystem(1);const float phase=first->leafWind.GetLeafPhase();
forest.SetWindStrength(0.2f);assert(first->windStrength==0.2f && std::abs(first->leafWind.GetLeafPhase()-phase)<0.001f);
auto* later=forest.CreateInstance(-300,0,500,12345);assert(later->windStrength==1);
forest.SetWindStrength(0.2f);assert(later->windStrength==1); // Same-value setter doesn't update new instances, like source.
forest.SetWindStrength(0.4f);assert(first->windStrength==0.4f && later->windStrength==0.4f);
forest.SetWindStrength(std::numeric_limits<float>::quiet_NaN());assert(forest.GetWindStrength()==0.4f);
forest.SetCpuWindEnabled(true);auto cpu=forest.BuildDrawCommands(view,proj,0,50,0,0);assert(!cpu[0].geometry);
forest.SetCpuWindEnabled(false);again=forest.BuildDrawCommands(view,proj,0,50,0,0);assert(again[0].geometry==shared);
// Dense instances share one trunk stream instead of allocating a copy for each tree/frame.
for(int i=0;i<128;++i)forest.CreateInstance(float(i),0,500,12345);
auto dense=forest.BuildDrawCommands(view,proj,0,50,0,0);size_t trunks=0;
for(const auto& draw:dense)if(draw.geometry){assert(draw.geometry==shared);++trunks;}
assert(trunks==130);
}
void TestTreeCollisionPrimitives() {
SptFixtures fixtures;auto bytes=SyntheticSpt(300);
auto u=[&](uint32_t v){for(int k=0;k<4;++k)bytes.push_back(uint8_t(v>>(k*8)));};
auto f=[&](float v){u(std::bit_cast<uint32_t>(v));};
u(12000);u(12002);f(100);f(200);f(300);f(20);
u(12003);f(0);f(0);f(0);f(10);f(100);
u(12004);f(-100);f(0);f(0);f(50);f(50);f(50);u(12001);
auto path=fixtures.directory/"collision.spt";{std::ofstream file(path,std::ios::binary);file.write(reinterpret_cast<const char*>(bytes.data()),bytes.size());}
auto partial=SyntheticSpt(300);for(int k=0;k<4;++k)partial.push_back(uint8_t(22000>>(k*8)));partial.push_back(0);
auto partialPath=fixtures.directory/"partial.spt";{std::ofstream file(partialPath,std::ios::binary);file.write(reinterpret_cast<const char*>(partial.data()),partial.size());}
auto partialModel=SpeedTreeModel::Create(partialPath.string(),300);assert(partialModel && !partialModel->GetSptInfo().metadata_complete && partialModel->GetSptInfo().unsupported_token==22000);
SpeedTreeForest resourceTest;
auto* named=resourceTest.CreateInstance(0,0,0,7,0,1,path.string().c_str());assert(named && named->model->GetHeight()==300);
resourceTest.RegisterPropertyData({8,"Missing",(fixtures.directory/"missing.spt").string(),300,0});
assert(!resourceTest.CreateInstance(0,0,0,8) && !resourceTest.HasMainTree(9));
assert(!resourceTest.CreateInstance(0,0,0,9,0,1,(fixtures.directory/"missing.spt").string().c_str()));
auto forest=std::make_unique<SpeedTreeForest>();forest->RegisterPropertyData({4242,"Collision",path.string(),300,0});
auto* instance=forest->CreateInstance(10,20,30,4242,90,2);
assert(instance->model->GetSptInfo().collision_objects.size()==3);
MapObjectManager objects;objects.SetTreeForest(forest.get());
float start[3]={0,320,230},end[3]={220,320,230};assert(objects.CheckFlyingCollision(start,end,0));
assert(objects.CheckMovementCollision(start,end,0)); // Both endpoints outside: swept crossing still blocks.
start[1]=end[1]=340;assert(!objects.CheckFlyingCollision(start,end,0)); // Strict sphere tangency.
float cstart[3]={-50,50,30},cend[3]={0,50,30};assert(objects.CheckMovementCollision(cstart,cend,30));
float high[3]={0,200,30};assert(!objects.CheckMovementCollision(high,high,1));
float tangent[3]={20,50,30};assert(objects.CheckFlyingCollision(tangent,tangent,0)); // Cylinder inclusive.
float box[3]={-90,50,30};assert(!objects.CheckFlyingCollision(box,box,1));
float inside[3]={110,320,230},outside[3]={140,320,230};assert(!objects.CheckMovementCollision(inside,outside,0));
ActorInstance actor;actor.SetPosition(-50,20,30);actor.SetSpeed(100);actor.MoveInDirection(90,0.5f,nullptr,&objects);assert(actor.GetX()<-20);
forest->DeleteInstance(instance);assert(!objects.CheckFlyingCollision(cstart,cend,30));
forest->CreateInstance(10,20,30,4242);assert(objects.CheckFlyingCollision(cstart,cend,30));
forest.reset();assert(!objects.CheckFlyingCollision(cstart,cend,30)); // Borrowed forest lifetime protected.
}
int main() { int main() {
std::cout << "=== Running SpeedTree & Forest Engine Tests ===" << std::endl; std::cout << "=== Running SpeedTree & Forest Engine Tests ===" << std::endl;
TestPrtParsing(); TestPrtParsing();
@@ -316,6 +391,8 @@ int main() {
TestBillboardRendering(); TestBillboardRendering();
TestFrondRendering(); TestFrondRendering();
TestAuthoredLeafRendering(); TestAuthoredLeafRendering();
TestBoundsSharingAndWindPropagation();
TestTreeCollisionPrimitives();
std::cout << "=== ALL SpeedTree & Forest Tests PASSED (100%) ===" << std::endl; std::cout << "=== ALL SpeedTree & Forest Tests PASSED (100%) ===" << std::endl;
return 0; return 0;
} }
+3
View File
@@ -64,6 +64,9 @@ def package_assets(source_dir, output_dir, manifest_path=None, include_heavy=Fal
if rel.endswith((".pyc", ".tmp")): if rel.endswith((".pyc", ".tmp")):
return return
key = rel.lower() key = rel.lower()
# Saved accounts and optional auto-login overrides belong to the user.
if key in ("lib/wa_ac.py", "root/lib/wa_ac.py", "no.py", "root/no.py"):
return
if override or key not in entries: if override or key not in entries:
if not source.is_file(): if not source.is_file():
raise FileNotFoundError(f"Required asset {rel}: {source}") raise FileNotFoundError(f"Required asset {rel}: {source}")
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+862
View File
@@ -0,0 +1,862 @@
ScriptType RaceDataScript
BaseModelFileName "d:/ymir work/pc3/wolfman/wolfman_novice.GR2"
Group HairData
{
PathName "d:/ymir Work/pc3/wolfman/"
HairDataCount 200
Group HairData00
{
HairIndex 0
Model "hair/hair_1_1.gr2"
SourceSkin "hair/hair_1_1.dds"
TargetSkin "hair/hair_1_1.dds"
}
Group HairData01
{
HairIndex 1
Model "hair/hair_1_1.gr2"
SourceSkin "hair/hair_1_1.dds"
TargetSkin "hair/wolfman_hair_01_white.dds"
}
Group HairData02
{
HairIndex 2
Model "hair/hair_1_1.gr2"
SourceSkin "hair/hair_1_1.dds"
TargetSkin "hair/wolfman_hair_01_gold.dds"
}
Group HairData03
{
HairIndex 3
Model "hair/hair_1_1.gr2"
SourceSkin "hair/hair_1_1.dds"
TargetSkin "hair/wolfman_hair_01_red.dds"
}
Group HairData04
{
HairIndex 4
Model "hair/hair_1_1.gr2"
SourceSkin "hair/hair_1_1.dds"
TargetSkin "hair/wolfman_hair_01_brown.dds"
}
Group HairData05
{
HairIndex 5
Model "hair/hair_1_1.gr2"
SourceSkin "hair/hair_1_1.dds"
TargetSkin "hair/wolfman_hair_01_black.dds"
}
Group HairData06
{
HairIndex 21
Model "hair/hair_2_1.gr2"
SourceSkin "hair/hair_2_1.dds"
TargetSkin "hair/hair_2_1.dds"
}
Group HairData07
{
HairIndex 22
Model "hair/hair_2_1.gr2"
SourceSkin "hair/hair_2_1.dds"
TargetSkin "hair/hair_2_2.dds"
}
Group HairData08
{
HairIndex 23
Model "hair/hair_2_1.gr2"
SourceSkin "hair/hair_2_1.dds"
TargetSkin "hair/hair_2_3.dds"
}
Group HairData09
{
HairIndex 24
Model "hair/hair_2_1.gr2"
SourceSkin "hair/hair_2_1.dds"
TargetSkin "hair/hair_2_4.dds"
}
Group HairData10
{
HairIndex 25
Model "hair/hair_2_1.gr2"
SourceSkin "hair/hair_2_1.dds"
TargetSkin "hair/hair_2_5.dds"
}
Group HairData11
{
HairIndex 331
Model "hair/hair_33_1.gr2"
SourceSkin "hair/hair_33_1.dds"
TargetSkin "hair/hair_33_1.dds"
}
Group HairData12
{
HairIndex 411
Model "hair/hair_41_1.gr2"
SourceSkin "hair/hair_41_1.dds"
TargetSkin "hair/hair_41_1.dds"
}
Group HairData13
{
HairIndex 412
Model "hair/hair_41_2.gr2"
SourceSkin "hair/hair_41_2.dds"
TargetSkin "hair/hair_41_2.dds"
}
Group HairData14
{
HairIndex 31
Model "hair/hair_3_1.gr2"
SourceSkin "hair/hair_3_1.dds"
TargetSkin "hair/hair_3_1.dds"
}
Group HairData15
{
HairIndex 32
Model "hair/hair_3_1.gr2"
SourceSkin "hair/hair_3_1.dds"
TargetSkin "hair/hair_3_2.dds"
}
Group HairData16
{
HairIndex 33
Model "hair/hair_3_1.gr2"
SourceSkin "hair/hair_3_1.dds"
TargetSkin "hair/hair_3_3.dds"
}
Group HairData17
{
HairIndex 34
Model "hair/hair_3_1.gr2"
SourceSkin "hair/hair_3_1.dds"
TargetSkin "hair/hair_3_4.dds"
}
Group HairData18
{
HairIndex 35
Model "hair/hair_3_1.gr2"
SourceSkin "hair/hair_3_1.dds"
TargetSkin "hair/hair_3_5.dds"
}
Group HairData19
{
HairIndex 41
Model "hair/hair_4_1.gr2"
SourceSkin "hair/hair_4_1.dds"
TargetSkin "hair/hair_4_1.dds"
}
Group HairData20
{
HairIndex 42
Model "hair/hair_4_1.gr2"
SourceSkin "hair/hair_4_1.dds"
TargetSkin "hair/hair_4_2.dds"
}
Group HairData21
{
HairIndex 43
Model "hair/hair_4_1.gr2"
SourceSkin "hair/hair_4_1.dds"
TargetSkin "hair/hair_4_3.dds"
}
Group HairData22
{
HairIndex 44
Model "hair/hair_4_1.gr2"
SourceSkin "hair/hair_4_1.dds"
TargetSkin "hair/hair_4_4.dds"
}
Group HairData23
{
HairIndex 45
Model "hair/hair_4_1.gr2"
SourceSkin "hair/hair_4_1.dds"
TargetSkin "hair/hair_4_5.dds"
}
Group HairData24
{
HairIndex 421
Model "hair/hair_42_1.gr2"
SourceSkin "hair/hair_42_1.dds"
TargetSkin "hair/hair_42_1.dds"
}
Group HairData25
{
HairIndex 422
Model "hair/hair_42_1.gr2"
SourceSkin "hair/hair_42_1.dds"
TargetSkin "hair/hair_42_2.dds"
}
Group HairData26
{
HairIndex 431
Model "hair/hair_43_1.gr2"
SourceSkin "hair/hair_43_1.dds"
TargetSkin "hair/hair_43_1.dds"
}
Group HairData27
{
HairIndex 432
Model "hair/hair_43_1.gr2"
SourceSkin "hair/hair_43_1.dds"
TargetSkin "hair/hair_43_2.dds"
}
Group HairData28
{
HairIndex 281
Model "hair/hair_28_1.gr2"
SourceSkin "hair/hair_28_1.dds"
TargetSkin "hair/hair_28_1.dds"
}
Group HairData29
{
HairIndex 442
Model "hair/hair_44_1.gr2"
SourceSkin "hair/hair_44_1.dds"
TargetSkin "hair/hair_44_2.dds"
}
Group HairData30
{
HairIndex 441
Model "hair/hair_44_1.gr2"
SourceSkin "hair/hair_44_1.dds"
TargetSkin "hair/hair_44_1.dds"
}
Group HairData31
{
HairIndex 451
Model "hair/hair_45_1.gr2"
SourceSkin "hair/hair_45_1.dds"
TargetSkin "hair/hair_45_1.dds"
}
Group HairData32
{
HairIndex 452
Model "hair/hair_45_1.gr2"
SourceSkin "hair/hair_45_1.dds"
TargetSkin "hair/hair_45_2.dds"
}
Group HairData33
{
HairIndex 341
Model "hair/hair_34_1.gr2"
SourceSkin "hair/hair_34_1.dds"
TargetSkin "hair/hair_34_1.dds"
}
Group HairData34
{
HairIndex 461
Model "hair/hair_46_1.gr2"
SourceSkin "hair/hair_46_1.dds"
TargetSkin "hair/hair_46_1.dds"
}
Group HairData35
{
HairIndex 462
Model "hair/hair_46_1.gr2"
SourceSkin "hair/hair_46_1.dds"
TargetSkin "hair/hair_46_2.dds"
}
Group HairData36
{
HairIndex 221
Model "hair/hair_22_1.gr2"
SourceSkin "hair/hair_22_1.dds"
TargetSkin "hair/hair_22_1.dds"
}
Group HairData37
{
HairIndex 222
Model "hair/hair_22_1.gr2"
SourceSkin "hair/hair_22_1.dds"
TargetSkin "hair/hair_22_2.dds"
}
Group HairData38
{
HairIndex 223
Model "hair/hair_22_1.gr2"
SourceSkin "hair/hair_22_1.dds"
TargetSkin "hair/hair_22_3.dds"
}
Group HairData39
{
HairIndex 471
Model "hair/hair_47_1.gr2"
SourceSkin "hair/hair_47_1.dds"
TargetSkin "hair/hair_47_1.dds"
}
Group HairData40
{
HairIndex 472
Model "hair/hair_47_1.gr2"
SourceSkin "hair/hair_47_1.dds"
TargetSkin "hair/hair_47_2.dds"
}
Group HairData41
{
HairIndex 111
Model "hair/hair_11_1.gr2"
SourceSkin "hair/hair_11_1.dds"
TargetSkin "hair/hair_11_1.dds"
}
Group HairData42
{
HairIndex 112
Model "hair/hair_11_1.gr2"
SourceSkin "hair/hair_11_1.dds"
TargetSkin "hair/hair_11_2.dds"
}
Group HairData43
{
HairIndex 113
Model "hair/hair_11_1.gr2"
SourceSkin "hair/hair_11_1.dds"
TargetSkin "hair/hair_11_3.dds"
}
Group HairData44
{
HairIndex 423
Model "hair/hair_42_1.gr2"
SourceSkin "hair/hair_42_1.dds"
TargetSkin "hair/hair_42_3.dds"
}
Group HairData45
{
HairIndex 424
Model "hair/hair_42_1.gr2"
SourceSkin "hair/hair_42_1.dds"
TargetSkin "hair/hair_42_4.dds"
}
Group HairData46
{
HairIndex 700
Model "hair/hair_48_1.gr2"
SourceSkin "hair/hair_48_1.dds"
TargetSkin "hair/hair_48_1.dds"
}
Group HairData47
{
HairIndex 701
Model "hair/hair_50_1.gr2"
SourceSkin "hair/hair_50_1.dds"
TargetSkin "hair/hair_50_1.dds"
}
Group HairData48
{
HairIndex 702
Model "hair/hair_51_1.gr2"
SourceSkin "hair/hair_51_1.dds"
TargetSkin "hair/hair_51_1.dds"
}
Group HairData49
{
HairIndex 703
Model "hair/hair_53_1.gr2"
SourceSkin "hair/hair_53_1.dds"
TargetSkin "hair/hair_53_1.dds"
}
Group HairData50
{
HairIndex 704
Model "hair/hair_54_1.gr2"
SourceSkin "hair/hair_54_1.dds"
TargetSkin "hair/hair_54_1.dds"
}
Group HairData51
{
HairIndex 705
Model "hair/hair_57_1.gr2"
SourceSkin "hair/hair_57_1.dds"
TargetSkin "hair/hair_57_1.dds"
}
Group HairData52
{
HairIndex 706
Model "hair/hair_58_1.gr2"
SourceSkin "hair/hair_58_1.dds"
TargetSkin "hair/hair_58_1.dds"
}
Group HairData53
{
HairIndex 721
Model "hair/hair_53_1.gr2"
SourceSkin "hair/hair_53_1.dds"
TargetSkin "hair/hair_53_2.dds"
}
Group HairData54
{
HairIndex 551
Model "hair/hair_59_1.gr2"
SourceSkin "hair/hair_59_1.dds"
TargetSkin "hair/hair_59_2.dds"
}
Group HairData55
{
HairIndex 552
Model "hair/hair_59_1.gr2"
SourceSkin "hair/hair_59_1.dds"
TargetSkin "hair/hair_59_1.dds"
}
}
Group ShapeData
{
PathName "d:/ymir Work/pc3/wolfman/"
ShapeDataCount 200
Group ShapeData00
{
ShapeIndex 0
Model "wolfman_novice.gr2"
SourceSkin "wolfman_novice.dds"
TargetSkin "wolfman_novice.dds"
}
Group ShapeData01
{
ShapeIndex 1
Model "wolfman_novice.gr2"
SourceSkin "wolfman_novice.dds"
TargetSkin "wolfman_novice_1.dds"
}
Group ShapeData02
{
ShapeIndex 2
Model "wolfman_2_1.GR2"
SourceSkin "wolfman_2_1.dds"
TargetSkin "wolfman_2_1.dds"
}
Group ShapeData03
{
ShapeIndex 3
Model "wolfman_2_1.GR2"
SourceSkin "wolfman_2_1.dds"
TargetSkin "wolfman_2_2.dds"
}
Group ShapeData04
{
ShapeIndex 4
Model "wolfman_2_1.GR2"
SourceSkin "wolfman_2_1.dds"
TargetSkin "wolfman_2_3.dds"
}
Group ShapeData05
{
ShapeIndex 5
Model "wolfman_3_1.GR2"
SourceSkin "wolfman_3_1.dds"
TargetSkin "wolfman_3_1.dds"
}
Group ShapeData06
{
ShapeIndex 6
Model "wolfman_3_1.GR2"
SourceSkin "wolfman_3_1.dds"
TargetSkin "wolfman_3_2.dds"
}
Group ShapeData07
{
ShapeIndex 7
Model "wolfman_3_1.GR2"
SourceSkin "wolfman_3_1.dds"
TargetSkin "wolfman_3_3.dds"
}
Group ShapeData08
{
ShapeIndex 8
Model "wolfman_4_1.GR2"
SourceSkin "wolfman_4_1.dds"
TargetSkin "wolfman_4_1.dds"
}
Group ShapeData09
{
ShapeIndex 9
Model "wolfman_4_1.GR2"
SourceSkin "wolfman_4_1.dds"
TargetSkin "wolfman_4_2.dds"
}
Group ShapeData10
{
ShapeIndex 10
Model "wolfman_4_3.GR2"
SourceSkin "wolfman_4_3.dds"
TargetSkin "wolfman_4_3.dds"
}
Group ShapeData11
{
ShapeIndex 11
Model "wolfman_5_1.gr2"
SourceSkin "wolfman_5_1.dds"
TargetSkin "wolfman_5_1.dds"
}
Group ShapeData12
{
ShapeIndex 201
Model "wolfman_marry.GR2"
SourceSkin "wolfman_marry.dds"
TargetSkin "wolfman_marry.dds"
}
Group ShapeData13
{
ShapeIndex 40114
Model "wolfman_pwahuang1.GR2"
SourceSkin "wolfman_pwahuang1.dds"
TargetSkin "wolfman_pwahuang1.dds"
}
Group ShapeData14
{
ShapeIndex 40189
Model "wolfman_snow1.GR2"
SourceSkin "wolfman_snow1.dds"
TargetSkin "wolfman_snow1.dds"
}
Group ShapeData15
{
ShapeIndex 40188
Model "wolfman_snow_santa1.gr2"
SourceSkin "wolfman_snow_santa1.dds"
TargetSkin "wolfman_snow_santa1.dds"
}
Group ShapeData16
{
ShapeIndex 40192
Model "wolfman_carnival1.gr2"
SourceSkin "wolfman_carnival1.dds"
TargetSkin "wolfman_carnival1.dds"
}
Group ShapeData17
{
ShapeIndex 40193
Model "wolfman_carnival1.gr2"
SourceSkin "wolfman_carnival1.dds"
TargetSkin "wolfman_carnival2.dds"
}
Group ShapeData18
{
ShapeIndex 40200
Model "wolfman_easter_day1.gr2"
SourceSkin "wolfman_easter_day1.dds"
TargetSkin "wolfman_easter_day1.dds"
}
Group ShapeData19
{
ShapeIndex 40201
Model "wolfman_easter_day1.gr2"
SourceSkin "wolfman_easter_day1.dds"
TargetSkin "wolfman_easter_day2.dds"
}
Group ShapeData20
{
ShapeIndex 40110
Model "wolfman_BlackSnake1.gr2"
SourceSkin "wolfman_BlackSnake1.dds"
TargetSkin "wolfman_BlackSnake1.dds"
}
Group ShapeData21
{
ShapeIndex 40196
Model "wolfman_ramadan1.gr2"
SourceSkin "wolfman_ramadan1.dds"
TargetSkin "wolfman_ramadan2.dds"
}
Group ShapeData22
{
ShapeIndex 40197
Model "wolfman_ramadan1.gr2"
SourceSkin "wolfman_ramadan1.dds"
TargetSkin "wolfman_ramadan1.dds"
}
Group ShapeData23
{
ShapeIndex 27
Model "wolfman_5_1.GR2"
SourceSkin "wolfman_5_1.dds"
TargetSkin "wolfman_5_1_blue.dds"
}
Group ShapeData24
{
ShapeIndex 28
Model "wolfman_5_1.GR2"
SourceSkin "wolfman_5_1.dds"
TargetSkin "wolfman_5_1_red.dds"
}
Group ShapeData25
{
ShapeIndex 29
Model "wolfman_5_1.GR2"
SourceSkin "wolfman_5_1.dds"
TargetSkin "wolfman_5_1_white.dds"
}
Group ShapeData26
{
ShapeIndex 30
Model "wolfman_5_1.GR2"
SourceSkin "wolfman_5_1.dds"
TargetSkin "wolfman_5_1_black.dds"
}
Group ShapeData27
{
ShapeIndex 41512
Model "wolfman_halloween_2015.GR2"
SourceSkin "wolfman_halloween_2015_gold.dds"
TargetSkin "wolfman_halloween_2015_gold.dds"
}
Group ShapeData28
{
ShapeIndex 41513
Model "wolfman_halloween_2015.GR2"
SourceSkin "wolfman_halloween_2015_gold.dds"
TargetSkin "wolfman_halloween_2015_silver.dds"
}
Group ShapeData29
{
ShapeIndex 40116
Model "wolfman_halloween2.GR2"
SourceSkin "wolfman_halloween2.dds"
TargetSkin "wolfman_halloween2.dds"
}
Group ShapeData30
{
ShapeIndex 41520
Model "wolfman_christmas_2015.GR2"
SourceSkin "wolfman_christmas_2015_red.dds"
TargetSkin "wolfman_christmas_2015_red.dds"
}
Group ShapeData31
{
ShapeIndex 41521
Model "wolfman_christmas_2015.GR2"
SourceSkin "wolfman_christmas_2015_red.dds"
TargetSkin "wolfman_christmas_2015_blue.dds"
}
Group ShapeData32
{
ShapeIndex 40066
Model "wolfman_santa1_black.GR2"
SourceSkin "wolfman_santa1_black.dds"
TargetSkin "wolfman_santa1_red.dds"
}
Group ShapeData33
{
ShapeIndex 40067
Model "wolfman_santa1_black.GR2"
SourceSkin "wolfman_santa1_black.dds"
TargetSkin "wolfman_santa1_green.dds"
}
Group ShapeData34
{
ShapeIndex 40068
Model "wolfman_santa1_black.GR2"
SourceSkin "wolfman_santa1_black.dds"
TargetSkin "wolfman_santa1_black.dds"
}
Group ShapeData35
{
ShapeIndex 41540
Model "wolfman_easter_day_2016.GR2"
SourceSkin "wolfman_easter_day_2016_1.dds"
TargetSkin "wolfman_easter_day_2016_1.dds"
}
Group ShapeData36
{
ShapeIndex 41541
Model "wolfman_easter_day_2016.GR2"
SourceSkin "wolfman_easter_day_2016_1.dds"
TargetSkin "wolfman_easter_day_2016_2.dds"
}
Group ShapeData37
{
ShapeIndex 40031
Model "wolfman_rabbit1.gr2"
SourceSkin "wolfman_rabbit1.dds"
TargetSkin "wolfman_rabbit1.dds"
}
Group ShapeData38
{
ShapeIndex 40106
Model "wolfman_rabbit1.GR2"
SourceSkin "wolfman_rabbit1.dds"
TargetSkin "wolfman_rabbit1_black.dds"
}
Group ShapeData39
{
ShapeIndex 40107
Model "wolfman_rabbit1.GR2"
SourceSkin "wolfman_rabbit1.dds"
TargetSkin "wolfman_rabbit1_blue.dds"
}
Group ShapeData40
{
ShapeIndex 41552
Model "wolfman_carnival1.gr2"
SourceSkin "wolfman_carnival1.dds"
TargetSkin "wolfman_carnival3_2016.dds"
}
Group ShapeData41
{
ShapeIndex 41553
Model "wolfman_carnival1.gr2"
SourceSkin "wolfman_carnival1.dds"
TargetSkin "wolfman_carnival4_2016.dds"
}
Group ShapeData172
{
ShapeIndex 601
Model "wolfman_christmas_2017_lod_01.gr2"
SourceSkin "wolfman_christmas_2017_silver.dds"
TargetSkin "wolfman_christmas_2017_silver.dds"
}
Group ShapeData173
{
ShapeIndex 602
Model "wolfman_easter_day_2018.gr2"
SourceSkin "wolfman_easter_day_2018_1.dds"
TargetSkin "wolfman_easter_day_2018_1.dds"
}
Group ShapeData174
{
ShapeIndex 603
Model "wolfman_halloween_2016.gr2"
SourceSkin "wolfman_halloween_2016_silver.dds"
TargetSkin "wolfman_halloween_2016_silver.dds"
}
Group ShapeData175
{
ShapeIndex 604
Model "wolfman_halloween_2017.GR2"
SourceSkin "wolfman_halloween_2017_red.dds"
TargetSkin "wolfman_halloween_2017_red.dds"
}
Group ShapeData176
{
ShapeIndex 605
Model "wolfman_ramadan_2018.gr2"
SourceSkin "wolfman_ramadan_2018_1.dds"
TargetSkin "wolfman_ramadan_2018_1.dds"
}
Group ShapeData177
{
ShapeIndex 606
Model "wolfman_summer_2017.gr2"
SourceSkin "wolfman_summer_2017_1.dds"
TargetSkin "wolfman_summer_2017_1.dds"
}
Group ShapeData178
{
ShapeIndex 607
Model "wolfman_easter_day_2017.gr2"
SourceSkin "wolfman_easter_day_2017_1.dds"
TargetSkin "wolfman_easter_day_2017_1.dds"
}
Group ShapeData179
{
ShapeIndex 608
Model "wolfman_halloween_2017.GR2"
SourceSkin "wolfman_halloween_2017_red.dds"
TargetSkin "wolfman_halloween_2017_blue.dds"
}
Group ShapeData180
{
ShapeIndex 1201
Model "wolfman_halloween_2018.GR2"
SourceSkin "wolfman_halloween_2018_1.dds"
TargetSkin "wolfman_halloween_2018_2.dds"
}
Group ShapeData181
{
ShapeIndex 1202
Model "wolfman_halloween_2018.gr2"
SourceSkin "wolfman_halloween_2018_1.dds"
TargetSkin "wolfman_halloween_2018_1.dds"
}
Group ShapeData182
{
ShapeIndex 610
Model "wolfman_christmas_2017_lod_01.gr2"
SourceSkin "wolfman_christmas_2017_silver.dds"
TargetSkin "wolfman_christmas_2017_red.dds"
}
Group ShapeData183
{
ShapeIndex 611
Model "wolfman_easter_day_2018.gr2"
SourceSkin "wolfman_easter_day_2018_1.dds"
TargetSkin "wolfman_easter_day_2018_2.dds"
}
Group ShapeData184
{
ShapeIndex 612
Model "wolfman_halloween_2016.gr2"
SourceSkin "wolfman_halloween_2016_silver.dds"
TargetSkin "wolfman_halloween_2016_red.dds"
}
Group ShapeData185
{
ShapeIndex 613
Model "wolfman_ramadan_2018.gr2"
SourceSkin "wolfman_ramadan_2018_1.dds"
TargetSkin "wolfman_ramadan_2018_2.dds"
}
Group ShapeData186
{
ShapeIndex 614
Model "wolfman_summer_2017.gr2"
SourceSkin "wolfman_summer_2017_1.dds"
TargetSkin "wolfman_summer_2017_2.dds"
}
Group ShapeData187
{
ShapeIndex 615
Model "wolfman_easter_day_2017.gr2"
SourceSkin "wolfman_easter_day_2017_1.dds"
TargetSkin "wolfman_easter_day_2017_2.dds"
}
}
Group AttachingData
{
AttachingDataCount 2
Group AttachingData00
{
AttachingDataType 1
isAttaching 0
AttachingModelIndex 0
AttachingBoneName "Bip01"
CollisionType 1
SphereDataCount 1
Group SphereData00
{
Radius 40.000000
Position 0.000000 0.000000 100.000000
}
}
Group AttachingData01
{
AttachingDataType 1
isAttaching 0
AttachingModelIndex 0
AttachingBoneName "Bip01"
CollisionType 3
SphereDataCount 1
Group SphereData00
{
Radius 70.000000
Position 0.000000 0.000000 100.000000
}
}
}