Graphics/InstancedRenderable: Add signal to tell some renderables need to be rebuild
This commit is contained in:
@@ -68,6 +68,7 @@ namespace Nz
|
||||
{
|
||||
UInt32 renderMask = 0;
|
||||
|
||||
NazaraSlot(InstancedRenderable, OnElementInvalidated, onElementInvalidated);
|
||||
NazaraSlot(InstancedRenderable, OnMaterialInvalidated, onMaterialInvalidated);
|
||||
};
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace Nz
|
||||
InstancedRenderable& operator=(InstancedRenderable&&) noexcept = default;
|
||||
|
||||
NazaraSignal(OnAABBUpdate, InstancedRenderable* /*instancedRenderable*/, const Boxf& /*aabb*/);
|
||||
NazaraSignal(OnElementInvalidated, InstancedRenderable* /*instancedRenderable*/);
|
||||
NazaraSignal(OnMaterialInvalidated, InstancedRenderable* /*instancedRenderable*/, std::size_t /*materialIndex*/, const std::shared_ptr<Material>& /*newMaterial*/);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -56,19 +56,20 @@ namespace Nz
|
||||
|
||||
vertices++;
|
||||
vertices->color = m_color * m_cornerColor[UnderlyingCast(RectCorner::LeftBottom)];
|
||||
vertices->position = m_size.y * Vector3f::Down() - origin;
|
||||
vertices->position = m_size.y * Vector3f::Up() - origin;
|
||||
vertices->uv = m_textureCoords.GetCorner(RectCorner::LeftBottom);
|
||||
|
||||
aabb.ExtendTo(vertices->position);
|
||||
|
||||
vertices++;
|
||||
vertices->color = m_color * m_cornerColor[UnderlyingCast(RectCorner::RightBottom)];
|
||||
vertices->position = m_size.x * Vector3f::Right() + m_size.y * Vector3f::Down() - origin;
|
||||
vertices->position = m_size.x * Vector3f::Right() + m_size.y * Vector3f::Up() - origin;
|
||||
vertices->uv = m_textureCoords.GetCorner(RectCorner::RightBottom);
|
||||
|
||||
aabb.ExtendTo(vertices->position);
|
||||
|
||||
UpdateAABB(aabb);
|
||||
OnElementInvalidated(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace Nz
|
||||
{
|
||||
m_atlases.clear();
|
||||
m_vertices.clear();
|
||||
OnElementInvalidated(this);
|
||||
}
|
||||
|
||||
inline void TextSprite::SetMaterial(std::shared_ptr<Material> material)
|
||||
|
||||
Reference in New Issue
Block a user