This fixes the linker problem:
/usr/bin/ld: error: ../../libraries/shared/libshared.a(StreamUtils.cpp.o): multiple
definition of 'operator<<(std::ostream&, glm::detail::tvec3<float, (glm::precision)0> const&)'
/usr/bin/ld: CMakeFiles/physics-tests.dir/src/PhysicsTestUtil.cpp.o: previous definition here
/usr/bin/ld: error: ../../libraries/shared/libshared.a(StreamUtils.cpp.o): multiple
definition of 'operator<<(std::ostream&, glm::detail::tquat<float, (glm::precision)0> const&)'
/usr/bin/ld: CMakeFiles/physics-tests.dir/src/PhysicsTestUtil.cpp.o: previous definition here
/usr/bin/ld: error: ../../libraries/shared/libshared.a(StreamUtils.cpp.o): multiple
definition of 'operator<<(std::ostream&, glm::detail::tmat4x4<float, (glm::precision)0> const&)'
/usr/bin/ld: CMakeFiles/physics-tests.dir/src/PhysicsTestUtil.cpp.o: previous definition here
collect2: error: ld returned 1 exit status
Note these are the serializers to std::ostream that were already there, not the ones
that I added (which are to QDebug). This bug was already there, I only got these errors
now after adding some debug code.
The reason is obvious: they are already defined in libshared.a (through StreamUtils.cpp).
No need to define them again in ./tests/physics/src/PhysicsTestUtil.cpp
This adds support for serialization to QDebug of
glm::vec3, glm::quat and glm::mat4.
Output example:
qDebug().nospace() << "Calling PhysicsEntity::findRayIntersection(" << origin << ", " << direction << ", &distance) const; numShapes = " << numShapes;
leads to:
[2014-07-13T20:24:47] Calling PhysicsEntity::findRayIntersection({type='glm::vec3', x=5222.45, y=2159.05, z=6527.79}, {type='glm::vec3', x=0, y=-0.119145, z=-0.992877}, &distance) const; numShapes = 0
Note that we explicitly don't return dbg.space() because
we want to be able to print these things comma separated
as follows: {...}, {...}, ... as opposed to {...} , {...} etc.
I changed the already existing operator<< for Box to
the more general case, where it just prints its members
and doesn't mess with the internals of its members.
The result is more verbose, but also more recognizable when
in the future everything will look the same, allowing
for speed reading the debug output.
The constructor of Box needed to made explicit because
it was too annoying that when one forgets to #include "StreamUtils.h"
that writing a glm::vec3 resulted in printing out a Box,
implicitly converted from the vector.
This patch fixes the compiler warning:
In file included from /opt/highfidelity/hifi/hifi/interface/src/Application.h:45:0,
from /opt/highfidelity/hifi/hifi/interface/src/Audio.cpp:42:
/opt/highfidelity/hifi/hifi/interface/src/Audio.h: In constructor ‘Audio::Audio(int16_t, QObject*)’:
/opt/highfidelity/hifi/hifi/interface/src/Audio.h:268:30: warning: ‘Audio::_interframeTimeGapStats’ will be initialized after [-Wreorder]
/opt/highfidelity/hifi/hifi/interface/src/Audio.h:259:9: warning: ‘int Audio::_starveCount’ [-Wreorder]
/opt/highfidelity/hifi/hifi/interface/src/Audio.cpp:63:1: warning: when initialized here [-Wreorder]
by fixing the initializer list of class Audio.
Note that I omitted _audioMixerAvatarStreamAudioStats() - which is a default constructor
that is called anyway (it's the default!) and therefore doesn't belong in the initializer list.
This fixes nine compiler warnings like:
/opt/highfidelity/hifi/hifi/libraries/particles/src/Particle.cpp:371:43:
warning: comparison between signed and unsigned integer expressions
[-Wsign-compare]
The best way to avoid this (without using an ugly (int) cast) is to
bring everything to one side and compare with zero, which results
in the same assembly code after optimization (it's the same to the
compiler).