feat: add explicit camera clear modes

This commit is contained in:
2026-04-01 01:33:46 +08:00
parent 96a66d6f6d
commit 51736253e3
5 changed files with 65 additions and 2 deletions

View File

@@ -33,6 +33,7 @@ void CameraComponent::Serialize(std::ostream& os) const {
os << "far=" << m_farClipPlane << ";";
os << "depth=" << m_depth << ";";
os << "primary=" << (m_primary ? 1 : 0) << ";";
os << "clearMode=" << static_cast<int>(m_clearMode) << ";";
os << "clearColor=" << m_clearColor.r << "," << m_clearColor.g << "," << m_clearColor.b << "," << m_clearColor.a << ";";
}
@@ -65,6 +66,8 @@ void CameraComponent::Deserialize(std::istream& is) {
m_depth = std::stof(value);
} else if (key == "primary") {
m_primary = (std::stoi(value) != 0);
} else if (key == "clearMode") {
m_clearMode = static_cast<CameraClearMode>(std::stoi(value));
} else if (key == "clearColor") {
std::replace(value.begin(), value.end(), ',', ' ');
std::istringstream ss(value);