feat: add camera culling masks

This commit is contained in:
2026-04-01 01:42:06 +08:00
parent 51736253e3
commit 0fe02fd1b4
9 changed files with 81 additions and 3 deletions

View File

@@ -46,6 +46,9 @@ public:
CameraClearMode GetClearMode() const { return m_clearMode; }
void SetClearMode(CameraClearMode value) { m_clearMode = value; }
uint32_t GetCullingMask() const { return m_cullingMask; }
void SetCullingMask(uint32_t value) { m_cullingMask = value; }
const Math::Color& GetClearColor() const { return m_clearColor; }
void SetClearColor(const Math::Color& value) { m_clearColor = value; }
@@ -61,6 +64,7 @@ private:
float m_depth = 0.0f;
bool m_primary = true;
CameraClearMode m_clearMode = CameraClearMode::Auto;
uint32_t m_cullingMask = 0xFFFFFFFFu;
Math::Color m_clearColor = Math::Color(0.192f, 0.302f, 0.475f, 1.0f);
};

View File

@@ -30,6 +30,8 @@ public:
uint64_t GetUUID() const { return m_uuid; }
const std::string& GetName() const { return m_name; }
void SetName(const std::string& name) { m_name = name; }
uint8_t GetLayer() const { return m_layer; }
void SetLayer(uint8_t layer) { m_layer = std::min<uint8_t>(layer, 31u); }
void DetachFromParent();
@@ -217,6 +219,7 @@ private:
std::string m_name;
bool m_activeSelf = true;
bool m_started = false;
uint8_t m_layer = 0;
GameObject* m_parent = nullptr;
std::vector<GameObject*> m_children;

View File

@@ -67,6 +67,7 @@ private:
void ExtractVisibleItems(
Components::GameObject* gameObject,
const Math::Vector3& cameraPosition,
uint32_t cullingMask,
std::vector<VisibleRenderItem>& visibleItems) const;
};