Merge remote-tracking branch 'refs/remotes/origin/master' into culling
Former-commit-id: aba6d0b80da45f6777eb11e79005c05545672fda [formerly f4d46f6a47404303b4674e67e3ccd2d6ffd66cc3] [formerly 8a79abc5e2f7b6fbe2796270bdd552984d6a3b25 [formerly 256aedf9b318049a358c9423695f7d91fc1588ab]] Former-commit-id: 19d7630338579c9d70cd26f11f3adc7c523f86d3 [formerly a2a03d193faabbfe50dcd6faada76e64d6f7f89b] Former-commit-id: 248583a9009304dbc0231f8f9c14d17e81615e35
This commit is contained in:
@@ -37,12 +37,14 @@ namespace Nz
|
||||
void AddToRenderQueue(AbstractRenderQueue* renderQueue, const InstanceData& instanceData) const override;
|
||||
|
||||
inline const Color& GetColor() const;
|
||||
inline const Color& GetCornerColor(RectCorner corner) const;
|
||||
inline const MaterialRef& GetMaterial() const;
|
||||
inline const Vector3f& GetOrigin() const;
|
||||
inline const Vector2f& GetSize() const;
|
||||
inline const Rectf& GetTextureCoords() const;
|
||||
|
||||
inline void SetColor(const Color& color);
|
||||
inline void SetCornerColor(RectCorner corner, const Color& color);
|
||||
inline void SetDefaultMaterial();
|
||||
inline void SetMaterial(MaterialRef material, bool resizeSprite = true);
|
||||
inline void SetOrigin(const Vector3f& origin);
|
||||
@@ -65,6 +67,7 @@ namespace Nz
|
||||
static bool Initialize();
|
||||
static void Uninitialize();
|
||||
|
||||
std::array<Color, 4> m_cornerColor;
|
||||
Color m_color;
|
||||
MaterialRef m_material;
|
||||
Rectf m_textureCoords;
|
||||
|
||||
@@ -18,6 +18,9 @@ namespace Nz
|
||||
m_size(64.f, 64.f),
|
||||
m_origin(Nz::Vector3f::Zero())
|
||||
{
|
||||
for (Color& color : m_cornerColor)
|
||||
color = Color::White;
|
||||
|
||||
SetDefaultMaterial();
|
||||
}
|
||||
|
||||
@@ -62,14 +65,35 @@ namespace Nz
|
||||
|
||||
/*!
|
||||
* \brief Gets the color of the sprite
|
||||
*
|
||||
* This is the global color of the sprite, independent from corner colors
|
||||
*
|
||||
* \return Current color
|
||||
*
|
||||
* \see GetCornerColor
|
||||
* \see SetColor
|
||||
*/
|
||||
|
||||
inline const Color& Sprite::GetColor() const
|
||||
{
|
||||
return m_color;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the color setup on a corner of the sprite
|
||||
*
|
||||
* \return Current color
|
||||
*
|
||||
* \param corner Corner of the sprite to query
|
||||
*
|
||||
* \see SetCornerColor
|
||||
*/
|
||||
inline const Color& Sprite::GetCornerColor(RectCorner corner) const
|
||||
{
|
||||
NazaraAssert(static_cast<std::size_t>(corner) < m_cornerColor.size(), "Invalid corner");
|
||||
|
||||
return m_cornerColor[corner];
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the material of the sprite
|
||||
* \return Current material
|
||||
@@ -86,7 +110,7 @@ namespace Nz
|
||||
*
|
||||
* \see SetOrigin
|
||||
*/
|
||||
inline const Vector3f & Sprite::GetOrigin() const
|
||||
inline const Vector3f& Sprite::GetOrigin() const
|
||||
{
|
||||
return m_origin;
|
||||
}
|
||||
@@ -105,18 +129,21 @@ namespace Nz
|
||||
* \brief Gets the texture coordinates of the sprite
|
||||
* \return Current texture coordinates
|
||||
*/
|
||||
|
||||
inline const Rectf& Sprite::GetTextureCoords() const
|
||||
{
|
||||
return m_textureCoords;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the color of the billboard
|
||||
* \brief Sets the global color of the sprite
|
||||
*
|
||||
* \param color Color for the billboard
|
||||
* This is independent from the corner color of the sprite
|
||||
*
|
||||
* \param color Color for the sprite
|
||||
*
|
||||
* \see GetColor
|
||||
* \see SetCornerColor
|
||||
*/
|
||||
|
||||
inline void Sprite::SetColor(const Color& color)
|
||||
{
|
||||
m_color = color;
|
||||
@@ -124,6 +151,26 @@ namespace Nz
|
||||
InvalidateVertices();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets a color for a corner of the sprite
|
||||
*
|
||||
* This is independent from the sprite global color, which gets multiplied by the corner color when rendering the sprite.
|
||||
*
|
||||
* \param corner Corner of the sprite to set
|
||||
* \param color Color for the sprite
|
||||
*
|
||||
* \see GetCornerColor
|
||||
* \see SetColor
|
||||
*/
|
||||
inline void Sprite::SetCornerColor(RectCorner corner, const Color& color)
|
||||
{
|
||||
NazaraAssert(static_cast<std::size_t>(corner) < m_cornerColor.size(), "Invalid corner");
|
||||
|
||||
m_cornerColor[corner] = color;
|
||||
|
||||
InvalidateVertices();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the default material of the sprite (just default material)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user