[DEBUG] compile without linear lib

This commit is contained in:
Edouard DUPIN 2017-05-18 00:40:46 +00:00
parent 7037d83d6f
commit 499c47d0e4
2 changed files with 55 additions and 38 deletions

View File

@ -8,7 +8,7 @@
#include <etk/stdTools.hpp>
#include <etk/debug.hpp>
std::ostream& etk::operator <<(std::ostream& _os, const ivec3& _obj) {
std::ostream& etk::operator <<(std::ostream& _os, const etk::Vector3D<int32_t>& _obj) {
_os << "(";
_os << _obj.x();
_os << ",";
@ -19,7 +19,20 @@ std::ostream& etk::operator <<(std::ostream& _os, const ivec3& _obj) {
return _os;
}
std::ostream& operator <<(std::ostream& _os, const vec3& _obj) {
#ifdef ETK_BUILD_LINEARMATH
std::ostream& operator <<(std::ostream& _os, const btVector3& _obj) {
_os << "(";
_os << _obj.x();
_os << ",";
_os << _obj.y();
_os << ",";
_os << _obj.z();
_os << ")";
return _os;
}
#endif
std::ostream& etk::operator <<(std::ostream& _os, const etk::Vector3D<float>& _obj) {
_os << "(";
_os << _obj.x();
_os << ",";
@ -30,7 +43,7 @@ std::ostream& operator <<(std::ostream& _os, const vec3& _obj) {
return _os;
}
std::ostream& etk::operator <<(std::ostream& _os, const uivec3& _obj) {
std::ostream& etk::operator <<(std::ostream& _os, const etk::Vector3D<uint32_t>& _obj) {
_os << "(";
_os << _obj.x();
_os << ",";
@ -41,7 +54,7 @@ std::ostream& etk::operator <<(std::ostream& _os, const uivec3& _obj) {
return _os;
}
std::ostream& etk::operator <<(std::ostream& _os, const bvec3& _obj) {
std::ostream& etk::operator <<(std::ostream& _os, const etk::Vector3D<bool>& _obj) {
_os << "(";
_os << _obj.x();
_os << ",";
@ -53,7 +66,20 @@ std::ostream& etk::operator <<(std::ostream& _os, const bvec3& _obj) {
}
std::ostream& etk::operator <<(std::ostream& _os, const std::vector<vec3>& _obj) {
#ifdef ETK_BUILD_LINEARMATH
std::ostream& etk::operator <<(std::ostream& _os, const std::vector<btVector3>& _obj) {
for (size_t iii = 0; iii < _obj.size(); ++iii) {
if (iii != 0) {
_os << " ";
}
_os << _obj[iii];
}
return _os;
}
#endif
std::ostream& etk::operator <<(std::ostream& _os, const std::vector<etk::Vector3D<float>>& _obj) {
for (size_t iii = 0; iii < _obj.size(); ++iii) {
if (iii != 0) {
_os << " ";
@ -63,7 +89,7 @@ std::ostream& etk::operator <<(std::ostream& _os, const std::vector<vec3>& _obj)
return _os;
}
std::ostream& etk::operator <<(std::ostream& _os, const std::vector<ivec3>& _obj) {
std::ostream& etk::operator <<(std::ostream& _os, const std::vector<etk::Vector3D<int32_t>>& _obj) {
for (size_t iii = 0; iii < _obj.size(); ++iii) {
if (iii != 0) {
_os << " ";
@ -73,7 +99,7 @@ std::ostream& etk::operator <<(std::ostream& _os, const std::vector<ivec3>& _obj
return _os;
}
std::ostream& etk::operator <<(std::ostream& _os, const std::vector<uivec3>& _obj) {
std::ostream& etk::operator <<(std::ostream& _os, const std::vector<etk::Vector3D<uint32_t>>& _obj) {
for (size_t iii = 0; iii < _obj.size(); ++iii) {
if (iii != 0) {
_os << " ";
@ -83,7 +109,7 @@ std::ostream& etk::operator <<(std::ostream& _os, const std::vector<uivec3>& _ob
return _os;
}
std::ostream& etk::operator <<(std::ostream& _os, const std::vector<bvec3>& _obj) {
std::ostream& etk::operator <<(std::ostream& _os, const std::vector<etk::Vector3D<bool>>& _obj) {
for (size_t iii = 0; iii < _obj.size(); ++iii) {
if (iii != 0) {
_os << " ";

View File

@ -442,8 +442,7 @@ namespace etk {
* @return false The Objects are NOT identical
*/
bool operator==(const Vector3D<T>& _obj) const {
return ( (m_floats[3] == _obj.m_floats[3])
&& (m_floats[2] == _obj.m_floats[2])
return ( (m_floats[2] == _obj.m_floats[2])
&& (m_floats[1] == _obj.m_floats[1])
&& (m_floats[0] == _obj.m_floats[0]));
}
@ -454,8 +453,7 @@ namespace etk {
* @return false The Objects are identical
*/
bool operator!=(const Vector3D<T>& _obj) const {
return ( (m_floats[3] != _obj.m_floats[3])
|| (m_floats[2] != _obj.m_floats[2])
return ( (m_floats[2] != _obj.m_floats[2])
|| (m_floats[1] != _obj.m_floats[1])
|| (m_floats[0] != _obj.m_floats[0]));
}
@ -464,20 +462,18 @@ namespace etk {
* @param _obj The other Vector3D<T> to compare with
*/
void setMax(const Vector3D<T>& _obj) {
btSetMax(m_floats[0], _obj.m_floats[0]);
btSetMax(m_floats[1], _obj.m_floats[1]);
btSetMax(m_floats[2], _obj.m_floats[2]);
btSetMax(m_floats[3], _obj.m_floats[3]);
m_floats[0] = std::max(m_floats[0], _obj.m_floats[0]);
m_floats[1] = std::max(m_floats[1], _obj.m_floats[1]);
m_floats[2] = std::max(m_floats[2], _obj.m_floats[2]);
}
/**
* @brief Set each element to the min of the current values and the values of another Vector3D<T>
* @param _obj The other Vector3D<T> to compare with
*/
void setMin(const Vector3D<T>& _obj) {
btSetMin(m_floats[0], _obj.m_floats[0]);
btSetMin(m_floats[1], _obj.m_floats[1]);
btSetMin(m_floats[2], _obj.m_floats[2]);
btSetMin(m_floats[3], _obj.m_floats[3]);
m_floats[0] = std::min(m_floats[0], _obj.m_floats[0]);
m_floats[1] = std::min(m_floats[1], _obj.m_floats[1]);
m_floats[2] = std::min(m_floats[2], _obj.m_floats[2]);
}
/**
* @brief Set Value on the vector
@ -520,12 +516,22 @@ namespace etk {
}
};
//! @not_in_doc
std::ostream& operator <<(std::ostream& _os, const etk::Vector3D<float>& _obj);
//! @not_in_doc
std::ostream& operator <<(std::ostream& _os, const etk::Vector3D<int32_t>& _obj);
//! @not_in_doc
std::ostream& operator <<(std::ostream& _os, const etk::Vector3D<uint32_t>& _obj);
//! @not_in_doc
std::ostream& operator <<(std::ostream& _os, const etk::Vector3D<bool>& _obj);
};
//! @not_in_doc
std::ostream& operator <<(std::ostream& _os, const std::vector<etk::Vector3D<float>>& _obj);
//! @not_in_doc
std::ostream& operator <<(std::ostream& _os, const std::vector<etk::Vector3D<int32_t>>& _obj);
//! @not_in_doc
std::ostream& operator <<(std::ostream& _os, const std::vector<etk::Vector3D<uint32_t>>& _obj);
//! @not_in_doc
std::ostream& operator <<(std::ostream& _os, const std::vector<etk::Vector3D<bool>>& _obj);
}
// To siplify the writing of the code ==> this permit to have the same name with the glsl language...
#ifdef ETK_BUILD_LINEARMATH
@ -539,10 +545,9 @@ using ivec3 = etk::Vector3D<int32_t>; //!< wrapper on etk::Vector3D<int32_t> to
using uivec3 = etk::Vector3D<uint32_t>; //!< wrapper on etk::Vector3D<uint32_t> to have the same naming has OpenGL shader
using bvec3 = etk::Vector3D<bool>; //!< wrapper on etk::Vector3D<bool> to have the same naming has OpenGL shader
//! @not_in_doc
std::ostream& operator <<(std::ostream& _os, const vec3& _obj);
#ifdef ETK_BUILD_LINEARMATH
std::ostream& operator <<(std::ostream& _os, const btVector3& _obj);
std::ostream& operator <<(std::ostream& _os, const std::vector<btVector3>& _obj);
vec3 quaternionToEulerXYZ(const btQuaternion& quat);
#endif
@ -583,20 +588,6 @@ namespace etk {
}
}
namespace etk {
//! @not_in_doc
std::ostream& operator <<(std::ostream& _os, const std::vector<vec3>& _obj);
//! @not_in_doc
std::ostream& operator <<(std::ostream& _os, const std::vector<ivec3>& _obj);
//! @not_in_doc
std::ostream& operator <<(std::ostream& _os, const std::vector<uivec3>& _obj);
//! @not_in_doc
std::ostream& operator <<(std::ostream& _os, const std::vector<bvec3>& _obj);
}
template<class ETK_TYPE>
inline etk::Vector3D<ETK_TYPE> operator+(const etk::Vector3D<ETK_TYPE>& _vect1, const etk::Vector3D<ETK_TYPE>& _vect2) {
return etk::Vector3D<ETK_TYPE>(_vect1.x() + _vect2.x(), _vect1.y() + _vect2.y(), _vect1.z() + _vect2.z());