Browse Source

Merge branch 'master' into compatibility

Conflicts:
	src/Color.h
	src/SceneGraph/Object.hpp
Vladimír Vondruš 13 years ago
parent
commit
1bc8c92d15
  1. 7
      external/OpenGL/GL/CMakeLists.txt
  2. 1
      src/AbstractImage.cpp
  3. 4
      src/AbstractShaderProgram.cpp
  4. 6
      src/AbstractShaderProgram.h
  5. 2
      src/Color.h
  6. 4
      src/DebugTools/ResourceManager.cpp
  7. 4
      src/DebugTools/ResourceManager.h
  8. 2
      src/Math/Algorithms/Svd.h
  9. 8
      src/Math/Functions.h
  10. 2
      src/Math/Test/UnitTest.cpp
  11. 2
      src/Math/Unit.h
  12. 8
      src/Math/Vector.h
  13. 2
      src/MeshTools/RemoveDuplicates.h
  14. 4
      src/Platform/Sdl2Application.cpp
  15. 6
      src/Plugins/TgaImageConverter/TgaImageConverter.cpp
  16. 4
      src/Primitives/Capsule.cpp
  17. 4
      src/Primitives/Circle.cpp
  18. 8
      src/Primitives/Implementation/Spheroid.cpp
  19. 6
      src/Primitives/Implementation/WireframeSpheroid.cpp
  20. 2
      src/SceneGraph/DualComplexTransformation.h
  21. 2
      src/SceneGraph/MatrixTransformation2D.h
  22. 6
      src/SceneGraph/Object.hpp
  23. 2
      src/SceneGraph/RigidMatrixTransformation2D.h
  24. 2
      src/Shader.cpp
  25. 2
      src/Text/AbstractFont.cpp
  26. 2
      src/Text/AbstractFontConverter.cpp
  27. 4
      src/Text/Renderer.cpp
  28. 4
      src/Timeline.cpp
  29. 2
      src/Trade/AbstractImporter.cpp
  30. 4
      src/Trade/Test/AbstractImageConverterTest.cpp

7
external/OpenGL/GL/CMakeLists.txt vendored

@ -23,6 +23,11 @@
# #
add_library(MagnumGLLoadGenObjects OBJECT gl_magnum.c) add_library(MagnumGLLoadGenObjects OBJECT gl_magnum.c)
set_target_properties(MagnumGLLoadGenObjects PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -fvisibility=hidden -DGLLoadGen_EXPORTS")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set_target_properties(MagnumGLLoadGenObjects PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -fvisibility=hidden -DGLLoadGen_EXPORTS")
else()
set_target_properties(MagnumGLLoadGenObjects PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -DGLLoadGen_EXPORTS")
endif()
install(FILES gl_magnum.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/GL) install(FILES gl_magnum.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/GL)

1
src/AbstractImage.cpp

@ -133,7 +133,6 @@ std::size_t AbstractImage::pixelSize(ColorFormat format, ColorType type) {
} }
CORRADE_ASSERT_UNREACHABLE(); CORRADE_ASSERT_UNREACHABLE();
return 0;
} }
} }

4
src/AbstractShaderProgram.cpp

