[DEV] Start rework of the basic system ==> simplify

This commit is contained in:
Edouard DUPIN 2012-11-21 21:14:49 +01:00
parent 5145f629a8
commit a8cafb5969
24 changed files with 387 additions and 347 deletions

View File

@ -6,12 +6,12 @@
* @license BSD v3 (see license file)
*/
#include <etk/Stream.h>
#include <etk/Types.h>
#ifndef __ETK_DEBUG_H__
#define __ETK_DEBUG_H__
#include <etk/types.h>
#include <etk/Stream.h>
// Log Message System For EDN
void TOOLS_DisplayFuncName(int32_t ligne, const char* className, const char* funcName, const char* libName);
void TOOLS_DisplayTime(void);

View File

@ -9,7 +9,7 @@
#ifndef __TK_REG_EXP_H__
#define __TK_REG_EXP_H__
#include <etk/Types.h>
#include <etk/types.h>
#include <etk/DebugInternal.h>
#include <etk/os/Memory.h>
#include <etk/UString.h>

View File

@ -6,6 +6,7 @@
* @license BSD v3 (see license file)
*/
#include <etk/types.h>
#include <etk/Stream.h>
etk::CCout etk::cout;
@ -13,3 +14,206 @@ etk::CEndl etk::endl;
etk::CHex etk::hex;
etk::CStart etk::cstart;
#if defined(__TARGET_OS__Android)
# include <android/log.h>
# define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "EWOL", __VA_ARGS__))
# define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "EWOL", __VA_ARGS__))
# define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, "EWOL", __VA_ARGS__))
#endif
etk::CCout& etk::operator <<(etk::CCout &os, const etk::logLevel_te obj)
{
switch (obj)
{
case LOG_LEVEL_CRITICAL:
#if !defined(__TARGET_OS__Windows)
os << ETK_BASH_COLOR_BOLD_RED;
#endif
os << "[C]";
break;
case LOG_LEVEL_ERROR:
#if !defined(__TARGET_OS__Windows)
os << ETK_BASH_COLOR_RED;
#endif
os << "[E]";
break;
case LOG_LEVEL_WARNING:
#if !defined(__TARGET_OS__Windows)
os << ETK_BASH_COLOR_MAGENTA;
#endif
os << "[W]";
break;
case LOG_LEVEL_INFO:
#if !defined(__TARGET_OS__Windows)
os << ETK_BASH_COLOR_CYAN;
#endif
os << "[I]";
break;
case LOG_LEVEL_DEBUG:
#if !defined(__TARGET_OS__Windows)
os << ETK_BASH_COLOR_YELLOW;
#endif
os << "[D]";
break;
case LOG_LEVEL_VERBOSE:
#if !defined(__TARGET_OS__Windows)
os << ETK_BASH_COLOR_WHITE;
#endif
os << "[V]";
break;
default:
os << "[?]";
break;
}
return os;
}
etk::CCout::CCout()
{
hex=false;
memset(m_tmpChar, 0, (MAX_LOG_SIZE+1)*sizeof(char));
};
etk::CCout::~CCout()
{
};
etk::CCout& etk::CCout::operator << (CHex t)
{
hex = true;
return *this;
}
etk::CCout& etk::CCout::operator << (int t)
{
snprintf(tmp, MAX_LOG_SIZE_TMP, "%d", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
etk::CCout& etk::CCout::operator << (unsigned int t)
{
snprintf(tmp, MAX_LOG_SIZE_TMP, "%u", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
etk::CCout& etk::CCout::operator << (long t)
{
if (true == hex) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "0x%08X", (unsigned int)t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
} else {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%ld", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
}
return *this;
}
etk::CCout& etk::CCout::operator << (long long t)
{
if (true == hex) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "0x%08X%08X", (unsigned int)(t>>32), (unsigned int)(t));
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
} else {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%lld", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
}
return *this;
}
etk::CCout& etk::CCout::operator << (double t)
{
snprintf(tmp, MAX_LOG_SIZE_TMP, "%f", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
etk::CCout& etk::CCout::operator << (float t)
{
snprintf(tmp, MAX_LOG_SIZE_TMP, "%f", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
etk::CCout& etk::CCout::operator << (char * t)
{
snprintf(tmp, MAX_LOG_SIZE_TMP, "%s", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
etk::CCout& etk::CCout::operator << (const char * t)
{
snprintf(tmp, MAX_LOG_SIZE_TMP, "%s", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
etk::CCout& etk::CCout::operator << (char t)
{
snprintf(tmp, MAX_LOG_SIZE_TMP, "%c", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
etk::CCout& etk::CCout::operator << (bool t)
{
if (t) {
strncat(m_tmpChar, "true", MAX_LOG_SIZE);
} else {
strncat(m_tmpChar, "false", MAX_LOG_SIZE);
}
return *this;
}
etk::CCout& etk::CCout::operator << (CStart ccc)
{
m_mutex.Lock();
return *this;
}
etk::CCout& etk::CCout::operator << (etk::CEndl t)
{
strncat(m_tmpChar, ETK_BASH_COLOR_NORMAL, MAX_LOG_SIZE);
strncat(m_tmpChar, "\n", MAX_LOG_SIZE);
m_tmpChar[MAX_LOG_SIZE] = '\0';
#if defined(__TARGET_OS__Android)
LOGI("%s", m_tmpChar);
#else
printf("%s", m_tmpChar);
#endif
memset(m_tmpChar, 0, (MAX_LOG_SIZE+1)*sizeof(char));
m_mutex.UnLock();
return *this;
}

View File

@ -6,10 +6,49 @@
* @license BSD v3 (see license file)
*/
#ifndef __ETK_STREAM_DEC_H__
#define __ETK_STREAM_DEC_H__
#ifndef __ETK_STREAM_H__
#define __ETK_STREAM_H__
namespace etk{
#include <etk/types.h>
#include <etk/os/Mutex.h>
namespace etk
{
#define MAX_LOG_SIZE (16000)
#define MAX_LOG_SIZE_TMP (512)
class CEndl{};
class CHex{};
class CStart{};
class CCout{
private:
bool hex;
char m_tmpChar[MAX_LOG_SIZE+1];
char tmp[MAX_LOG_SIZE_TMP];
etk::Mutex m_mutex;
public:
CCout(void);
~CCout(void);
CCout& operator << (CHex t);
CCout& operator << (int t);
CCout& operator << (unsigned int t);
CCout& operator << (long t);
CCout& operator << (long long t);
CCout& operator << (double t);
CCout& operator << (float t);
CCout& operator << (char * t);
CCout& operator << (const char * t);
CCout& operator << (char t);
CCout& operator << (bool t);
CCout& operator << (CStart ccc);
CCout& operator << (etk::CEndl t);
};
extern etk::CCout cout;
extern etk::CEndl endl;
extern etk::CHex hex;
extern etk::CStart cstart;
typedef enum {
LOG_LEVEL_NONE,
LOG_LEVEL_CRITICAL,
@ -19,27 +58,12 @@ namespace etk{
LOG_LEVEL_DEBUG,
LOG_LEVEL_VERBOSE
} logLevel_te;
/**
* @brief Debug operator To display the curent element in a Human redeable information
*/
etk::CCout& operator <<(etk::CCout &os, const etk::logLevel_te obj);
};
#endif
#include <string.h>
#include <etk/Types.h>
#include <etk/os/Mutex.h>
#ifndef __ETK_STREAM_H__
#define __ETK_STREAM_H__
#if defined(__TARGET_OS__Android)
# include <android/log.h>
# define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "EWOL", __VA_ARGS__))
# define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "EWOL", __VA_ARGS__))
# define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, "EWOL", __VA_ARGS__))
#endif
#define MAX_LOG_SIZE (16000)
#define MAX_LOG_SIZE_TMP (512)
//regular colors
#define ETK_BASH_COLOR_BLACK "\e[0;30m"
@ -74,206 +98,5 @@ namespace etk{
#define ETK_BASH_GO_TOP "\e[0;0f"
namespace etk{
class CEndl{};
class CHex{};
class CStart{};
class CCout{
private:
bool hex;
char m_tmpChar[MAX_LOG_SIZE+1];
char tmp[MAX_LOG_SIZE_TMP];
etk::Mutex m_mutex;
public:
CCout(){
hex=false;
memset(m_tmpChar, 0, (MAX_LOG_SIZE+1)*sizeof(char));
};
~CCout() {
};
CCout& operator << (CHex t) {
hex = true;
return *this;
}
CCout& operator << (int t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%d", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (unsigned int t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%u", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
/*
CCout& operator << (uniChar_t t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%c", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
return *this;
}
*/
CCout& operator << (long t) {
if (true == hex) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "0x%08X", (unsigned int)t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
} else {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%ld", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
}
return *this;
}
CCout& operator << (long long t) {
if (true == hex) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "0x%08X%08X", (unsigned int)(t>>32), (unsigned int)(t));
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
} else {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%lld", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
}
return *this;
}
CCout& operator << (double t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%f", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (float t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%f", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (char * t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%s", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (const char * t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%s", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (char t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%c", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (bool t) {
if (t) {
strncat(m_tmpChar, "true", MAX_LOG_SIZE);
} else {
strncat(m_tmpChar, "false", MAX_LOG_SIZE);
}
return *this;
}
CCout& operator << (Vector2D<float> t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "(%f,%f)", t.x, t.y);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (Vector2D<int32_t> t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "(%i,%i)", t.x, t.y);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (Vector3D<float> t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "(%f,%f,%f)", t.x, t.y, t.z);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (Vector3D<int32_t> t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "(%i,%i,%i)", t.x, t.y, t.z);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (clipping_ts t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "origin=(%f,%f) size=(%f,%f)", t.x, t.y, t.w, t.h);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
hex = false;
return *this;
}
CCout& operator << (CStart ccc) {
m_mutex.Lock();
return *this;
}
CCout& operator << (logLevel_te ccc) {
switch (ccc)
{
case LOG_LEVEL_CRITICAL:
#if !defined(__TARGET_OS__Windows)
strncat(m_tmpChar, ETK_BASH_COLOR_BOLD_RED, MAX_LOG_SIZE);
#endif
strncat(m_tmpChar, "[C]", MAX_LOG_SIZE);
break;
case LOG_LEVEL_ERROR:
#if !defined(__TARGET_OS__Windows)
strncat(m_tmpChar, ETK_BASH_COLOR_RED, MAX_LOG_SIZE);
#endif
strncat(m_tmpChar, "[E]", MAX_LOG_SIZE);
break;
case LOG_LEVEL_WARNING:
#if !defined(__TARGET_OS__Windows)
strncat(m_tmpChar, ETK_BASH_COLOR_MAGENTA, MAX_LOG_SIZE);
#endif
strncat(m_tmpChar, "[W]", MAX_LOG_SIZE);
break;
case LOG_LEVEL_INFO:
#if !defined(__TARGET_OS__Windows)
strncat(m_tmpChar, ETK_BASH_COLOR_CYAN, MAX_LOG_SIZE);
#endif
strncat(m_tmpChar, "[I]", MAX_LOG_SIZE);
break;
case LOG_LEVEL_DEBUG:
#if !defined(__TARGET_OS__Windows)
strncat(m_tmpChar, ETK_BASH_COLOR_YELLOW, MAX_LOG_SIZE);
#endif
strncat(m_tmpChar, "[D]", MAX_LOG_SIZE);
break;
case LOG_LEVEL_VERBOSE:
#if !defined(__TARGET_OS__Windows)
strncat(m_tmpChar, ETK_BASH_COLOR_WHITE, MAX_LOG_SIZE);
#endif
strncat(m_tmpChar, "[V]", MAX_LOG_SIZE);
break;
default:
strncat(m_tmpChar, "[?]", MAX_LOG_SIZE);
break;
}
return *this;
}
CCout& operator << (etk::CEndl t) {
strncat(m_tmpChar, ETK_BASH_COLOR_NORMAL, MAX_LOG_SIZE);
strncat(m_tmpChar, "\n", MAX_LOG_SIZE);
m_tmpChar[MAX_LOG_SIZE] = '\0';
#if defined(__TARGET_OS__Android)
LOGI("%s", m_tmpChar);
#else
printf("%s", m_tmpChar);
#endif
memset(m_tmpChar, 0, (MAX_LOG_SIZE+1)*sizeof(char));
m_mutex.UnLock();
return *this;
}
};
extern etk::CCout cout;
extern etk::CEndl endl;
extern etk::CHex hex;
extern etk::CStart cstart;
}
#endif

View File

@ -9,8 +9,8 @@
#ifndef __ETK_VECTOR_H__
#define __ETK_VECTOR_H__
#include <etk/types.h>
#include <etk/DebugInternal.h>
#include <etk/Types.h>
#include <etk/os/Memory.h>
#undef __class__

View File

@ -9,7 +9,7 @@
#ifndef __ETK_TYPES_MATRIX_H__
#define __ETK_TYPES_MATRIX_H__
//#include <etk/DebugInternal.h>
#include <etk/types.h>
#include <etk/math/Vector2D.h>
#include <etk/Vector.h>

View File

@ -6,12 +6,12 @@
* @license BSD v3 (see license file)
*/
#include <etk/Types.h>
#include <etk/types.h>
#include <etk/math/Matrix4.h>
#include <etk/DebugInternal.h>
#include <math.h>
etk::Matrix4 etk::matrix::Perspective(float left, float right, float bottom, float top, float nearVal, float farVal)
etk::Matrix4 etk::Matrix4::Perspective(float left, float right, float bottom, float top, float nearVal, float farVal)
{
etk::Matrix4 tmp;
for(int32_t iii=0; iii<4*4 ; iii++) {
@ -29,53 +29,7 @@ etk::Matrix4 etk::matrix::Perspective(float left, float right, float bottom, flo
return tmp;
}
etk::Matrix4 etk::matrix::Translate(float x, float y, float z)
{
etk::Matrix4 tmp;
// set translation :
tmp.m_mat[3] = x;
tmp.m_mat[7] = y;
tmp.m_mat[11] = z;
//TK_INFO("Translate :");
//etk::matrix::Display(tmp);
return tmp;
}
etk::Matrix4 etk::matrix::Scale(float x, float y, float z)
{
etk::Matrix4 tmp;
// set scale :
tmp.m_mat[0] = x;
tmp.m_mat[5] = y;
tmp.m_mat[10] = z;
//TK_INFO("Scale :");
//etk::matrix::Display(tmp);
return tmp;
}
etk::Matrix4 etk::matrix::rotate(float x, float y, float z, float angleRad)
{
etk::Matrix4 tmp;
float cosVal = cos(angleRad);
float sinVal = sin(angleRad);
float invVal = 1.0-cosVal;
// set rotation :
tmp.m_mat[0] = x*x*invVal + cosVal;
tmp.m_mat[1] = x*y*invVal - z*cosVal;
tmp.m_mat[2] = x*z*invVal + y*sinVal;
tmp.m_mat[4] = y*x*invVal + z*sinVal;
tmp.m_mat[5] = y*y*invVal + cosVal;
tmp.m_mat[6] = y*z*invVal - x*sinVal;
tmp.m_mat[8] = z*x*invVal - y*sinVal;
tmp.m_mat[9] = z*y*invVal + x*sinVal;
tmp.m_mat[10] = z*z*invVal + cosVal;
return tmp;
}
etk::Matrix4 etk::matrix::Translate(etk::Vector3D<float> vect)
etk::Matrix4 etk::Matrix4::Translate(etk::Vector3D<float> vect)
{
etk::Matrix4 tmp;
// set translation :
@ -87,7 +41,7 @@ etk::Matrix4 etk::matrix::Translate(etk::Vector3D<float> vect)
return tmp;
}
etk::Matrix4 etk::matrix::Scale(etk::Vector3D<float> vect)
etk::Matrix4 etk::Matrix4::Scale(etk::Vector3D<float> vect)
{
etk::Matrix4 tmp;
// set scale :
@ -99,7 +53,7 @@ etk::Matrix4 etk::matrix::Scale(etk::Vector3D<float> vect)
return tmp;
}
etk::Matrix4 etk::matrix::Rotate(etk::Vector3D<float> vect, float angleRad)
etk::Matrix4 etk::Matrix4::Rotate(etk::Vector3D<float> vect, float angleRad)
{
etk::Matrix4 tmp;
float cosVal = cos(angleRad);
@ -120,10 +74,12 @@ etk::Matrix4 etk::matrix::Rotate(etk::Vector3D<float> vect, float angleRad)
return tmp;
}
void etk::matrix::Display(etk::Matrix4& tmp)
etk::CCout& etk::operator <<(etk::CCout &os, const etk::Matrix4 obj)
{
TK_INFO("matrix : (" << tmp.m_mat[0] << " , " << tmp.m_mat[1] << " , " << tmp.m_mat[2] << " , " << tmp.m_mat[3] << " , ");
TK_INFO(" " << tmp.m_mat[4] << " , " << tmp.m_mat[5] << " , " << tmp.m_mat[6] << " , " << tmp.m_mat[7] << " , ");
TK_INFO(" " << tmp.m_mat[8] << " , " << tmp.m_mat[9] << " , " << tmp.m_mat[10] << " , " << tmp.m_mat[11] << " , ");
TK_INFO(" " << tmp.m_mat[12] << " , " << tmp.m_mat[13] << " , " << tmp.m_mat[14] << " , " << tmp.m_mat[15] << " )");
os << "matrix4 : (";
for (int32_t iii=0; iii<16; iii++) {
os << obj.m_mat[iii];
os << ",";
}
return os;
}

View File

@ -9,8 +9,12 @@
#ifndef __ETK_TYPES_MATRIX4_H__
#define __ETK_TYPES_MATRIX4_H__
namespace etk {
#include <etk/types.h>
#include <math.h>
#include <etk/math/Vector3D.h>
namespace etk
{
class Matrix4
{
public:
@ -200,21 +204,16 @@ namespace etk {
m_mat[14] = tmpVal;
}
public:
Matrix4 Perspective(float left, float right, float bottom, float top, float nearVal, float farVal);
Matrix4 Translate(etk::Vector3D<float> vect);
Matrix4 Scale(etk::Vector3D<float> vect);
Matrix4 Rotate(etk::Vector3D<float> vect, float angleRad=0.0);
};
namespace matrix {
Matrix4 Perspective(float left, float right, float bottom, float top, float nearVal, float farVal);
// TODO : DEPRECATED
Matrix4 Translate(float x=0.0, float y=0.0, float z=0.0);
// TODO : DEPRECATED
Matrix4 Scale(float x=1.0, float y=1.0, float z=1.0);
// TODO : DEPRECATED
Matrix4 rotate(float x, float y, float z, float angleRad=0.0);
Matrix4 Translate(etk::Vector3D<float> vect);
Matrix4 Scale(etk::Vector3D<float> vect);
Matrix4 Rotate(etk::Vector3D<float> vect, float angleRad=0.0);
void Display(Matrix4& tmp);
};
/**
* @brief Debug operator To display the curent element in a Human redeable information
*/
etk::CCout& operator <<(etk::CCout &os, const etk::Matrix4 obj);
};
#endif

30
etk/math/Vector2D.cpp Normal file
View File

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

View File

@ -9,6 +9,9 @@
#ifndef __ETK_MATH_VECTOR2D_H__
#define __ETK_MATH_VECTOR2D_H__
#include <etk/types.h>
#include <etk/Stream.h>
namespace etk
{
template <typename T> class Vector2D
@ -235,8 +238,18 @@ namespace etk
*/
Vector2D<T> QuadraticInterpolate(const Vector2D<T> & v2, const Vector2D<T> & v3, float factor) const
{
return (*this)*(1.0f-factor)*(1.0f-factor) + 2*v2*factor*(1.0f-factor) + v3*factor*factor;}
return (*this)*(1.0f-factor)*(1.0f-factor) + 2*v2*factor*(1.0f-factor) + v3*factor*factor;
};
};
/**
* @brief Debug operator To display the curent element in a Human redeable information
*/
etk::CCout& operator <<(etk::CCout &os, const etk::Vector2D<int32_t> obj);
/**
* @brief Debug operator To display the curent element in a Human redeable information
*/
etk::CCout& operator <<(etk::CCout &os, const etk::Vector2D<float> obj);
};
#endif

34
etk/math/Vector3D.cpp Normal file
View File

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

View File

@ -9,6 +9,10 @@
#ifndef __ETK_MATH_VECTOR3D_H__
#define __ETK_MATH_VECTOR3D_H__
#include <etk/types.h>
#include <math.h>
#include <etk/Stream.h>
namespace etk
{
template <typename T> class Vector3D
@ -397,6 +401,14 @@ namespace etk
return (*this)*(1.0f-factor)*(1.0f-factor) + 2*v2*factor*(1.0f-factor) + v3*factor*factor;
};
};
/**
* @brief Debug operator To display the curent element in a Human redeable information
*/
etk::CCout& operator <<(etk::CCout &os, const etk::Vector3D<int32_t> obj);
/**
* @brief Debug operator To display the curent element in a Human redeable information
*/
etk::CCout& operator <<(etk::CCout &os, const etk::Vector3D<float> obj);
};

View File

@ -1,20 +0,0 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef EPSILON
#define EPSILON 0.01f
#endif
#include <math.h>
#include <etk/math/Vector2D.h>
#include <etk/math/Vector3D.h>
#include <etk/math/Vector4D.h>
#include <etk/math/Matrix.h>
#include <etk/math/Matrix4.h>
#include <etk/math/Plane.h>

View File

@ -7,7 +7,7 @@
*/
#include <etk/Types.h>
#include <etk/types.h>
#include <etk/DebugInternal.h>
#include <etk/os/FSNode.h>
#include <unistd.h>

View File

@ -7,7 +7,7 @@
*/
#include <etk/Types.h>
#include <etk/types.h>
#include <etk/DebugInternal.h>
#include <etk/os/FSNodeRight.h>

View File

@ -6,7 +6,7 @@
* @license BSD v3 (see license file)
*/
#include <etk/Types.h>
#include <etk/types.h>
#include <etk/os/Memory.h>
// General

View File

@ -6,11 +6,11 @@
* @license BSD v3 (see license file)
*/
#include <etk/Types.h>
#ifndef __ETK_MUTEX_H__
#define __ETK_MUTEX_H__
#include <etk/types.h>
#ifdef __TARGET_OS__Windows
#include <windows.h>
#else

View File

@ -9,7 +9,7 @@
#ifndef __ETK_SEMAPHORE_H__
#define __ETK_SEMAPHORE_H__
#include <etk/Types.h>
#include <etk/types.h>
#ifdef __TARGET_OS__Windows
#include <windows.h>

View File

@ -9,7 +9,7 @@
#ifndef __ETK_TOOL_H__
#define __ETK_TOOL_H__
#include <etk/Types.h>
#include <etk/types.h>
#include <etk/UString.h>
namespace etk {

View File

@ -52,18 +52,4 @@ typedef enum {
#define etk_max(elemA, elemB) (((elemA)<(elemB)) ? (elemB) : (elemA))
#define etk_avg(minimim, elem, maximum) (((minimim)>(elem)) ? (minimim) : ((maximum)<(elem)) ? (maximum) : (elem))
typedef struct {
float u;
float v;
}texCoord_ts;
typedef struct {
float x;
float y;
float w;
float h;
}clipping_ts;
#include <etk/math/math.h>
#endif

View File

@ -8,7 +8,7 @@
// see : http://unicode.org/fr/charts/symbols.html#CombiningDiacriticalMarks
#include <etk/Types.h>
#include <etk/types.h>
#include <etk/Debug.h>
#include <etk/unicodeTable.h>
#include <etk/unicode.h>

View File

@ -9,8 +9,9 @@
#ifndef __UNICODE_H__
#define __UNICODE_H__
#include <etk/Types.h>
#include <etk/types.h>
#include <etk/Vector.h>
namespace unicode {
typedef enum {
EDN_CHARSET_UTF8,

View File

@ -6,7 +6,7 @@
* @license BSD v3 (see license file)
*/
#include <etk/Types.h>
#include <etk/types.h>
#include <etk/Debug.h>
#include <etk/unicodeTable.h>

View File

@ -13,7 +13,9 @@ FILE_LIST = \
FILE_LIST+= \
etk/math/Matrix4.cpp
etk/math/Matrix4.cpp \
etk/math/Vector2D.cpp \
etk/math/Vector3D.cpp
FILE_LIST+= \