修改OpenGl渲染底层之前

This commit is contained in:
2025-10-20 20:50:12 +08:00
parent 1b011b9b68
commit 2b888aae5b
61 changed files with 1609 additions and 680 deletions

View File

@@ -32,6 +32,18 @@ void BaseNode::Update(float deltaTime)
}
}
void BaseNode::PreRender()
{
// 如果有子节点并含有渲染标签,则渲染子节点
RefPtr<BaseNode> child = m_BaseNodes.GetFirst();
while (child)
{
if (child->hasTag(Tag::RENDER))
child->PreRender();
child = child->GetNext();
}
}
void BaseNode::Render()
{
// 如果有子节点并含有渲染标签,则渲染子节点
@@ -150,6 +162,11 @@ void BaseNode::RemoveChild(RefPtr<BaseNode> child)
m_BaseNodes.Remove(child);
}
void BaseNode::RemoveAllChild()
{
m_BaseNodes.Clear();
}
void BaseNode::OnAdded(BaseNode *node)
{
m_Parent = node;
@@ -197,6 +214,11 @@ VecFPos BaseNode::GetPos()
return this->transform.position;
}
VecFPos BaseNode::GetWorldPos()
{
return this->transform.position + this->transformIter.position;
}
void BaseNode::SetScale(VecFPos scale)
{
if (scale == this->transform.scale)
@@ -261,6 +283,16 @@ bool BaseNode::GetVisible()
return this->Visible;
}
void BaseNode::SetAlpha(float alpha)
{
this->Alpha = alpha;
}
float BaseNode::GetAlpha()
{
return this->Alpha;
}
void BaseNode::SetIterationPos(VecFPos pos)
{
if (pos == this->transformIter.position)