From 2fb7913b0749bcfd50ef8a1c33ad609509f43ed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 7 Jun 2018 18:34:58 +0200 Subject: [PATCH] Trade: return Color4 from PhongMaterialData. A breaking change, sorry everyone. It had to be done and there was no other way. --- doc/changelog.dox | 4 ++++ src/Magnum/Trade/PhongMaterialData.cpp | 6 +++--- src/Magnum/Trade/PhongMaterialData.h | 20 ++++++++++---------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/doc/changelog.dox b/doc/changelog.dox index 98a305829..a7a7fd114 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -125,6 +125,10 @@ See also: - @ref Audio::Playable is now by default omnidirectional instead of having source in direction of negative Z axis (the direction has effect only when setting inner and outer cone properties of @ref Audio::Source). +- @ref Trade::PhongMaterialData::ambientColor(), + @ref Trade::PhongMaterialData::diffuseColor() "diffuseColor()" and + @ref Trade::PhongMaterialData::specularColor() "specularColor()" now return + @ref Color4 instead of @ref Color3 @section changelog-2018-04 2018.04 diff --git a/src/Magnum/Trade/PhongMaterialData.cpp b/src/Magnum/Trade/PhongMaterialData.cpp index f2679b8c7..3b5757c93 100644 --- a/src/Magnum/Trade/PhongMaterialData.cpp +++ b/src/Magnum/Trade/PhongMaterialData.cpp @@ -70,7 +70,7 @@ PhongMaterialData& PhongMaterialData::operator=(PhongMaterialData&& other) noexc return *this; } -Color3& PhongMaterialData::ambientColor() { +Color4& PhongMaterialData::ambientColor() { CORRADE_ASSERT(!(_flags & Flag::AmbientTexture), "Trade::PhongMaterialData::ambientColor(): the material has ambient texture", _ambient.color); return _ambient.color; } @@ -80,7 +80,7 @@ UnsignedInt& PhongMaterialData::ambientTexture() { return _ambient.texture; } -Color3& PhongMaterialData::diffuseColor() { +Color4& PhongMaterialData::diffuseColor() { CORRADE_ASSERT(!(_flags & Flag::DiffuseTexture), "Trade::PhongMaterialData::diffuseColor(): the material has diffuse texture", _diffuse.color); return _diffuse.color; } @@ -90,7 +90,7 @@ UnsignedInt& PhongMaterialData::diffuseTexture() { return _diffuse.texture; } -Color3& PhongMaterialData::specularColor() { +Color4& PhongMaterialData::specularColor() { CORRADE_ASSERT(!(_flags & Flag::SpecularTexture), "Trade::PhongMaterialData::specularColor(): the material has specular texture", _specular.color); return _specular.color; } diff --git a/src/Magnum/Trade/PhongMaterialData.h b/src/Magnum/Trade/PhongMaterialData.h index c813058f6..aef45b137 100644 --- a/src/Magnum/Trade/PhongMaterialData.h +++ b/src/Magnum/Trade/PhongMaterialData.h @@ -96,8 +96,8 @@ class MAGNUM_TRADE_EXPORT PhongMaterialData: public AbstractMaterialData { * Available only if the material doesn't have @ref Flag::AmbientTexture. * @see @ref flags() */ - Color3& ambientColor(); - Color3 ambientColor() const; /**< @overload */ + Color4& ambientColor(); + Color4 ambientColor() const; /**< @overload */ /** * @brief Ambient texture ID @@ -114,8 +114,8 @@ class MAGNUM_TRADE_EXPORT PhongMaterialData: public AbstractMaterialData { * Available only if the material doesn't have @ref Flag::DiffuseTexture. * @see @ref flags() */ - Color3& diffuseColor(); - Color3 diffuseColor() const; /**< @overload */ + Color4& diffuseColor(); + Color4 diffuseColor() const; /**< @overload */ /** * @brief Diffuse texture ID @@ -132,8 +132,8 @@ class MAGNUM_TRADE_EXPORT PhongMaterialData: public AbstractMaterialData { * Available only if the material doesn't have @ref Flag::SpecularTexture. * @see @ref flags() */ - Color3& specularColor(); - Color3 specularColor() const; /**< @overload */ + Color4& specularColor(); + Color4 specularColor() const; /**< @overload */ /** * @brief Specular texture ID @@ -151,7 +151,7 @@ class MAGNUM_TRADE_EXPORT PhongMaterialData: public AbstractMaterialData { union Source { Source() {} - Color3 color; + Color4 color; UnsignedInt texture; }; @@ -172,7 +172,7 @@ MAGNUM_TRADE_EXPORT Debug& operator<<(Debug& debug, PhongMaterialData::Flags val /* Ugly as hell. */ -inline Color3 PhongMaterialData::ambientColor() const { +inline Color4 PhongMaterialData::ambientColor() const { return const_cast(this)->ambientColor(); } @@ -180,7 +180,7 @@ inline UnsignedInt PhongMaterialData::ambientTexture() const { return const_cast(this)->ambientTexture(); } -inline Color3 PhongMaterialData::diffuseColor() const { +inline Color4 PhongMaterialData::diffuseColor() const { return const_cast(this)->diffuseColor(); } @@ -188,7 +188,7 @@ inline UnsignedInt PhongMaterialData::diffuseTexture() const { return const_cast(this)->diffuseTexture(); } -inline Color3 PhongMaterialData::specularColor() const { +inline Color4 PhongMaterialData::specularColor() const { return const_cast(this)->specularColor(); }