新增程序化立方体与可碎墙验收:Model::CreateCube 五层链路 + WallFracture 碎片刚体群(命中碎裂/径向飞散/寿命清理)
This commit is contained in:
@@ -185,6 +185,23 @@ namespace Engine::Serialization {
|
||||
constexpr std::string_view kPlane = "procedural://plane/";
|
||||
constexpr std::string_view kTPlane =
|
||||
"procedural://transparent-plane/";
|
||||
constexpr std::string_view kCube = "procedural://cube/";
|
||||
|
||||
if (path.rfind(kCube, 0) == 0) {
|
||||
// "{halfSize}/{r},{g},{b}"
|
||||
const std::string rest = path.substr(kCube.size());
|
||||
const auto slash = rest.find('/');
|
||||
if (slash == std::string::npos) return {};
|
||||
int c[3];
|
||||
if (!ParseCsvInts(rest.substr(slash + 1), c)) return {};
|
||||
try {
|
||||
return assets.CreateCube(
|
||||
std::stof(rest.substr(0, slash)),
|
||||
static_cast<u8>(c[0]), static_cast<u8>(c[1]),
|
||||
static_cast<u8>(c[2]));
|
||||
}
|
||||
catch (const std::exception&) { return {}; }
|
||||
}
|
||||
|
||||
if (path.rfind(kTPlane, 0) == 0) {
|
||||
// "{halfSize}/{r},{g},{b},{a}"
|
||||
|
||||
Reference in New Issue
Block a user