[DEV] add vector4D corect debug display

This commit is contained in:
Edouard DUPIN 2013-08-09 21:22:42 +02:00
parent 35b678fb65
commit 16bf072432
3 changed files with 83 additions and 0 deletions

66
etk/math/Vector4D.cpp Normal file
View File

@ -0,0 +1,66 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#include <etk/math/Vector4D.h>
etk::CCout& etk::operator <<(etk::CCout &os, const etk::Vector4D<int32_t> obj)
{
os << "(";
os << obj.x();
os << ",";
os << obj.y();
os << ",";
os << obj.z();
os << ",";
os << obj.w();
os << ")";
return os;
}
etk::CCout& etk::operator <<(etk::CCout &os, const etk::Vector4D<float> obj)
{
os << "(";
os << obj.x();
os << ",";
os << obj.y();
os << ",";
os << obj.z();
os << ",";
os << obj.w();
os << ")";
return os;
}
etk::CCout& etk::operator <<(etk::CCout &os, const etk::Vector4D<uint32_t> obj)
{
os << "(";
os << obj.x();
os << ",";
os << obj.y();
os << ",";
os << obj.z();
os << ",";
os << obj.w();
os << ")";
return os;
}
etk::CCout& etk::operator <<(etk::CCout &os, const etk::Vector4D<bool> obj)
{
os << "(";
os << obj.x();
os << ",";
os << obj.y();
os << ",";
os << obj.z();
os << ",";
os << obj.w();
os << ")";
return os;
}

View File

@ -9,6 +9,15 @@
#ifndef __ETK_MATH_VECTOR4D_H__
#define __ETK_MATH_VECTOR4D_H__
#include <etk/types.h>
#include <etk/DebugInternal.h>
#include <math.h>
#include <etk/Stream.h>
#include <LinearMath/btScalar.h>
#include <LinearMath/btMinMax.h>
#include <LinearMath/btVector3.h>
#include <LinearMath/btQuaternion.h>
namespace etk
{
template <typename T> class Vector4D
@ -454,6 +463,13 @@ namespace etk
return m_floats[0] == 0 && m_floats[1] == 0 && m_floats[2] == 0 && m_floats[3] == 0;
}
};
/**
* @brief Debug operator To display the curent element in a Human redeable information
*/
etk::CCout& operator <<(etk::CCout &os, const etk::Vector4D<int32_t> obj);
etk::CCout& operator <<(etk::CCout &os, const etk::Vector4D<float> obj);
etk::CCout& operator <<(etk::CCout &os, const etk::Vector4D<uint32_t> obj);
etk::CCout& operator <<(etk::CCout &os, const etk::Vector4D<bool> obj);
};
// To siplify the writing of the code ==> this permit to have the same name with the glsl language...

View File

@ -23,6 +23,7 @@ def Create(target):
'etk/math/Matrix4.cpp',
'etk/math/Vector2D.cpp',
'etk/math/Vector3D.cpp',
'etk/math/Vector4D.cpp',
'etk/os/FSNode.cpp',
'etk/os/FSNodeRight.cpp',
'etk/archive/Archive.cpp',