Graphics/InstancedRenderable: Make SetMaterial methods public
This commit is contained in:
parent
f5645833df
commit
2f0c62df20
|
|
@ -108,6 +108,7 @@ Nazara Engine:
|
||||||
- Added AbstractViewer::ProjectDepth method
|
- Added AbstractViewer::ProjectDepth method
|
||||||
- Fixed SocketPoller not be able to recover from some errors (like invalid sockets and such)
|
- Fixed SocketPoller not be able to recover from some errors (like invalid sockets and such)
|
||||||
- ⚠️ Replaced currentBitPos and currentByte fields by [read|write][BitPos][Byte] to handle properly bit reading/writing.
|
- ⚠️ Replaced currentBitPos and currentByte fields by [read|write][BitPos][Byte] to handle properly bit reading/writing.
|
||||||
|
- InstancedRenderable::SetMaterial methods are now public.
|
||||||
|
|
||||||
Nazara Development Kit:
|
Nazara Development Kit:
|
||||||
- Added ImageWidget (#139)
|
- Added ImageWidget (#139)
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,8 @@ namespace Nz
|
||||||
|
|
||||||
virtual void InvalidateData(InstanceData* instanceData, UInt32 flags) const;
|
virtual void InvalidateData(InstanceData* instanceData, UInt32 flags) const;
|
||||||
|
|
||||||
|
inline void SetMaterial(std::size_t matIndex, MaterialRef material);
|
||||||
|
inline void SetMaterial(std::size_t skinIndex, std::size_t matIndex, MaterialRef material);
|
||||||
inline void SetSkin(std::size_t skinIndex);
|
inline void SetSkin(std::size_t skinIndex);
|
||||||
inline void SetSkinCount(std::size_t skinCount);
|
inline void SetSkinCount(std::size_t skinCount);
|
||||||
|
|
||||||
|
|
@ -108,9 +110,6 @@ namespace Nz
|
||||||
|
|
||||||
inline void ResetMaterials(std::size_t matCount, std::size_t skinCount = 1);
|
inline void ResetMaterials(std::size_t matCount, std::size_t skinCount = 1);
|
||||||
|
|
||||||
inline void SetMaterial(std::size_t matIndex, MaterialRef material);
|
|
||||||
inline void SetMaterial(std::size_t skinIndex, std::size_t matIndex, MaterialRef material);
|
|
||||||
|
|
||||||
mutable BoundingVolumef m_boundingVolume;
|
mutable BoundingVolumef m_boundingVolume;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,51 @@ namespace Nz
|
||||||
return m_skinCount;
|
return m_skinCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Changes the material used at the specified index by another one
|
||||||
|
*
|
||||||
|
* This function changes the active material at the specified index, depending on the current active skin, to the one passed as parameter.
|
||||||
|
*
|
||||||
|
* \param matIndex Material index
|
||||||
|
* \param material New material, cannot be null
|
||||||
|
*
|
||||||
|
* \remark If you wish to reset the material to the default one, use the default material (see Material::GetDefault)
|
||||||
|
*
|
||||||
|
* \see SetMaterial
|
||||||
|
*/
|
||||||
|
inline void InstancedRenderable::SetMaterial(std::size_t matIndex, MaterialRef material)
|
||||||
|
{
|
||||||
|
SetMaterial(m_skin, matIndex, std::move(material));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Changes the material used at the specified index by another one, independently from the active skin.
|
||||||
|
*
|
||||||
|
* This function changes the active material at the specified index and for the specified skin index, to the one passed as parameter.
|
||||||
|
*
|
||||||
|
* \param skinIndex Skin index
|
||||||
|
* \param matIndex Material index
|
||||||
|
* \param material New material, cannot be null
|
||||||
|
*
|
||||||
|
* \remark If you wish to reset the material to the default one, use the default material (see Material::GetDefault)
|
||||||
|
*
|
||||||
|
* \see SetMaterial
|
||||||
|
*/
|
||||||
|
inline void InstancedRenderable::SetMaterial(std::size_t skinIndex, std::size_t matIndex, MaterialRef material)
|
||||||
|
{
|
||||||
|
NazaraAssert(skinIndex < m_skinCount, "Skin index out of bounds");
|
||||||
|
NazaraAssert(matIndex < m_materials.size(), "Material index out of bounds");
|
||||||
|
NazaraAssert(material.IsValid(), "Material must be valid");
|
||||||
|
|
||||||
|
MaterialRef& matEntry = m_materials[m_matCount * skinIndex + matIndex];
|
||||||
|
if (matEntry != material)
|
||||||
|
{
|
||||||
|
OnInstancedRenderableInvalidateMaterial(this, skinIndex, matIndex, material);
|
||||||
|
|
||||||
|
matEntry = std::move(material);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Changes the active skin
|
* \brief Changes the active skin
|
||||||
*
|
*
|
||||||
|
|
@ -201,51 +246,6 @@ namespace Nz
|
||||||
m_skin = 0;
|
m_skin = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Changes the material used at the specified index by another one
|
|
||||||
*
|
|
||||||
* This function changes the active material at the specified index, depending on the current active skin, to the one passed as parameter.
|
|
||||||
*
|
|
||||||
* \param matIndex Material index
|
|
||||||
* \param material New material, cannot be null
|
|
||||||
*
|
|
||||||
* \remark If you wish to reset the material to the default one, use the default material (see Material::GetDefault)
|
|
||||||
*
|
|
||||||
* \see SetMaterial
|
|
||||||
*/
|
|
||||||
inline void InstancedRenderable::SetMaterial(std::size_t matIndex, MaterialRef material)
|
|
||||||
{
|
|
||||||
SetMaterial(m_skin, matIndex, std::move(material));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Changes the material used at the specified index by another one, independently from the active skin.
|
|
||||||
*
|
|
||||||
* This function changes the active material at the specified index and for the specified skin index, to the one passed as parameter.
|
|
||||||
*
|
|
||||||
* \param skinIndex Skin index
|
|
||||||
* \param matIndex Material index
|
|
||||||
* \param material New material, cannot be null
|
|
||||||
*
|
|
||||||
* \remark If you wish to reset the material to the default one, use the default material (see Material::GetDefault)
|
|
||||||
*
|
|
||||||
* \see SetMaterial
|
|
||||||
*/
|
|
||||||
inline void InstancedRenderable::SetMaterial(std::size_t skinIndex, std::size_t matIndex, MaterialRef material)
|
|
||||||
{
|
|
||||||
NazaraAssert(skinIndex < m_skinCount, "Skin index out of bounds");
|
|
||||||
NazaraAssert(matIndex < m_materials.size(), "Material index out of bounds");
|
|
||||||
NazaraAssert(material.IsValid(), "Material must be valid");
|
|
||||||
|
|
||||||
MaterialRef& matEntry = m_materials[m_matCount * skinIndex + matIndex];
|
|
||||||
if (matEntry != material)
|
|
||||||
{
|
|
||||||
OnInstancedRenderableInvalidateMaterial(this, skinIndex, matIndex, material);
|
|
||||||
|
|
||||||
matEntry = std::move(material);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Sets the current instanced renderable with the content of the other one
|
* \brief Sets the current instanced renderable with the content of the other one
|
||||||
* \return A reference to this
|
* \return A reference to this
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue