Browse Source

Actually make use of Color[34]ub typedefs.

pull/51/head
Vladimír Vondruš 12 years ago
parent
commit
b666044a47
  1. 8
      doc/matrix-vector.dox
  2. 4
      src/Magnum/MeshTools/Interleave.h
  3. 6
      src/Magnum/Test/ColorTest.cpp

8
doc/matrix-vector.dox

@ -77,8 +77,8 @@ Vector3i b; // zero-filled
Matrix3 identity; // diagonal set to 1 Matrix3 identity; // diagonal set to 1
Matrix3 zero(Matrix::Zero); // zero-filled Matrix3 zero(Matrix::Zero); // zero-filled
Color4 black1; // {0.0f, 0.0f, 0.0f, 1.0f} Color4 black1; // {0.0f, 0.0f, 0.0f, 1.0f}
BasicColor4<UnsignedByte> black2; // {0, 0, 0, 255} Color4ub black2; // {0, 0, 0, 255}
@endcode @endcode
Most common and most efficient way to create vector is to pass all values to Most common and most efficient way to create vector is to pass all values to
@ -193,8 +193,8 @@ In %Magnum all mulitplication/division operations involving integral vectors
will have integral result, you need to convert both arguments to the same will have integral result, you need to convert both arguments to the same
floating-point type to have floating-point result. floating-point type to have floating-point result.
@code @code
BasicColor3<UnsignedByte> color(80, 116, 34); Color3ub color(80, 116, 34);
BasicColor3<UnsignedByte> lighter = color*1.5f; // lighter = {120, 174, 51} Color3ub lighter = color*1.5f; // lighter = {120, 174, 51}
Vector3i a(4, 18, -90); Vector3i a(4, 18, -90);
Vector3 multiplier(2.2f, 0.25f, 0.1f); Vector3 multiplier(2.2f, 0.25f, 0.1f);

4
src/Magnum/MeshTools/Interleave.h

@ -155,8 +155,8 @@ It's often desirable to align data for one vertex on 32bit boundaries. To
achieve that, you can specify gaps between the attributes: achieve that, you can specify gaps between the attributes:
@code @code
std::vector<Vector4> positions; std::vector<Vector4> positions;
std::vector<GLushort> weights; std::vector<UnsignedShort> weights;
std::vector<BasicColor3<GLubyte>> vertexColors; std::vector<Color3ub> vertexColors;
std::size_t attributeCount; std::size_t attributeCount;
std::size_t stride; std::size_t stride;
Containers::Array<char> data; Containers::Array<char> data;

6
src/Magnum/Test/ColorTest.cpp

@ -289,19 +289,19 @@ void ColorTest::hsvAlpha() {
void ColorTest::swizzleType() { void ColorTest::swizzleType() {
constexpr Color3 origColor3; constexpr Color3 origColor3;
constexpr BasicColor4<UnsignedByte> origColor4; constexpr Color4ub origColor4;
constexpr auto a = Math::swizzle<'y', 'z', 'r'>(origColor3); constexpr auto a = Math::swizzle<'y', 'z', 'r'>(origColor3);
CORRADE_VERIFY((std::is_same<decltype(a), const Color3>::value)); CORRADE_VERIFY((std::is_same<decltype(a), const Color3>::value));
constexpr auto b = Math::swizzle<'y', 'z', 'a'>(origColor4); constexpr auto b = Math::swizzle<'y', 'z', 'a'>(origColor4);
CORRADE_VERIFY((std::is_same<decltype(b), const BasicColor3<UnsignedByte>>::value)); CORRADE_VERIFY((std::is_same<decltype(b), const Color3ub>::value));
constexpr auto c = Math::swizzle<'y', 'z', 'y', 'x'>(origColor3); constexpr auto c = Math::swizzle<'y', 'z', 'y', 'x'>(origColor3);
CORRADE_VERIFY((std::is_same<decltype(c), const Color4>::value)); CORRADE_VERIFY((std::is_same<decltype(c), const Color4>::value));
constexpr auto d = Math::swizzle<'y', 'a', 'y', 'x'>(origColor4); constexpr auto d = Math::swizzle<'y', 'a', 'y', 'x'>(origColor4);
CORRADE_VERIFY((std::is_same<decltype(d), const BasicColor4<UnsignedByte>>::value)); CORRADE_VERIFY((std::is_same<decltype(d), const Color4ub>::value));
} }
void ColorTest::debug() { void ColorTest::debug() {

Loading…
Cancel
Save