@ -764,7 +764,6 @@ std::size_t FloatAttribute::size(GLint components, DataType dataType) {
} }
CORRADE_ASSERT_UNREACHABLE(); CORRADE_ASSERT_UNREACHABLE();
return 0;
} }
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -782,7 +781,6 @@ std::size_t IntAttribute::size(GLint components, DataType dataType) {
} }
CORRADE_ASSERT_UNREACHABLE(); CORRADE_ASSERT_UNREACHABLE();
return 0;
} }
#endif #endif
@ -794,7 +792,6 @@ std::size_t DoubleAttribute::size(GLint components, DataType dataType) {
} }
CORRADE_ASSERT_UNREACHABLE(); CORRADE_ASSERT_UNREACHABLE();
return 0;
} }
#endif #endif
@ -829,7 +826,6 @@ std::size_t Attribute<Math::Vector<4, Float>>::size(GLint components, DataType d
} }
CORRADE_ASSERT_UNREACHABLE(); CORRADE_ASSERT_UNREACHABLE();
return 0;
} }
Debug operator<<(Debug debug, SizedAttribute<1, 1>::Components value) { Debug operator<<(Debug debug, SizedAttribute<1, 1>::Components value) {

6
src/AbstractShaderProgram.h

@ -1321,9 +1321,9 @@ template<UnsignedInt location, class T> class AbstractShaderProgram::Attribute {
constexpr DataOptions dataOptions() const { return _dataOptions; } constexpr DataOptions dataOptions() const { return _dataOptions; }
private: private:
const Components _components; Components _components;
const DataType _dataType; DataType _dataType;
const DataOptions _dataOptions; DataOptions _dataOptions;
}; };
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT

2
src/Color.h

@ -45,7 +45,7 @@ template<class T> typename std::enable_if<std::is_floating_point<T>::value, Basi
std::tie(hue, saturation, value) = hsv; std::tie(hue, saturation, value) = hsv;
/* Remove repeats */ /* Remove repeats */
hue -= int(hue.toUnderlyingType()/T(360))*Math::Deg<T>(360); hue -= Math::floor(hue.toUnderlyingType()/T(360))*Math::Deg<T>(360);
if(hue < Math::Deg<T>(0)) hue += Math::Deg<T>(360); if(hue < Math::Deg<T>(0)) hue += Math::Deg<T>(360);
int h = int(hue.toUnderlyingType()/T(60)) % 6; int h = int(hue.toUnderlyingType()/T(60)) % 6;

4
src/DebugTools/ResourceManager.cpp

@ -35,7 +35,11 @@
namespace Magnum { namespace Magnum {
#ifndef _WIN32
template class ResourceManager<AbstractShaderProgram, Buffer, Mesh, MeshView, DebugTools::ForceRendererOptions, DebugTools::ObjectRendererOptions, DebugTools::ShapeRendererOptions>; template class ResourceManager<AbstractShaderProgram, Buffer, Mesh, MeshView, DebugTools::ForceRendererOptions, DebugTools::ObjectRendererOptions, DebugTools::ShapeRendererOptions>;
#else
template class MAGNUM_DEBUGTOOLS_EXPORT ResourceManager<AbstractShaderProgram, Buffer, Mesh, MeshView, DebugTools::ForceRendererOptions, DebugTools::ObjectRendererOptions, DebugTools::ShapeRendererOptions>;
#endif
namespace DebugTools { namespace DebugTools {

4
src/DebugTools/ResourceManager.h

@ -55,7 +55,11 @@ namespace Magnum {
/** @todo Do the listing in one place, not five thousand! */ /** @todo Do the listing in one place, not five thousand! */
#ifndef _WIN32
extern template ResourceManager<AbstractShaderProgram, Buffer, Mesh, MeshView, DebugTools::ForceRendererOptions, DebugTools::ObjectRendererOptions, DebugTools::ShapeRendererOptions> MAGNUM_DEBUGTOOLS_EXPORT *& ResourceManager<AbstractShaderProgram, Buffer, Mesh, MeshView, DebugTools::ForceRendererOptions, DebugTools::ObjectRendererOptions, DebugTools::ShapeRendererOptions>::internalInstance(); extern template ResourceManager<AbstractShaderProgram, Buffer, Mesh, MeshView, DebugTools::ForceRendererOptions, DebugTools::ObjectRendererOptions, DebugTools::ShapeRendererOptions> MAGNUM_DEBUGTOOLS_EXPORT *& ResourceManager<AbstractShaderProgram, Buffer, Mesh, MeshView, DebugTools::ForceRendererOptions, DebugTools::ObjectRendererOptions, DebugTools::ShapeRendererOptions>::internalInstance();
#else
extern template class MAGNUM_DEBUGTOOLS_EXPORT ResourceManager<AbstractShaderProgram, Buffer, Mesh, MeshView, DebugTools::ForceRendererOptions, DebugTools::ObjectRendererOptions, DebugTools::ShapeRendererOptions>;
#endif
namespace DebugTools { namespace DebugTools {

2
src/Math/Algorithms/Svd.h

@ -49,7 +49,7 @@ template<class T> T pythagoras(T a, T b) {
} }
template<class T> constexpr T smallestDelta(); template<class T> constexpr T smallestDelta();
template<> constexpr Float smallestDelta<Float>() { return 1.0e-32; } template<> constexpr Float smallestDelta<Float>() { return 1.0e-32f; }
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
template<> constexpr Double smallestDelta<Double>() { return 1.0e-64; } template<> constexpr Double smallestDelta<Double>() { return 1.0e-64; }
#endif #endif

8
src/Math/Functions.h

@ -286,12 +286,12 @@ template<std::size_t size, class T> Vector<size, T> ceil(const Vector<size, T>&
template<class T> inline T sqrt(const T& a); template<class T> inline T sqrt(const T& a);
#else #else
template<class T> inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type sqrt(T a) { template<class T> inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type sqrt(T a) {
return std::sqrt(a); return T(std::sqrt(a));
} }
template<std::size_t size, class T> Vector<size, T> sqrt(const Vector<size, T>& a) { template<std::size_t size, class T> Vector<size, T> sqrt(const Vector<size, T>& a) {
Vector<size, T> out; Vector<size, T> out;
for(std::size_t i = 0; i != size; ++i) for(std::size_t i = 0; i != size; ++i)
out[i] = std::sqrt(a[i]); out[i] = T(std::sqrt(a[i]));
return out; return out;
} }
#endif #endif
@ -350,7 +350,7 @@ The interpolation for vectors is done as in following, similarly for scalars: @f
template<class T, class U> inline T lerp(const T& a, const T& b, U t); template<class T, class U> inline T lerp(const T& a, const T& b, U t);
#else #else
template<class T, class U> inline T lerp(T a, T b, U t) { template<class T, class U> inline T lerp(T a, T b, U t) {
return (U(1) - t)*a + t*b; return T((U(1) - t)*a + t*b);
} }
template<std::size_t size, class T, class U> inline Vector<size, T> lerp(const Vector<size, T>& a, const Vector<size, T>& b, U t) { template<std::size_t size, class T, class U> inline Vector<size, T> lerp(const Vector<size, T>& a, const Vector<size, T>& b, U t) {
return (U(1) - t)*a + t*b; return (U(1) - t)*a + t*b;
@ -472,7 +472,7 @@ template<class Integral, class FloatingPoint> inline Integral denormalize(const
template<class Integral, class FloatingPoint> inline typename std::enable_if<std::is_arithmetic<FloatingPoint>::value, Integral>::type denormalize(FloatingPoint value) { template<class Integral, class FloatingPoint> inline typename std::enable_if<std::is_arithmetic<FloatingPoint>::value, Integral>::type denormalize(FloatingPoint value) {
static_assert(std::is_floating_point<FloatingPoint>::value && std::is_integral<Integral>::value, static_assert(std::is_floating_point<FloatingPoint>::value && std::is_integral<Integral>::value,
"Math::denormalize(): denormalization must be done from floating-point to integral type"); "Math::denormalize(): denormalization must be done from floating-point to integral type");
return value*std::numeric_limits<Integral>::max(); return Integral(value*std::numeric_limits<Integral>::max());
} }
template<class Integral, class FloatingPoint> inline typename std::enable_if<std::is_arithmetic<typename Integral::Type>::value, Integral>::type denormalize(const FloatingPoint& value) { template<class Integral, class FloatingPoint> inline typename std::enable_if<std::is_arithmetic<typename Integral::Type>::value, Integral>::type denormalize(const FloatingPoint& value) {
static_assert(std::is_floating_point<typename FloatingPoint::Type>::value && std::is_integral<typename Integral::Type>::value, static_assert(std::is_floating_point<typename FloatingPoint::Type>::value && std::is_integral<typename Integral::Type>::value,

2
src/Math/Test/UnitTest.cpp

@ -76,7 +76,7 @@ void UnitTest::constructDefault() {
} }
void UnitTest::constructConversion() { void UnitTest::constructConversion() {
constexpr Seci a(25.0); constexpr Seci a(25);
constexpr Sec b(a); constexpr Sec b(a);
CORRADE_COMPARE(b, Sec(25.0f)); CORRADE_COMPARE(b, Sec(25.0f));

2
src/Math/Unit.h

@ -51,7 +51,7 @@ template<template<class> class Derived, class T> class Unit {
constexpr explicit Unit(T value): value(value) {} constexpr explicit Unit(T value): value(value) {}
/** @brief Construct from another underlying type */ /** @brief Construct from another underlying type */
template<class U> constexpr explicit Unit(Unit<Derived, U> value): value(value.value) {} template<class U> constexpr explicit Unit(Unit<Derived, U> value): value(T(value.value)) {}
/** @brief Explicit conversion to underlying type */ /** @brief Explicit conversion to underlying type */
constexpr T toUnderlyingType() const { return value; } constexpr T toUnderlyingType() const { return value; }

8
src/Math/Vector.h

@ -894,7 +894,7 @@ typename std::enable_if<std::is_integral<Integral>::value && std::is_floating_po
#endif #endif
operator*=(Vector<size, Integral>& vector, FloatingPoint number) { operator*=(Vector<size, Integral>& vector, FloatingPoint number) {
for(std::size_t i = 0; i != size; ++i) for(std::size_t i = 0; i != size; ++i)
vector[i] *= number; vector[i] = Integral(vector[i]*number);
return vector; return vector;
} }
@ -945,7 +945,7 @@ typename std::enable_if<std::is_integral<Integral>::value && std::is_floating_po
#endif #endif
operator/=(Vector<size, Integral>& vector, FloatingPoint number) { operator/=(Vector<size, Integral>& vector, FloatingPoint number) {
for(std::size_t i = 0; i != size; ++i) for(std::size_t i = 0; i != size; ++i)
vector[i] /= number; vector[i] = Integral(vector[i]/number);
return vector; return vector;
} }
@ -981,7 +981,7 @@ typename std::enable_if<std::is_integral<Integral>::value && std::is_floating_po
#endif #endif
operator*=(Vector<size, Integral>& a, const Vector<size, FloatingPoint>& b) { operator*=(Vector<size, Integral>& a, const Vector<size, FloatingPoint>& b) {
for(std::size_t i = 0; i != size; ++i) for(std::size_t i = 0; i != size; ++i)
a[i] *= b[i]; a[i] = Integral(a[i]*b[i]);
return a; return a;
} }
@ -1034,7 +1034,7 @@ typename std::enable_if<std::is_integral<Integral>::value && std::is_floating_po
#endif #endif
operator/=(Vector<size, Integral>& a, const Vector<size, FloatingPoint>& b) { operator/=(Vector<size, Integral>& a, const Vector<size, FloatingPoint>& b) {
for(std::size_t i = 0; i != size; ++i) for(std::size_t i = 0; i != size; ++i)
a[i] /= b[i]; a[i] = Integral(a[i]/b[i]);
return a; return a;
} }

2
src/MeshTools/RemoveDuplicates.h

@ -123,7 +123,7 @@ template<class Vertex, std::size_t vertexSize> void RemoveDuplicates<Vertex, ver
/* Index of a vertex in vertexSize-dimensional table */ /* Index of a vertex in vertexSize-dimensional table */
std::size_t index[vertexSize]; std::size_t index[vertexSize];
for(std::size_t ii = 0; ii != vertexSize; ++ii) for(std::size_t ii = 0; ii != vertexSize; ++ii)
index[ii] = (vertices[*it][ii]+moved[ii]-min[ii])/epsilon; index[ii] = std::size_t((vertices[*it][ii]+moved[ii]-min[ii])/epsilon);
/* Try inserting the vertex into table, if it already /* Try inserting the vertex into table, if it already
exists, change vertex pointer of the face to already exists, change vertex pointer of the face to already

4
src/Platform/Sdl2Application.cpp

@ -261,13 +261,13 @@ Sdl2Application::Configuration::~Configuration() = default;
Sdl2Application::InputEvent::Modifiers Sdl2Application::MouseEvent::modifiers() { Sdl2Application::InputEvent::Modifiers Sdl2Application::MouseEvent::modifiers() {
if(modifiersLoaded) return _modifiers; if(modifiersLoaded) return _modifiers;
modifiersLoaded = true; modifiersLoaded = true;
return _modifiers = fixedModifiers(SDL_GetModState()); return _modifiers = fixedModifiers(Uint16(SDL_GetModState()));
} }
Sdl2Application::InputEvent::Modifiers Sdl2Application::MouseMoveEvent::modifiers() { Sdl2Application::InputEvent::Modifiers Sdl2Application::MouseMoveEvent::modifiers() {
if(modifiersLoaded) return _modifiers; if(modifiersLoaded) return _modifiers;
modifiersLoaded = true; modifiersLoaded = true;
return _modifiers = fixedModifiers(SDL_GetModState()); return _modifiers = fixedModifiers(Uint16(SDL_GetModState()));
} }
template class BasicScreen<Sdl2Application>; template class BasicScreen<Sdl2Application>;

6
src/Plugins/TgaImageConverter/TgaImageConverter.cpp

@ -78,15 +78,15 @@ Containers::Array<unsigned char> TgaImageConverter::doExportToData(const ImageRe
} }
/* Initialize data buffer */ /* Initialize data buffer */
const UnsignedByte pixelSize = image.pixelSize(); const auto pixelSize = UnsignedByte(image.pixelSize());
auto data = Containers::Array<unsigned char>::zeroInitialized(sizeof(TgaHeader) + pixelSize*image.size().product()); auto data = Containers::Array<unsigned char>::zeroInitialized(sizeof(TgaHeader) + pixelSize*image.size().product());
/* Fill header */ /* Fill header */
auto header = reinterpret_cast<TgaHeader*>(data.begin()); auto header = reinterpret_cast<TgaHeader*>(data.begin());
header->imageType = image.format() == ColorFormat::Red ? 3 : 2; header->imageType = image.format() == ColorFormat::Red ? 3 : 2;
header->bpp = pixelSize*8; header->bpp = pixelSize*8;
header->width = Utility::Endianness::littleEndian(image.size().x()); header->width = UnsignedShort(Utility::Endianness::littleEndian(image.size().x()));
header->height = Utility::Endianness::littleEndian(image.size().y()); header->height = UnsignedShort(Utility::Endianness::littleEndian(image.size().y()));
/* Fill data */ /* Fill data */
std::copy(image.data(), image.data()+pixelSize*image.size().product(), data.begin()+sizeof(TgaHeader)); std::copy(image.data(), image.data()+pixelSize*image.size().product(), data.begin()+sizeof(TgaHeader));

4
src/Primitives/Capsule.cpp

@ -47,7 +47,7 @@ Trade::MeshData2D Capsule2D::wireframe(UnsignedInt hemisphereRings, UnsignedInt
/* Bottom hemisphere */ /* Bottom hemisphere */
for(UnsignedInt i = 0; i != hemisphereRings; ++i) { for(UnsignedInt i = 0; i != hemisphereRings; ++i) {
const Rad angle((i+1)*angleIncrement); const Rad angle(Float(i+1)*angleIncrement);
const Float x = Math::sin(angle); const Float x = Math::sin(angle);
const Float y = -Math::cos(angle)-halfLength; const Float y = -Math::cos(angle)-halfLength;
positions.insert(positions.end(), {{-x, y}, {x, y}}); positions.insert(positions.end(), {{-x, y}, {x, y}});
@ -61,7 +61,7 @@ Trade::MeshData2D Capsule2D::wireframe(UnsignedInt hemisphereRings, UnsignedInt
/* Top hemisphere */ /* Top hemisphere */
for(UnsignedInt i = 0; i != hemisphereRings; ++i) { for(UnsignedInt i = 0; i != hemisphereRings; ++i) {
const Rad angle(i*angleIncrement); const Rad angle(Float(i)*angleIncrement);
const Float x = Math::cos(angle); const Float x = Math::cos(angle);
const Float y = Math::sin(angle)+halfLength; const Float y = Math::sin(angle)+halfLength;
positions.insert(positions.end(), {{-x, y}, {x, y}}); positions.insert(positions.end(), {{-x, y}, {x, y}});

4
src/Primitives/Circle.cpp

@ -44,7 +44,7 @@ Trade::MeshData2D Circle::solid(UnsignedInt segments) {
/* Points on circle */ /* Points on circle */
const Rad angleIncrement(2*Constants::pi()/segments); const Rad angleIncrement(2*Constants::pi()/segments);
for(UnsignedInt i = 0; i != segments; ++i) { for(UnsignedInt i = 0; i != segments; ++i) {
const Rad angle(i*angleIncrement); const Rad angle(Float(i)*angleIncrement);
positions.emplace_back(Math::cos(angle), Math::sin(angle)); positions.emplace_back(Math::cos(angle), Math::sin(angle));
} }
@ -62,7 +62,7 @@ Trade::MeshData2D Circle::wireframe(UnsignedInt segments) {
/* Points on circle */ /* Points on circle */
const Rad angleIncrement(2*Constants::pi()/segments); const Rad angleIncrement(2*Constants::pi()/segments);
for(UnsignedInt i = 0; i != segments; ++i) { for(UnsignedInt i = 0; i != segments; ++i) {
const Rad angle(i*angleIncrement); const Rad angle(Float(i)*angleIncrement);
positions.emplace_back(Math::cos(angle), Math::sin(angle)); positions.emplace_back(Math::cos(angle), Math::sin(angle));
} }

8
src/Primitives/Implementation/Spheroid.cpp

@ -44,12 +44,12 @@ void Spheroid::hemisphereVertexRings(UnsignedInt count, Float centerY, Rad start
Rad segmentAngleIncrement(2*Constants::pi()/segments); Rad segmentAngleIncrement(2*Constants::pi()/segments);
Float x, y, z; Float x, y, z;
for(UnsignedInt i = 0; i != count; ++i) { for(UnsignedInt i = 0; i != count; ++i) {
Rad ringAngle = startRingAngle + i*ringAngleIncrement; Rad ringAngle = startRingAngle + Float(i)*ringAngleIncrement;
x = z = Math::cos(ringAngle); x = z = Math::cos(ringAngle);
y = Math::sin(ringAngle); y = Math::sin(ringAngle);
for(UnsignedInt j = 0; j != segments; ++j) { for(UnsignedInt j = 0; j != segments; ++j) {
Rad segmentAngle = j*segmentAngleIncrement; Rad segmentAngle = Float(j)*segmentAngleIncrement;
positions.push_back({x*Math::sin(segmentAngle), centerY+y, z*Math::cos(segmentAngle)}); positions.push_back({x*Math::sin(segmentAngle), centerY+y, z*Math::cos(segmentAngle)});
normals.push_back({x*Math::sin(segmentAngle), y, z*Math::cos(segmentAngle)}); normals.push_back({x*Math::sin(segmentAngle), y, z*Math::cos(segmentAngle)});
@ -70,7 +70,7 @@ void Spheroid::cylinderVertexRings(UnsignedInt count, Float startY, Float yIncre
Rad segmentAngleIncrement(2*Constants::pi()/segments); Rad segmentAngleIncrement(2*Constants::pi()/segments);
for(UnsignedInt i = 0; i != count; ++i) { for(UnsignedInt i = 0; i != count; ++i) {
for(UnsignedInt j = 0; j != segments; ++j) { for(UnsignedInt j = 0; j != segments; ++j) {
Rad segmentAngle = j*segmentAngleIncrement; Rad segmentAngle = Float(j)*segmentAngleIncrement;
positions.push_back({Math::sin(segmentAngle), startY, Math::cos(segmentAngle)}); positions.push_back({Math::sin(segmentAngle), startY, Math::cos(segmentAngle)});
normals.push_back({Math::sin(segmentAngle), 0.0f, Math::cos(segmentAngle)}); normals.push_back({Math::sin(segmentAngle), 0.0f, Math::cos(segmentAngle)});
@ -144,7 +144,7 @@ void Spheroid::capVertexRing(Float y, Float textureCoordsV, const Vector3& norma
Rad segmentAngleIncrement(2*Constants::pi()/segments); Rad segmentAngleIncrement(2*Constants::pi()/segments);
for(UnsignedInt i = 0; i != segments; ++i) { for(UnsignedInt i = 0; i != segments; ++i) {
Rad segmentAngle = i*segmentAngleIncrement; Rad segmentAngle = Float(i)*segmentAngleIncrement;
positions.push_back({Math::sin(segmentAngle), y, Math::cos(segmentAngle)}); positions.push_back({Math::sin(segmentAngle), y, Math::cos(segmentAngle)});
normals.push_back(normal); normals.push_back(normal);

6
src/Primitives/Implementation/WireframeSpheroid.cpp

@ -45,7 +45,7 @@ void WireframeSpheroid::bottomHemisphere(const Float endY, const UnsignedInt rin
/* Hemisphere vertices and indices */ /* Hemisphere vertices and indices */
const Rad ringAngleIncrement(Constants::pi()/(2*rings)); const Rad ringAngleIncrement(Constants::pi()/(2*rings));
for(UnsignedInt j = 0; j != rings-1; ++j) { for(UnsignedInt j = 0; j != rings-1; ++j) {
const Rad angle = (j+1)*ringAngleIncrement; const Rad angle = Float(j+1)*ringAngleIncrement;
_positions.emplace_back(0.0f, endY - Math::cos(angle), Math::sin(angle)); _positions.emplace_back(0.0f, endY - Math::cos(angle), Math::sin(angle));
_positions.emplace_back(Math::sin(angle), endY - Math::cos(angle), 0.0f); _positions.emplace_back(Math::sin(angle), endY - Math::cos(angle), 0.0f);
@ -66,7 +66,7 @@ void WireframeSpheroid::topHemisphere(const Float startY, const UnsignedInt ring
/* Hemisphere vertices and indices */ /* Hemisphere vertices and indices */
const Rad ringAngleIncrement(Constants::pi()/(2*rings)); const Rad ringAngleIncrement(Constants::pi()/(2*rings));
for(UnsignedInt j = 0; j != rings-1; ++j) { for(UnsignedInt j = 0; j != rings-1; ++j) {
const Rad angle = (j+1)*ringAngleIncrement; const Rad angle = Float(j+1)*ringAngleIncrement;
/* Connect previous hemisphere ring to current vertices */ /* Connect previous hemisphere ring to current vertices */
if(j != 0) for(UnsignedInt i = 0; i != 4; ++i) if(j != 0) for(UnsignedInt i = 0; i != 4; ++i)
@ -91,7 +91,7 @@ void WireframeSpheroid::ring(const Float y) {
const Rad segmentAngleIncrement(Constants::pi()/(2*_segments)); const Rad segmentAngleIncrement(Constants::pi()/(2*_segments));
for(UnsignedInt j = 0; j != _segments; ++j) { for(UnsignedInt j = 0; j != _segments; ++j) {
for(UnsignedInt i = 0; i != 4; ++i) { for(UnsignedInt i = 0; i != 4; ++i) {
const Rad segmentAngle = Rad(i*Constants::pi()/2) + j*segmentAngleIncrement; const Rad segmentAngle = Rad(Float(i)*Constants::pi()/2) + Float(j)*segmentAngleIncrement;
if(j != 0) _indices.insert(_indices.end(), {UnsignedInt(_positions.size()-4), UnsignedInt(_positions.size())}); if(j != 0) _indices.insert(_indices.end(), {UnsignedInt(_positions.size()-4), UnsignedInt(_positions.size())});
_positions.emplace_back(Math::sin(segmentAngle), y, Math::cos(segmentAngle)); _positions.emplace_back(Math::sin(segmentAngle), y, Math::cos(segmentAngle));
} }

2
src/SceneGraph/DualComplexTransformation.h

@ -129,7 +129,7 @@ template<class T> class BasicDualComplexTransformation: public AbstractBasicTran
} }
void doRotate(Math::Rad<T> angle, TransformationType type) override final { void doRotate(Math::Rad<T> angle, TransformationType type) override final {
doRotate(angle, type); rotate(angle, type);
} }
/* No assertions fired, for internal use */ /* No assertions fired, for internal use */

2
src/SceneGraph/MatrixTransformation2D.h

@ -129,7 +129,7 @@ template<class T> class BasicMatrixTransformation2D: public AbstractBasicTransla
} }
void doRotate(Math::Rad<T> angle, TransformationType type) override final { void doRotate(Math::Rad<T> angle, TransformationType type) override final {
doRotate(angle, type); rotate(angle, type);
} }
void doScale(const Math::Vector2<T>& vector, TransformationType type) override final { void doScale(const Math::Vector2<T>& vector, TransformationType type) override final {

6
src/SceneGraph/Object.hpp

@ -213,7 +213,7 @@ template<class Transformation> std::vector<typename Transformation::DataType> Ob
with different counter */ with different counter */
if(objects[i]->counter != 0xFFFFu) continue; if(objects[i]->counter != 0xFFFFu) continue;
objects[i]->counter = i; objects[i]->counter = UnsignedShort(i);
objects[i]->flags |= Flag::Joint; objects[i]->flags |= Flag::Joint;
} }
std::vector<Object<Transformation>*> jointObjects(objects); std::vector<Object<Transformation>*> jointObjects(objects);
@ -253,7 +253,7 @@ template<class Transformation> std::vector<typename Transformation::DataType> Ob
CORRADE_ASSERT(jointObjects.size() < 0xFFFFu, CORRADE_ASSERT(jointObjects.size() < 0xFFFFu,
"SceneGraph::Object::transformations(): too large scene", std::vector<typename Transformation::DataType>{}); "SceneGraph::Object::transformations(): too large scene", std::vector<typename Transformation::DataType>{});
CORRADE_INTERNAL_ASSERT(parent->counter == 0xFFFFu); CORRADE_INTERNAL_ASSERT(parent->counter == 0xFFFFu);
parent->counter = jointObjects.size(); parent->counter = UnsignedShort(jointObjects.size());
parent->flags |= Flag::Joint; parent->flags |= Flag::Joint;
jointObjects.push_back(parent); jointObjects.push_back(parent);
} }
@ -283,7 +283,7 @@ template<class Transformation> std::vector<typename Transformation::DataType> Ob
for(auto it = jointObjects.begin(); it != jointObjects.end(); ++it) { for(auto it = jointObjects.begin(); it != jointObjects.end(); ++it) {
/* All not-already cleaned objects (...duplicate occurences) should /* All not-already cleaned objects (...duplicate occurences) should
have joint mark */ have joint mark */
CORRADE_INTERNAL_ASSERT((*it)->counter = 0xFFFFu || (*it)->flags & Flag::Joint); CORRADE_INTERNAL_ASSERT((*it)->counter == 0xFFFFu || (*it)->flags & Flag::Joint);
#ifndef CORRADE_GCC45_COMPATIBILITY #ifndef CORRADE_GCC45_COMPATIBILITY
(*it)->flags &= ~Flag::Joint; (*it)->flags &= ~Flag::Joint;
#else #else

2
src/SceneGraph/RigidMatrixTransformation2D.h

@ -146,7 +146,7 @@ template<class T> class BasicRigidMatrixTransformation2D: public AbstractBasicTr
} }
void doRotate(Math::Rad<T> angle, TransformationType type) override final { void doRotate(Math::Rad<T> angle, TransformationType type) override final {
doRotate(angle, type); rotate(angle, type);
} }
/* No assertions fired, for internal use */ /* No assertions fired, for internal use */

2
src/Shader.cpp

@ -616,7 +616,7 @@ Shader& Shader::addFile(const std::string& filename) {
/* Get size of shader and initialize buffer */ /* Get size of shader and initialize buffer */
file.seekg(0, std::ios::end); file.seekg(0, std::ios::end);
std::string source(file.tellg(), '\0'); std::string source(std::size_t(file.tellg()), '\0');
/* Read data, close */ /* Read data, close */
file.seekg(0, std::ios::beg); file.seekg(0, std::ios::beg);

2
src/Text/AbstractFont.cpp

@ -94,7 +94,7 @@ std::pair<Float, Float> AbstractFont::doOpenFile(const std::string& filename, co
/* Create array to hold file contents */ /* Create array to hold file contents */
in.seekg(0, std::ios::end); in.seekg(0, std::ios::end);
Containers::Array<unsigned char> data(in.tellg()); Containers::Array<unsigned char> data(std::size_t(in.tellg()));
/* Read data, close */ /* Read data, close */
in.seekg(0, std::ios::beg); in.seekg(0, std::ios::beg);

2
src/Text/AbstractFontConverter.cpp

@ -249,7 +249,7 @@ std::unique_ptr<GlyphCache> AbstractFontConverter::doImportGlyphCacheFromFile(co
/* Create array to hold file contents */ /* Create array to hold file contents */
in.seekg(0, std::ios::end); in.seekg(0, std::ios::end);
Containers::Array<unsigned char> data(in.tellg()); Containers::Array<unsigned char> data(std::size_t(in.tellg()));
/* Read data, close */ /* Read data, close */
in.seekg(0, std::ios::beg); in.seekg(0, std::ios::beg);

4
src/Text/Renderer.cpp

@ -43,8 +43,8 @@ template<class T> void createIndices(void* output, const UnsignedInt glyphCount)
| | |/ / | | | |/ / |
1---3 1 3---4 */ 1---3 1 3---4 */
const T vertex = i*4; const T vertex = T(i)*4;
const T pos = i*6; const T pos = T(i)*6;
out[pos] = vertex; out[pos] = vertex;
out[pos+1] = vertex+1; out[pos+1] = vertex+1;
out[pos+2] = vertex+2; out[pos+2] = vertex+2;

4
src/Timeline.cpp

@ -51,11 +51,11 @@ void Timeline::nextFrame() {
if(!running) return; if(!running) return;
auto now = high_resolution_clock::now(); auto now = high_resolution_clock::now();
UnsignedInt duration = duration_cast<microseconds>(now-_previousFrameTime).count(); auto duration = UnsignedInt(duration_cast<microseconds>(now-_previousFrameTime).count());
_previousFrameDuration = duration/1e6f; _previousFrameDuration = duration/1e6f;
if(_previousFrameDuration < _minimalFrameTime) { if(_previousFrameDuration < _minimalFrameTime) {
Utility::sleep(_minimalFrameTime*1000 - duration/1000); Utility::sleep(std::size_t(_minimalFrameTime*1000) - duration/1000);
now = high_resolution_clock::now(); now = high_resolution_clock::now();
_previousFrameDuration = duration_cast<microseconds>(now-_previousFrameTime).count()/1e6f; _previousFrameDuration = duration_cast<microseconds>(now-_previousFrameTime).count()/1e6f;
} }

2
src/Trade/AbstractImporter.cpp

@ -76,7 +76,7 @@ void AbstractImporter::doOpenFile(const std::string& filename) {
/* Create array to hold file contents */ /* Create array to hold file contents */
in.seekg(0, std::ios::end); in.seekg(0, std::ios::end);
Containers::Array<unsigned char> data(in.tellg()); Containers::Array<unsigned char> data(std::size_t(in.tellg()));
/* Read data, close */ /* Read data, close */
in.seekg(0, std::ios::beg); in.seekg(0, std::ios::beg);

4
src/Trade/Test/AbstractImageConverterTest.cpp

@ -53,8 +53,8 @@ void AbstractImageConverterTest::exportToFile() {
Containers::Array<unsigned char> doExportToData(const ImageReference2D& image) const override { Containers::Array<unsigned char> doExportToData(const ImageReference2D& image) const override {
Containers::Array<unsigned char> out(2); Containers::Array<unsigned char> out(2);
out[0] = image.size().x(); out[0] = static_cast<unsigned char>(image.size().x());
out[1] = image.size().y(); out[1] = static_cast<unsigned char>(image.size().y());
return out; return out;
}; };
}; };

Loading…
Cancel
Save