Squashed commit of the following:

commit 7ee57f731293285cf6506549e651a338670fb953
Author: cylgom <cylgom@gmail.com>
Date:   Thu Jun 8 21:57:13 2017 +0200

    fixed commits indentation

commit 5b948329ba66d64c569b4067b50be5c9593d316b
Author: cylgom <cylgom@gmail.com>
Date:   Thu Jun 8 20:39:45 2017 +0200

    moved CQuaternion ctor out of athena-dependant compiler directives

commit 7d9bb58ba28b5fc4d43e1ff87a843dc4ae42d048
Author: cylgom <cylgom@gmail.com>
Date:   Thu Jun 8 20:30:43 2017 +0200

    added required headers in CTransform.hpp

commit da0d9ef76b23eaf233a5c3a58a6c1219b80d7c71
Author: cylgom <cylgom@gmail.com>
Date:   Thu Jun 8 20:28:46 2017 +0200

    moved CVector3f ctor out of athena-dependant compiler directives

commit e08199c749dfd1762afd4b75f2f871bd5a86907b
Author: cylgom <cylgom@gmail.com>
Date:   Thu Jun 8 20:12:43 2017 +0200

    fixed const inline arrays

commit 7084b6af2107ec390011f82a14424b8f0142f354
Author: cylgom <cylgom@gmail.com>
Date:   Thu Jun 8 20:11:09 2017 +0200

    fixed empty flags replacement in CMakeLists

fixed unreachable ctors and missing includes
This commit is contained in:
cylgom 2017-06-08 22:01:41 +02:00
parent a0ca6ed66c
commit 92290663a9
5 changed files with 48 additions and 39 deletions

View File

@ -26,7 +26,9 @@ set(SOURCES
# SSELegacy.cpp compiled separately to escape the effects of link-time optimization
if(NOT MSVC)
set_source_files_properties(${SOURCES} PROPERTIES COMPILE_FLAGS "-msse4.1 -msse4.2 -std=c++14")
if(CUSTOM_FLAGS)
string(REPLACE "-flto=thin" "" CUSTOM_FLAGS ${CMAKE_CXX_FLAGS})
endif(CUSTOM_FLAGS)
if (CMAKE_OSX_DEPLOYMENT_TARGET AND NOT CMAKE_OSX_DEPLOYMENT_TARGET STREQUAL "")
set(CUSTOM_FLAGS "${CUSTOM_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -O3 -msse3 -std=c++14")
else()

View File

@ -58,6 +58,35 @@ public:
#endif
}
operator atVec4f()
{
atVec4f ret;
#if __SSE__
ret.mVec128 = mVec128;
#else
ret.vec[0] = w;
ret.vec[1] = x;
ret.vec[2] = y;
ret.vec[3] = z;
#endif
return ret;
}
operator atVec4f() const
{
atVec4f ret;
#if __SSE__
ret.mVec128 = mVec128;
#else
ret.vec[0] = w;
ret.vec[1] = x;
ret.vec[2] = y;
ret.vec[3] = z;
#endif
return ret;
}
#endif
CQuaternion(const CMatrix3f& mat)
{
float trace = mat[0][0] + mat[1][1] + mat[2][2];
@ -97,35 +126,7 @@ public:
}
}
}
operator atVec4f()
{
atVec4f ret;
#if __SSE__
ret.mVec128 = mVec128;
#else
ret.vec[0] = w;
ret.vec[1] = x;
ret.vec[2] = y;
ret.vec[3] = z;
#endif
return ret;
}
operator atVec4f() const
{
atVec4f ret;
#if __SSE__
ret.mVec128 = mVec128;
#else
ret.vec[0] = w;
ret.vec[1] = x;
ret.vec[2] = y;
ret.vec[3] = z;
#endif
return ret;
}
#endif
CQuaternion(const CVector3f& vec) { fromVector3f(vec); }
CQuaternion(const CVector4f& vec)
{

View File

@ -5,6 +5,8 @@
#include "zeus/CMatrix3f.hpp"
#include "zeus/CMatrix4f.hpp"
#include "zeus/CVector3f.hpp"
#include <stdint.h>
#include <stdio.h>
namespace zeus
{

View File

@ -145,8 +145,9 @@ public:
inline CVector3d operator+(const CVector3d& rhs) const
{
#if __SSE__
return CVector3d({_mm_add_pd(mVec128[0], rhs.mVec128[0]),
_mm_add_pd(mVec128[1], rhs.mVec128[1])});
const __m128d tmpVec128[2] = {_mm_add_pd(mVec128[0], rhs.mVec128[0]),
_mm_add_pd(mVec128[1], rhs.mVec128[1])};
return CVector3d(tmpVec128);
#elif __GEKKO_PS__
return CVector3d(__mm_gekko_add_pd(mVec128, rhs.mVec128));
#else
@ -156,8 +157,9 @@ public:
inline CVector3d operator-(const CVector3d& rhs) const
{
#if __SSE__
return CVector3d({_mm_sub_pd(mVec128[0], rhs.mVec128[0]),
_mm_sub_pd(mVec128[1], rhs.mVec128[1])});
const __m128d tmpVec128[2] = {_mm_add_pd(mVec128[0], rhs.mVec128[0]),
_mm_add_pd(mVec128[1], rhs.mVec128[1])};
return CVector3d(tmpVec128);
#else
return CVector3d(x - rhs.x, y - rhs.y, z - rhs.z);
#endif
@ -165,8 +167,9 @@ public:
inline CVector3d operator*(const CVector3d& rhs) const
{
#if __SSE__
return CVector3d({_mm_mul_pd(mVec128[0], rhs.mVec128[0]),
_mm_mul_pd(mVec128[1], rhs.mVec128[1])});
const __m128d tmpVec128[2] = {_mm_add_pd(mVec128[0], rhs.mVec128[0]),
_mm_add_pd(mVec128[1], rhs.mVec128[1])};
return CVector3d(tmpVec128);
#else
return CVector3d(x * rhs.x, y * rhs.y, z * rhs.z);
#endif
@ -174,8 +177,9 @@ public:
inline CVector3d operator/(const CVector3d& rhs) const
{
#if __SSE__
return CVector3d({_mm_div_pd(mVec128[0], rhs.mVec128[0]),
_mm_div_pd(mVec128[1], rhs.mVec128[1])});
const __m128d tmpVec128[2] = {_mm_add_pd(mVec128[0], rhs.mVec128[0]),
_mm_add_pd(mVec128[1], rhs.mVec128[1])};
return CVector3d(tmpVec128);
#else
return CVector3d(x / rhs.x, y / rhs.y, z / rhs.z);
#endif

View File

@ -71,8 +71,6 @@ public:
return ret;
}
CVector3f(const CVector3d& vec);
void readBig(athena::io::IStreamReader& input)
{
x = input.readFloatBig();
@ -89,6 +87,8 @@ public:
}
#endif
CVector3f(const CVector3d& vec);
CVector3f(float xyz) { splat(xyz); }
void assign(float x, float y, float z)
{