diff --git a/doc/scenegraph.dox b/doc/scenegraph.dox
index f20938241..e72d7cf42 100644
--- a/doc/scenegraph.dox
+++ b/doc/scenegraph.dox
@@ -45,13 +45,11 @@ main components:
@section scenegraph-transformation Transformations
Transformation handles object position, rotation etc. and its basic property
-is dimension count (2D or 3D) and underlying floating-point type (by default
-@ref Float type is used everywhere, but you can use @ref Double too).
+is dimension count (2D or 3D) and underlying floating-point type.
-@note All classes in SceneGraph have Float as default underlying floating-point
- type, which means that you can omit that template parameter and write just
- %AbstractObject<2> or %MatrixTransformation3D<> instead of
- %AbstractObject<2, Float> and %MatrixTransformation3D<Float>.
+@note All classes in SceneGraph are templated on underlying type. However, in
+ most cases Float is used and thus nearly all classes have convenience
+ aliases so you don't have to explicitly specify it.
%Scene graph has implementation of transformations in both 2D and 3D, using
either matrices or combination of position and rotation. Each implementation
@@ -74,8 +72,8 @@ in 2D and part in 3D just wouldn't make sense). Common usage is to typedef
%Scene and %Object with desired transformation type to save unnecessary typing
later:
@code
-typedef SceneGraph::Scene> Scene3D;
-typedef SceneGraph::Object> Object3D;
+typedef SceneGraph::Scene Scene3D;
+typedef SceneGraph::Object Object3D;
@endcode
Then you can start building the hierarchy by *parenting* one object to another.
@@ -149,9 +147,9 @@ implement needed functions in your own Object subclass without having to
subclass each feature individually (and making the code overly verbose).
Simplified example:
@code
-class Bomb: public Object3D, SceneGraph::Drawable3D<>, SceneGraph:.Animable3D<> {
+class Bomb: public Object3D, SceneGraph::Drawable3D, SceneGraph:.Animable3D {
public:
- Bomb(Object3D* parent): Object3D(parent), SceneGraph::Drawable3D<>(this), SceneGraph::Animable3D<>(this) {}
+ Bomb(Object3D* parent): Object3D(parent), SceneGraph::Drawable3D(this), SceneGraph::Animable3D(this) {}
protected:
// drawing implementation for Drawable feature
@@ -195,9 +193,9 @@ it first, because by default the caching is disabled. You can enable it using
AbstractFeature::setCachedTransformations() and then implement corresponding
cleaning function(s):
@code
-class CachingObject: public Object3D, SceneGraph::AbstractFeature3D<> {
+class CachingObject: public Object3D, SceneGraph::AbstractFeature3D {
public:
- CachingObject(Object3D* parent): SceneGraph::AbstractFeature3D<>(this) {
+ CachingObject(Object3D* parent): SceneGraph::AbstractFeature3D(this) {
setCachedTransformations(CachedTransformation::Absolute);
}
diff --git a/src/AbstractShaderProgram.h b/src/AbstractShaderProgram.h
index 06e76489a..05fc4ef07 100644
--- a/src/AbstractShaderProgram.h
+++ b/src/AbstractShaderProgram.h
@@ -1457,8 +1457,8 @@ template struct Attribute>: Doubl
template struct Attribute>: Attribute> {};
template struct Attribute>: Attribute> {};
template struct Attribute>: Attribute> {};
-template struct Attribute>: Attribute> {};
-template struct Attribute>: Attribute> {};
+template struct Attribute>: Attribute> {};
+template struct Attribute>: Attribute> {};
/* Common float and double rectangular matrix attributes */
template struct Attribute>: FloatAttribute, SizedAttribute {};
diff --git a/src/AbstractTexture.h b/src/AbstractTexture.h
index 18b64c2c6..4096e3dbf 100644
--- a/src/AbstractTexture.h
+++ b/src/AbstractTexture.h
@@ -208,7 +208,7 @@ class MAGNUM_EXPORT AbstractTexture {
* with @def_gl{TEXTURE_BORDER_COLOR}
* @requires_es_extension %Extension @es_extension{NV,texture_border_clamp}
*/
- AbstractTexture* setBorderColor(const Color4<>& color) {
+ AbstractTexture* setBorderColor(const Color4& color) {
#ifndef MAGNUM_TARGET_GLES
(this->*parameterfvImplementation)(GL_TEXTURE_BORDER_COLOR, color.data());
#else
diff --git a/src/Color.h b/src/Color.h
index fe7971a39..685e4c149 100644
--- a/src/Color.h
+++ b/src/Color.h
@@ -25,7 +25,7 @@
*/
/** @file
- * @brief Class Magnum::Color3, Magnum::Color4
+ * @brief Class Magnum::BasicColor3, Magnum::BasicColor4, typedef Magnum::Color3, Magnum::Color4
*/
#include
@@ -39,7 +39,7 @@ namespace Magnum {
namespace Implementation {
/* Convert color from HSV */
-template typename std::enable_if::value, Color3>::type fromHSV(typename Color3::HSV hsv) {
+template typename std::enable_if::value, BasicColor3>::type fromHSV(typename BasicColor3::HSV hsv) {
Math::Deg hue;
T saturation, value;
std::tie(hue, saturation, value) = hsv;
@@ -65,12 +65,12 @@ template typename std::enable_if::value, Colo
default: CORRADE_ASSERT_UNREACHABLE();
}
}
-template inline typename std::enable_if::value, Color3>::type fromHSV(typename Color3::HSV hsv) {
- return Math::denormalize>(fromHSV::FloatingPointType>(hsv));
+template inline typename std::enable_if::value, BasicColor3>::type fromHSV(typename BasicColor3::HSV hsv) {
+ return Math::denormalize>(fromHSV::FloatingPointType>(hsv));
}
/* Internal hue computing function */
-template Math::Deg hue(const Color3& color, T max, T delta) {
+template Math::Deg hue(const BasicColor3& color, T max, T delta) {
T deltaInv60 = T(60)/delta;
T hue(0);
@@ -87,40 +87,40 @@ template Math::Deg hue(const Color3& color, T max, T delta) {
}
/* Hue, saturation, value for floating-point types */
-template inline Math::Deg hue(typename std::enable_if::value, const Color3&>::type color) {
+template inline Math::Deg hue(typename std::enable_if::value, const BasicColor3&>::type color) {
T max = color.max();
T delta = max - color.min();
return hue(color, max, delta);
}
-template inline T saturation(typename std::enable_if::value, const Color3&>::type color) {
+template inline T saturation(typename std::enable_if::value, const BasicColor3&>::type color) {
T max = color.max();
T delta = max - color.min();
return max != T(0) ? delta/max : T(0);
}
-template inline T value(typename std::enable_if::value, const Color3&>::type color) {
+template inline T value(typename std::enable_if::value, const BasicColor3&>::type color) {
return color.max();
}
/* Hue, saturation, value for integral types */
-template inline Math::Deg::FloatingPointType> hue(typename std::enable_if::value, const Color3&>::type color) {
- return hue::FloatingPointType>(Math::normalize::FloatingPointType>>(color));
+template inline Math::Deg::FloatingPointType> hue(typename std::enable_if::value, const BasicColor3&>::type color) {
+ return hue::FloatingPointType>(Math::normalize::FloatingPointType>>(color));
}
-template inline typename Color3::FloatingPointType saturation(typename std::enable_if::value, const Color3&>::type& color) {
- return saturation::FloatingPointType>(Math::normalize::FloatingPointType>>(color));
+template inline typename BasicColor3::FloatingPointType saturation(typename std::enable_if::value, const BasicColor3&>::type& color) {
+ return saturation::FloatingPointType>(Math::normalize::FloatingPointType>>(color));
}
-template inline typename Color3::FloatingPointType value(typename std::enable_if::value, const Color3&>::type color) {
- return Math::normalize::FloatingPointType>(color.max());
+template inline typename BasicColor3::FloatingPointType value(typename std::enable_if::value, const BasicColor3&>::type color) {
+ return Math::normalize::FloatingPointType>(color.max());
}
/* Convert color to HSV */
-template inline typename Color3::HSV toHSV(typename std::enable_if::value, const Color3&>::type color) {
+template inline typename BasicColor3::HSV toHSV(typename std::enable_if::value, const BasicColor3&>::type color) {
T max = color.max();
T delta = max - color.min();
- return typename Color3::HSV(hue::FloatingPointType>(color, max, delta), max != T(0) ? delta/max : T(0), max);
+ return typename BasicColor3::HSV(hue::FloatingPointType>(color, max, delta), max != T(0) ? delta/max : T(0), max);
}
-template inline typename Color3::HSV toHSV(typename std::enable_if::value, const Color3&>::type color) {
- return toHSV::FloatingPointType>(Math::normalize::FloatingPointType>>(color));
+template inline typename BasicColor3::HSV toHSV(typename std::enable_if::value, const BasicColor3&>::type color) {
+ return toHSV::FloatingPointType>(Math::normalize::FloatingPointType>>(color));
}
/* Default alpha value */
@@ -144,16 +144,11 @@ Conversion from and to HSV is done always using floating-point types, so hue
is always in range in range @f$ [0.0, 360.0] @f$, saturation and value in
range @f$ [0.0, 1.0] @f$.
-@see Color4
+@see @ref Color3, @ref BasicColor4
*/
/* Not using template specialization because some internal functions are
impossible to explicitly instantiate */
-#ifndef DOXYGEN_GENERATING_OUTPUT
-template
-#else
-template
-#endif
-class Color3: public Math::Vector3 {
+template class BasicColor3: public Math::Vector3 {
public:
/** @brief Corresponding floating-point type for HSV computation */
typedef typename Math::TypeTraits::FloatingPointType FloatingPointType;
@@ -172,11 +167,11 @@ class Color3: public Math::Vector3 {
*
* Hue can overflow the range @f$ [0.0, 360.0] @f$.
*/
- constexpr static Color3 fromHSV(HSV hsv) {
+ constexpr static BasicColor3 fromHSV(HSV hsv) {
return Implementation::fromHSV(hsv);
}
/** @overload */
- constexpr static Color3 fromHSV(Math::Deg hue, FloatingPointType saturation, FloatingPointType value) {
+ constexpr static BasicColor3 fromHSV(Math::Deg hue, FloatingPointType saturation, FloatingPointType value) {
return fromHSV(std::make_tuple(hue, saturation, value));
}
@@ -185,13 +180,13 @@ class Color3: public Math::Vector3 {
*
* All components are set to zero.
*/
- constexpr /*implicit*/ Color3() {}
+ constexpr /*implicit*/ BasicColor3() {}
/**
* @brief Gray constructor
* @param rgb RGB value
*/
- constexpr explicit Color3(T rgb): Math::Vector3(rgb) {}
+ constexpr explicit BasicColor3(T rgb): Math::Vector3(rgb) {}
/**
* @brief Constructor
@@ -199,13 +194,13 @@ class Color3: public Math::Vector3 {
* @param g G value
* @param b B value
*/
- constexpr /*implicit*/ Color3(T r, T g, T b): Math::Vector3(r, g, b) {}
+ constexpr /*implicit*/ BasicColor3(T r, T g, T b): Math::Vector3(r, g, b) {}
/** @copydoc Math::Vector::Vector(const Vector&) */
- template constexpr explicit Color3(const Math::Vector<3, U>& other): Math::Vector3(other) {}
+ template constexpr explicit BasicColor3(const Math::Vector<3, U>& other): Math::Vector3(other) {}
/** @brief Copy constructor */
- constexpr Color3(const Math::Vector<3, T>& other): Math::Vector3(other) {}
+ constexpr BasicColor3(const Math::Vector<3, T>& other): Math::Vector3(other) {}
T& r() { return Math::Vector3::x(); } /**< @brief R component */
constexpr T r() const { return Math::Vector3::x(); } /**< @overload */
@@ -259,15 +254,19 @@ class Color3: public Math::Vector3 {
return Implementation::value(*this);
}
- MAGNUM_VECTOR_SUBCLASS_IMPLEMENTATION(Color3, 3)
+ MAGNUM_VECTOR_SUBCLASS_IMPLEMENTATION(BasicColor3, 3)
};
-MAGNUM_VECTOR_SUBCLASS_OPERATOR_IMPLEMENTATION(Color3, 3)
+/** @brief Three-component (RGB) float color */
+typedef BasicColor3 Color3;
+
+MAGNUM_VECTOR_SUBCLASS_OPERATOR_IMPLEMENTATION(BasicColor3, 3)
/**
@brief Four-component (RGBA) color
-See Color3 for more information.
+See @ref BasicColor3 for more information.
+@see @ref Color4
*/
/* Not using template specialization because some internal functions are
impossible to explicitly instantiate */
@@ -276,24 +275,24 @@ template
#else
template
#endif
-class Color4: public Math::Vector4 {
+class BasicColor4: public Math::Vector4 {
public:
- /** @copydoc Color3::FloatingPointType */
- typedef typename Color3::FloatingPointType FloatingPointType;
+ /** @copydoc BasicColor3::FloatingPointType */
+ typedef typename BasicColor3::FloatingPointType FloatingPointType;
- /** @copydoc Color3::HSV */
- typedef typename Color3::HSV HSV;
+ /** @copydoc BasicColor3::HSV */
+ typedef typename BasicColor3::HSV HSV;
/**
- * @copydoc Color3::fromHSV()
+ * @copydoc BasicColor3::fromHSV()
* @param a Alpha value, defaults to 1.0 for floating-point types
* and maximum positive value for integral types.
*/
- constexpr static Color4 fromHSV(HSV hsv, T a = Implementation::defaultAlpha()) {
- return Color4(Implementation::fromHSV(hsv), a);
+ constexpr static BasicColor4 fromHSV(HSV hsv, T a = Implementation::defaultAlpha()) {
+ return BasicColor4(Implementation::fromHSV(hsv), a);
}
/** @overload */
- constexpr static Color4 fromHSV(Math::Deg hue, FloatingPointType saturation, FloatingPointType value, T alpha) {
+ constexpr static BasicColor4 fromHSV(Math::Deg hue, FloatingPointType saturation, FloatingPointType value, T alpha) {
return fromHSV(std::make_tuple(hue, saturation, value), alpha);
}
@@ -303,14 +302,14 @@ class Color4: public Math::Vector4 {
* RGB components are set to zero, A component is set to 1.0 for
* floating-point types and maximum positive value for integral types.
*/
- constexpr /*implicit*/ Color4(): Math::Vector4(T(0), T(0), T(0), Implementation::defaultAlpha()) {}
+ constexpr /*implicit*/ BasicColor4(): Math::Vector4(T(0), T(0), T(0), Implementation::defaultAlpha()) {}
/**
- * @copydoc Color3::Color3(T)
+ * @copydoc BasicColor3::BasicColor3(T)
* @param alpha Alpha value, defaults to 1.0 for floating-point types
* and maximum positive value for integral types.
*/
- constexpr explicit Color4(T rgb, T alpha = Implementation::defaultAlpha()): Math::Vector4(rgb, rgb, rgb, alpha) {}
+ constexpr explicit BasicColor4(T rgb, T alpha = Implementation::defaultAlpha()): Math::Vector4(rgb, rgb, rgb, alpha) {}
/**
* @brief Constructor
@@ -320,22 +319,22 @@ class Color4: public Math::Vector4 {
* @param a A value, defaults to 1.0 for floating-point types and
* maximum positive value for integral types.
*/
- constexpr /*implicit*/ Color4(T r, T g, T b, T a = Implementation::defaultAlpha()): Math::Vector4(r, g, b, a) {}
+ constexpr /*implicit*/ BasicColor4(T r, T g, T b, T a = Implementation::defaultAlpha()): Math::Vector4(r, g, b, a) {}
/**
* @brief Constructor
* @param rgb Three-component color
* @param a A value
*/
- /* Not marked as explicit, because conversion from Color3 to Color4
+ /* Not marked as explicit, because conversion from BasicColor3 to BasicColor4
is fairly common, nearly always with A set to 1 */
- constexpr /*implicit*/ Color4(const Math::Vector3& rgb, T a = Implementation::defaultAlpha()): Math::Vector4(rgb[0], rgb[1], rgb[2], a) {}
+ constexpr /*implicit*/ BasicColor4(const Math::Vector3& rgb, T a = Implementation::defaultAlpha()): Math::Vector4(rgb[0], rgb[1], rgb[2], a) {}
/** @copydoc Math::Vector::Vector(const Vector&) */
- template constexpr explicit Color4(const Math::Vector<4, U>& other): Math::Vector4(other) {}
+ template constexpr explicit BasicColor4(const Math::Vector<4, U>& other): Math::Vector4(other) {}
/** @brief Copy constructor */
- constexpr Color4(const Math::Vector<4, T>& other): Math::Vector4(other) {}
+ constexpr BasicColor4(const Math::Vector<4, T>& other): Math::Vector4(other) {}
T& r() { return Math::Vector4::x(); } /**< @brief R component */
constexpr T r() const { return Math::Vector4::x(); } /**< @overload */
@@ -352,52 +351,55 @@ class Color4: public Math::Vector4 {
*
* @see swizzle()
*/
- Color3& rgb() { return Color3::from(Math::Vector4::data()); }
- constexpr Color3 rgb() const { return Color3::from(Math::Vector4::data()); } /**< @overload */
+ BasicColor3& rgb() { return BasicColor3::from(Math::Vector4::data()); }
+ constexpr BasicColor3 rgb() const { return BasicColor3::from(Math::Vector4::data()); } /**< @overload */
- /** @copydoc Color3::toHSV() */
+ /** @copydoc BasicColor3::toHSV() */
constexpr HSV toHSV() const {
return Implementation::toHSV(rgb());
}
- /** @copydoc Color3::hue() */
+ /** @copydoc BasicColor3::hue() */
constexpr Math::Deg hue() const {
return Implementation::hue(rgb());
}
- /** @copydoc Color3::saturation() */
+ /** @copydoc BasicColor3::saturation() */
constexpr FloatingPointType saturation() const {
return Implementation::saturation(rgb());
}
- /** @copydoc Color3::value() */
+ /** @copydoc BasicColor3::value() */
constexpr FloatingPointType value() const {
return Implementation::value(rgb());
}
- MAGNUM_VECTOR_SUBCLASS_IMPLEMENTATION(Color4, 4)
+ MAGNUM_VECTOR_SUBCLASS_IMPLEMENTATION(BasicColor4, 4)
};
-MAGNUM_VECTOR_SUBCLASS_OPERATOR_IMPLEMENTATION(Color4, 4)
+/** @brief Four-component (RGBA) float color */
+typedef BasicColor4 Color4;
+
+MAGNUM_VECTOR_SUBCLASS_OPERATOR_IMPLEMENTATION(BasicColor4, 4)
-/** @debugoperator{Magnum::Color3} */
-template inline Debug operator<<(Debug debug, const Color3& value) {
+/** @debugoperator{Magnum::BasicColor3} */
+template inline Debug operator<<(Debug debug, const BasicColor3& value) {
return debug << static_cast&>(value);
}
-/** @debugoperator{Magnum::Color4} */
-template inline Debug operator<<(Debug debug, const Color4& value) {
+/** @debugoperator{Magnum::BasicColor4} */
+template inline Debug operator<<(Debug debug, const BasicColor4& value) {
return debug << static_cast&>(value);
}
}
namespace Corrade { namespace Utility {
- /** @configurationvalue{Magnum::Color3} */
- template struct ConfigurationValue>: public ConfigurationValue> {};
+ /** @configurationvalue{Magnum::BasicColor3} */
+ template