Minor fixes
This commit is contained in:
@@ -16,9 +16,15 @@ namespace Nz
|
||||
inline void Model::SetMaterial(std::size_t subMeshIndex, std::shared_ptr<Material> material)
|
||||
{
|
||||
assert(subMeshIndex < m_submeshes.size());
|
||||
assert(material);
|
||||
|
||||
OnMaterialInvalidated(this, subMeshIndex, material);
|
||||
m_submeshes[subMeshIndex].material = std::move(material);
|
||||
if (m_submeshes[subMeshIndex].material != material)
|
||||
{
|
||||
OnMaterialInvalidated(this, 0, material);
|
||||
m_submeshes[subMeshIndex].material = std::move(material);
|
||||
|
||||
OnElementInvalidated(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ namespace Nz
|
||||
|
||||
inline const Color& GetColor() const;
|
||||
inline const Color& GetCornerColor(RectCorner corner) const;
|
||||
const std::shared_ptr<Material>& GetMaterial(std::size_t i = 0) const;
|
||||
std::size_t GetMaterialCount() const;
|
||||
const std::shared_ptr<Material>& GetMaterial(std::size_t i = 0) const override;
|
||||
std::size_t GetMaterialCount() const override;
|
||||
inline const Rectf& GetTextureCoords() const;
|
||||
Vector3ui GetTextureSize() const;
|
||||
|
||||
|
||||
@@ -41,7 +41,13 @@ namespace Nz
|
||||
{
|
||||
assert(material);
|
||||
|
||||
m_material = std::move(material);
|
||||
if (m_material != material)
|
||||
{
|
||||
OnMaterialInvalidated(this, 0, material);
|
||||
m_material = std::move(material);
|
||||
|
||||
OnElementInvalidated(this);
|
||||
}
|
||||
}
|
||||
|
||||
inline void Sprite::SetSize(const Vector2f& size)
|
||||
@@ -68,7 +74,7 @@ namespace Nz
|
||||
{
|
||||
VertexStruct_XYZ_Color_UV* vertices = m_vertices.data();
|
||||
|
||||
Vector3f origin = Vector3f::Zero();
|
||||
Vector3f origin = Vector3f::Zero(); //< TODO
|
||||
Boxf aabb;
|
||||
|
||||
vertices->color = m_color * m_cornerColor[UnderlyingCast(RectCorner::LeftBottom)];
|
||||
|
||||
@@ -32,8 +32,8 @@ namespace Nz
|
||||
|
||||
inline void Clear();
|
||||
|
||||
const std::shared_ptr<Material>& GetMaterial(std::size_t i) const;
|
||||
std::size_t GetMaterialCount() const;
|
||||
const std::shared_ptr<Material>& GetMaterial(std::size_t i = 0) const override;
|
||||
std::size_t GetMaterialCount() const override;
|
||||
|
||||
inline void SetMaterial(std::shared_ptr<Material> material);
|
||||
|
||||
|
||||
@@ -17,7 +17,15 @@ namespace Nz
|
||||
|
||||
inline void TextSprite::SetMaterial(std::shared_ptr<Material> material)
|
||||
{
|
||||
m_material = std::move(material);
|
||||
assert(material);
|
||||
|
||||
if (m_material != material)
|
||||
{
|
||||
OnMaterialInvalidated(this, 0, material);
|
||||
m_material = std::move(material);
|
||||
|
||||
OnElementInvalidated(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user