Browse Source

Trade: return Color4 from PhongMaterialData.

A breaking change, sorry everyone. It had to be done and there was no
other way.
pull/255/head
Vladimír Vondruš 8 years ago
parent
commit
2fb7913b07
  1. 4
      doc/changelog.dox
  2. 6
      src/Magnum/Trade/PhongMaterialData.cpp
  3. 20
      src/Magnum/Trade/PhongMaterialData.h

4
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

6
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;
}

20
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<PhongMaterialData*>(this)->ambientColor();
}
@ -180,7 +180,7 @@ inline UnsignedInt PhongMaterialData::ambientTexture() const {
return const_cast<PhongMaterialData*>(this)->ambientTexture();
}
inline Color3 PhongMaterialData::diffuseColor() const {
inline Color4 PhongMaterialData::diffuseColor() const {
return const_cast<PhongMaterialData*>(this)->diffuseColor();
}
@ -188,7 +188,7 @@ inline UnsignedInt PhongMaterialData::diffuseTexture() const {
return const_cast<PhongMaterialData*>(this)->diffuseTexture();
}
inline Color3 PhongMaterialData::specularColor() const {
inline Color4 PhongMaterialData::specularColor() const {
return const_cast<PhongMaterialData*>(this)->specularColor();
}

Loading…
Cancel
Save