Merge remote-tracking branch 'refs/remotes/origin/master' into gui
Former-commit-id: 0cddd4efb12e38d9cceead424fd81f4939707542 [formerly 18a8f78457314e51a04ea89f08667d43ca79357c] [formerly cdb38b3e376619863941e051c571f0ef67c6cb0b [formerly 270e21a0e26acc827015b606049714c0ce28f508]] Former-commit-id: 6e5b36578ab62d34272f27806d26a1b770653991 [formerly f261a7fd51dfe61c99b0c2f72b46d03c1b7f786f] Former-commit-id: c14259a2f894eb3956cb5a34345c3ebca7dc0d50
This commit is contained in:
commit
6e520f5ed6
|
|
@ -158,6 +158,9 @@ namespace Ndk
|
||||||
|
|
||||||
UnregisterAllHandles();
|
UnregisterAllHandles();
|
||||||
|
|
||||||
|
m_components.clear();
|
||||||
|
m_componentBits.Reset();
|
||||||
|
|
||||||
m_valid = false;
|
m_valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
version: '{branch}-rev{build}'
|
||||||
|
|
||||||
|
shallow_clone: true
|
||||||
|
|
||||||
|
os:
|
||||||
|
- Visual Studio 2015
|
||||||
|
|
||||||
|
environment:
|
||||||
|
matrix:
|
||||||
|
- TOOLSET: vs2015
|
||||||
|
|
||||||
|
install:
|
||||||
|
- cd build && "./premake5.exe" %TOOLSET% && cd ..
|
||||||
|
|
||||||
|
configuration:
|
||||||
|
- DebugDynamic
|
||||||
|
- ReleaseDynamic
|
||||||
|
|
||||||
|
build:
|
||||||
|
project: build/$(TOOLSET)/NazaraEngine.sln
|
||||||
|
|
@ -37,12 +37,14 @@ namespace Nz
|
||||||
void AddToRenderQueue(AbstractRenderQueue* renderQueue, const InstanceData& instanceData) const override;
|
void AddToRenderQueue(AbstractRenderQueue* renderQueue, const InstanceData& instanceData) const override;
|
||||||
|
|
||||||
inline const Color& GetColor() const;
|
inline const Color& GetColor() const;
|
||||||
|
inline const Color& GetCornerColor(RectCorner corner) const;
|
||||||
inline const MaterialRef& GetMaterial() const;
|
inline const MaterialRef& GetMaterial() const;
|
||||||
inline const Vector3f& GetOrigin() const;
|
inline const Vector3f& GetOrigin() const;
|
||||||
inline const Vector2f& GetSize() const;
|
inline const Vector2f& GetSize() const;
|
||||||
inline const Rectf& GetTextureCoords() const;
|
inline const Rectf& GetTextureCoords() const;
|
||||||
|
|
||||||
inline void SetColor(const Color& color);
|
inline void SetColor(const Color& color);
|
||||||
|
inline void SetCornerColor(RectCorner corner, const Color& color);
|
||||||
inline void SetDefaultMaterial();
|
inline void SetDefaultMaterial();
|
||||||
inline void SetMaterial(MaterialRef material, bool resizeSprite = true);
|
inline void SetMaterial(MaterialRef material, bool resizeSprite = true);
|
||||||
inline void SetOrigin(const Vector3f& origin);
|
inline void SetOrigin(const Vector3f& origin);
|
||||||
|
|
@ -65,6 +67,7 @@ namespace Nz
|
||||||
static bool Initialize();
|
static bool Initialize();
|
||||||
static void Uninitialize();
|
static void Uninitialize();
|
||||||
|
|
||||||
|
std::array<Color, 4> m_cornerColor;
|
||||||
Color m_color;
|
Color m_color;
|
||||||
MaterialRef m_material;
|
MaterialRef m_material;
|
||||||
Rectf m_textureCoords;
|
Rectf m_textureCoords;
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ namespace Nz
|
||||||
m_size(64.f, 64.f),
|
m_size(64.f, 64.f),
|
||||||
m_origin(Nz::Vector3f::Zero())
|
m_origin(Nz::Vector3f::Zero())
|
||||||
{
|
{
|
||||||
|
for (Color& color : m_cornerColor)
|
||||||
|
color = Color::White;
|
||||||
|
|
||||||
SetDefaultMaterial();
|
SetDefaultMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -62,14 +65,35 @@ namespace Nz
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Gets the color of the sprite
|
* \brief Gets the color of the sprite
|
||||||
|
*
|
||||||
|
* This is the global color of the sprite, independent from corner colors
|
||||||
|
*
|
||||||
* \return Current color
|
* \return Current color
|
||||||
|
*
|
||||||
|
* \see GetCornerColor
|
||||||
|
* \see SetColor
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline const Color& Sprite::GetColor() const
|
inline const Color& Sprite::GetColor() const
|
||||||
{
|
{
|
||||||
return m_color;
|
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(corner < m_cornerColor.size(), "Invalid corner");
|
||||||
|
|
||||||
|
return m_cornerColor[corner];
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Gets the material of the sprite
|
* \brief Gets the material of the sprite
|
||||||
* \return Current material
|
* \return Current material
|
||||||
|
|
@ -105,18 +129,21 @@ namespace Nz
|
||||||
* \brief Gets the texture coordinates of the sprite
|
* \brief Gets the texture coordinates of the sprite
|
||||||
* \return Current texture coordinates
|
* \return Current texture coordinates
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline const Rectf& Sprite::GetTextureCoords() const
|
inline const Rectf& Sprite::GetTextureCoords() const
|
||||||
{
|
{
|
||||||
return m_textureCoords;
|
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)
|
inline void Sprite::SetColor(const Color& color)
|
||||||
{
|
{
|
||||||
m_color = color;
|
m_color = color;
|
||||||
|
|
@ -124,6 +151,26 @@ namespace Nz
|
||||||
InvalidateVertices();
|
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(corner < m_cornerColor.size(), "Invalid corner");
|
||||||
|
|
||||||
|
m_cornerColor[corner] = color;
|
||||||
|
|
||||||
|
InvalidateVertices();
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Sets the default material of the sprite (just default material)
|
* \brief Sets the default material of the sprite (just default material)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,6 @@ namespace Nz
|
||||||
*
|
*
|
||||||
* \param instanceData Data of the instance
|
* \param instanceData Data of the instance
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void Sprite::UpdateData(InstanceData* instanceData) const
|
void Sprite::UpdateData(InstanceData* instanceData) const
|
||||||
{
|
{
|
||||||
instanceData->data.resize(4 * sizeof(VertexStruct_XYZ_Color_UV));
|
instanceData->data.resize(4 * sizeof(VertexStruct_XYZ_Color_UV));
|
||||||
|
|
@ -61,19 +60,19 @@ namespace Nz
|
||||||
|
|
||||||
Vector3f origin(m_origin.x, -m_origin.y, m_origin.z);
|
Vector3f origin(m_origin.x, -m_origin.y, m_origin.z);
|
||||||
|
|
||||||
*colorPtr++ = m_color;
|
*colorPtr++ = m_color * m_cornerColor[RectCorner_LeftTop];
|
||||||
*posPtr++ = instanceData->transformMatrix.Transform(Vector3f(-origin));
|
*posPtr++ = instanceData->transformMatrix.Transform(Vector3f(-origin));
|
||||||
*texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_LeftTop);
|
*texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_LeftTop);
|
||||||
|
|
||||||
*colorPtr++ = m_color;
|
*colorPtr++ = m_color * m_cornerColor[RectCorner_RightTop];
|
||||||
*posPtr++ = instanceData->transformMatrix.Transform(m_size.x*Vector3f::Right() - origin);
|
*posPtr++ = instanceData->transformMatrix.Transform(m_size.x*Vector3f::Right() - origin);
|
||||||
*texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_RightTop);
|
*texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_RightTop);
|
||||||
|
|
||||||
*colorPtr++ = m_color;
|
*colorPtr++ = m_color * m_cornerColor[RectCorner_LeftBottom];
|
||||||
*posPtr++ = instanceData->transformMatrix.Transform(m_size.y*Vector3f::Down() - origin);
|
*posPtr++ = instanceData->transformMatrix.Transform(m_size.y*Vector3f::Down() - origin);
|
||||||
*texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_LeftBottom);
|
*texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_LeftBottom);
|
||||||
|
|
||||||
*colorPtr++ = m_color;
|
*colorPtr++ = m_color * m_cornerColor[RectCorner_RightBottom];
|
||||||
*posPtr++ = instanceData->transformMatrix.Transform(m_size.x*Vector3f::Right() + m_size.y*Vector3f::Down() - origin);
|
*posPtr++ = instanceData->transformMatrix.Transform(m_size.x*Vector3f::Right() + m_size.y*Vector3f::Down() - origin);
|
||||||
*texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_RightBottom);
|
*texCoordPtr++ = m_textureCoords.GetCorner(RectCorner_RightBottom);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue