Implement cross-platform SpeedTree runtime and recovery tests

Add bounded SPT parsing, authored branch frames and foliage generation, independent LOD meshes, billboards, collision metadata, and legacy CPU/shader wind support. Restore seeded sampling and special leaf selection with generation diagnostics and reproducible baseline tools.

Include regression coverage and static recovery documentation describing remaining differences from the original runtime. SDK tests pass (4/4); full corpus and client validation are recorded in the recovery notes.
This commit is contained in:
shen
2026-10-12 18:52:02 -07:00
parent 53115d9ea2
commit 66992b3024
24 changed files with 3113 additions and 301 deletions
+16 -6
View File
@@ -2,6 +2,7 @@
#include <cassert>
#include <cmath>
#include <iostream>
#include <cstring>
void TestProceduralTree() {
std::cout << "[Test] Procedural Tree Generation..." << std::endl;
@@ -63,20 +64,29 @@ void TestSptTokenSniffing() {
buffer.insert(buffer.end(), b, b + 4);
};
push_i32(1000);
std::string signature = "__IdvSpt_02_";
push_i32(static_cast<int32_t>(signature.size()));
buffer.insert(buffer.end(), signature.begin(), signature.end());
push_i32(1002);
// Token 2000: bark name "custom_bark.dds"
std::string bark_str = "custom_bark.dds";
push_i32(2000);
push_i32(static_cast<int32_t>(bark_str.size()));
buffer.insert(buffer.end(), bark_str.begin(), bark_str.end());
// Token 2001: size 850.0f
push_i32(2001);
// Token 2006: size 850.0f
push_i32(2006);
push_f32(850.0f);
// Token 2002: variance 50.0f
push_i32(2002);
// Token 2007: variance 50.0f
push_i32(2007);
push_f32(50.0f);
push_i32(1003);
push_i32(1001);
speedtree::SpeedTreeSptInfo info;
bool ok = speedtree::SpeedTreeSptInfo::SniffMemory(buffer.data(), buffer.size(), info);
assert(ok);
@@ -92,8 +102,8 @@ void TestForestManagement() {
speedtree::SpeedTreeForest forest;
assert(forest.GetInstanceCount() == 0);
forest.RegisterPropertyData(speedtree::SpeedTreeProperty{1, "Pine", "pine.spt", 1000.0f, 0.0f});
assert(forest.HasMainTree(1));
assert(!forest.RegisterPropertyData(speedtree::SpeedTreeProperty{1, "Pine", "missing_test_pine.spt", 1000.0f, 0.0f}));
assert(!forest.HasMainTree(1));
auto* inst1 = forest.CreateInstance(100.0f, 0.0f, 200.0f, 1, 45.0f, 1.2f, "ForestPine1");
auto* inst2 = forest.CreateInstance(300.0f, 0.0f, 400.0f, 1, 90.0f, 0.9f, "ForestPine2");