clean up stream formatting of vec3 and friends

This commit is contained in:
Andrew Meadows 2016-05-19 13:18:18 -07:00
parent f3fc00bc3a
commit 83b8ef8131
2 changed files with 17 additions and 36 deletions

View file

@ -219,11 +219,9 @@ void PhysicalEntitySimulation::getObjectsToAddToPhysics(VectorOfMotionStates& re
entity->computeShapeInfo(shapeInfo); entity->computeShapeInfo(shapeInfo);
int numPoints = shapeInfo.getMaxNumPoints(); int numPoints = shapeInfo.getMaxNumPoints();
if (numPoints > MAX_HULL_POINTS) { if (numPoints > MAX_HULL_POINTS) {
glm::vec3 p = entity->getPosition(); qWarning() << "convex hull with" << numPoints
qWarning().nospace() << "convex hull with " << numPoints
<< "points for entity" << entity->getName() << "points for entity" << entity->getName()
<< " at <" << p.x << ", " << p.y << ", " << p.z << ">" << "at" << entity->getPosition() << " will be reduced";
<< " will be reduced";
} }
btCollisionShape* shape = ObjectMotionState::getShapeManager()->getShape(shapeInfo); btCollisionShape* shape = ObjectMotionState::getShapeManager()->getShape(shapeInfo);
if (shape) { if (shape) {

View file

@ -23,7 +23,7 @@ void StreamUtil::dump(std::ostream& s, const QByteArray& buffer) {
while (i < buffer.size()) { while (i < buffer.size()) {
for(int j = 0; i < buffer.size() && j < row_size; ++j) { for(int j = 0; i < buffer.size() && j < row_size; ++j) {
char byte = buffer[i]; char byte = buffer[i];
s << hex_digits[(byte >> 4) & 0x0f] << hex_digits[byte & 0x0f] << " "; s << hex_digits[(byte >> 4) & 0x0f] << hex_digits[byte & 0x0f] << ' ';
++i; ++i;
} }
s << "\n"; s << "\n";
@ -31,19 +31,19 @@ void StreamUtil::dump(std::ostream& s, const QByteArray& buffer) {
} }
std::ostream& operator<<(std::ostream& s, const glm::vec3& v) { std::ostream& operator<<(std::ostream& s, const glm::vec3& v) {
s << "<" << v.x << " " << v.y << " " << v.z << ">"; s << '(' << v.x << ' ' << v.y << ' ' << v.z << ')';
return s; return s;
} }
std::ostream& operator<<(std::ostream& s, const glm::quat& q) { std::ostream& operator<<(std::ostream& s, const glm::quat& q) {
s << "<" << q.x << " " << q.y << " " << q.z << " " << q.w << ">"; s << '(' << q.x << ' ' << q.y << ' ' << q.z << ' ' << q.w << ')';
return s; return s;
} }
std::ostream& operator<<(std::ostream& s, const glm::mat4& m) { std::ostream& operator<<(std::ostream& s, const glm::mat4& m) {
s << "["; s << '[';
for (int j = 0; j < 4; ++j) { for (int j = 0; j < 4; ++j) {
s << " " << m[0][j] << " " << m[1][j] << " " << m[2][j] << " " << m[3][j] << ";"; s << ' ' << m[0][j] << ' ' << m[1][j] << ' ' << m[2][j] << ' ' << m[3][j] << ';';
} }
s << " ]"; s << " ]";
return s; return s;
@ -69,54 +69,37 @@ QDataStream& operator>>(QDataStream& in, glm::quat& quaternion) {
#include <QDebug> #include <QDebug>
QDebug& operator<<(QDebug& dbg, const glm::vec2& v) { QDebug& operator<<(QDebug& dbg, const glm::vec2& v) {
dbg.nospace() << "{type='glm::vec2'" dbg.nospace() << '(' << v.x << ", " << v.y << ')';
", x=" << v.x <<
", y=" << v.y <<
"}";
return dbg; return dbg;
} }
QDebug& operator<<(QDebug& dbg, const glm::vec3& v) { QDebug& operator<<(QDebug& dbg, const glm::vec3& v) {
dbg.nospace() << "{type='glm::vec3'" dbg.nospace() << '(' << v.x << ", " << v.y << ", " << v.z << ')';
", x=" << v.x <<
", y=" << v.y <<
", z=" << v.z <<
"}";
return dbg; return dbg;
} }
QDebug& operator<<(QDebug& dbg, const glm::vec4& v) { QDebug& operator<<(QDebug& dbg, const glm::vec4& v) {
dbg.nospace() << "{type='glm::vec4'" dbg.nospace() << '(' << v.x << ", " << v.y << ", " << v.z << ", " << v.w << ')';
", x=" << v.x <<
", y=" << v.y <<
", z=" << v.z <<
", w=" << v.w <<
"}";
return dbg; return dbg;
} }
QDebug& operator<<(QDebug& dbg, const glm::quat& q) { QDebug& operator<<(QDebug& dbg, const glm::quat& q) {
dbg.nospace() << "{type='glm::quat'" dbg.nospace() << '(' << q.x << ", " << q.y << ", " << q.z << ", " << q.w << ')';
", x=" << q.x <<
", y=" << q.y <<
", z=" << q.z <<
", w=" << q.w <<
"}";
return dbg; return dbg;
} }
QDebug& operator<<(QDebug& dbg, const glm::mat4& m) { QDebug& operator<<(QDebug& dbg, const glm::mat4& m) {
dbg.nospace() << "{type='glm::mat4', ["; dbg.nospace() << '[';
for (int j = 0; j < 4; ++j) { for (int j = 0; j < 4; ++j) {
dbg << ' ' << m[0][j] << ' ' << m[1][j] << ' ' << m[2][j] << ' ' << m[3][j] << ';'; dbg << ' ' << m[0][j] << ' ' << m[1][j] << ' ' << m[2][j] << ' ' << m[3][j] << ';';
} }
return dbg << " ]}"; return dbg << " ]";
} }
QDebug& operator<<(QDebug& dbg, const QVariantHash& v) { QDebug& operator<<(QDebug& dbg, const QVariantHash& v) {
dbg.nospace() << "[ "; dbg.nospace() << "[ ";
for (QVariantHash::const_iterator it = v.constBegin(); it != v.constEnd(); it++) { for (QVariantHash::const_iterator it = v.constBegin(); it != v.constEnd(); it++) {
dbg << it.key() << ":" << it.value(); dbg << it.key() << ':' << it.value();
} }
return dbg << " ]"; return dbg << " ]";
} }