Commit 28febb3c authored by Sylvain Thery's avatar Sylvain Thery
Browse files

Parallelisation d'algorithme et foreach

ajout de GLM pour GL3 (bientot !)
parent 1b8ad6f6
......@@ -5,8 +5,8 @@ project(Tutos)
#SET (COMMON_LIBS ${GLUT_LIBRARY} ${OPENGL_LIBRARY} ${GLEW_LIBRARY} ${DEVIL_LIBRARIES} ${ZLIB_LIBRARIES} ${LIBXML2_LIBRARIES} gzstream AntTweakBar openctm)
#SET (CMAKE_BUILD_TYPE Debug)
SET(CMAKE_BUILD_TYPE Release)
SET (CMAKE_BUILD_TYPE Debug)
#SET(CMAKE_BUILD_TYPE Release)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOTOPOWARNING")
......@@ -54,5 +54,5 @@ target_link_libraries( tp_master
add_executable( tuto_mt tuto_mt.cpp)
target_link_libraries( tuto_mt
# containerD topologyD utilsD algoD ${COMMON_LIBS} boost_thread)
container topology utils algo ${COMMON_LIBS} boost_thread)
containerD topologyD utilsD algoD ${COMMON_LIBS} boost_thread)
# container topology utils algo ${COMMON_LIBS} boost_thread)
......@@ -635,7 +635,6 @@ void myGlutWin::myKeyboard(unsigned char keycode, int x, int y)
/// calcul du rayon
getOrthoScreenRay(x,y,rayA,rayB);
PFP::VEC3 AB = rayB-rayA;
float AB2 = AB.norm2();
d_faces.clear();
d_edges.clear();
......@@ -679,7 +678,6 @@ void myGlutWin::myKeyboard(unsigned char keycode, int x, int y)
/// Rayon
getOrthoScreenRay(x,y,rayA,rayB);
PFP::VEC3 AB = rayB-rayA;
float AB2 = AB.norm2();
d_faces.clear();
d_edges.clear();
......
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-07-24
// Updated : 2008-08-31
// Licence : This source is under MIT License
// File : glm/core/_detail.hpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_detail
#define glm_core_detail
#include "../setup.hpp"
#include <cassert>
namespace glm{
namespace detail{
class thalf;
#if(defined(GLM_COMPILER) && (GLM_COMPILER & GLM_COMPILER_VC))
typedef signed __int64 sint64;
typedef unsigned __int64 uint64;
#elif(defined(GLM_COMPILER) && (GLM_COMPILER & GLM_COMPILER_GCC))
__extension__ typedef signed long long sint64;
__extension__ typedef unsigned long long uint64;
#else//unknown compiler
typedef signed long sint64;
typedef unsigned long uint64;
#endif//GLM_COMPILER
template<bool C>
struct If
{
template<typename F, typename T>
static inline T apply(F functor, const T& val)
{
return functor(val);
}
};
template<>
struct If<false>
{
template<typename F, typename T>
static inline T apply(F, const T& val)
{
return val;
}
};
//template <typename T>
//struct traits
//{
// static const bool is_signed = false;
// static const bool is_float = false;
// static const bool is_vector = false;
// static const bool is_matrix = false;
// static const bool is_genType = false;
// static const bool is_genIType = false;
// static const bool is_genUType = false;
//};
//template <>
//struct traits<half>
//{
// static const bool is_float = true;
// static const bool is_genType = true;
//};
//template <>
//struct traits<float>
//{
// static const bool is_float = true;
// static const bool is_genType = true;
//};
//template <>
//struct traits<double>
//{
// static const bool is_float = true;
// static const bool is_genType = true;
//};
//template <typename genType>
//struct desc
//{
// typedef genType type;
// typedef genType * pointer;
// typedef genType const* const_pointer;
// typedef genType const *const const_pointer_const;
// typedef genType *const pointer_const;
// typedef genType & reference;
// typedef genType const& const_reference;
// typedef genType const& param_type;
// typedef typename genType::value_type value_type;
// typedef typename genType::size_type size_type;
// static const typename size_type value_size;
//};
//template <typename genType>
//const typename desc<genType>::size_type desc<genType>::value_size = genType::value_size();
union uif32
{
uif32() :
i(0)
{}
uif32(float f) :
f(f)
{}
uif32(unsigned int i) :
i(i)
{}
float f;
unsigned int i;
};
union uif64
{
uif64() :
i(0)
{}
uif64(double f) :
f(f)
{}
uif64(uint64 i) :
i(i)
{}
double f;
uint64 i;
};
typedef uif32 uif;
//////////////////
// int
template <typename T>
struct is_int
{
enum is_int_enum
{
_YES = 0,
_NO = 1
};
};
#define GLM_DETAIL_IS_INT(T) \
template <> \
struct is_int<T> \
{ \
enum is_int_enum \
{ \
_YES = 1, \
_NO = 0 \
}; \
}
//////////////////
// uint
template <typename T>
struct is_uint
{
enum is_uint_enum
{
_YES = 0,
_NO = 1
};
};
#define GLM_DETAIL_IS_UINT(T) \
template <> \
struct is_uint<T> \
{ \
enum is_uint_enum \
{ \
_YES = 1, \
_NO = 0 \
}; \
}
//GLM_DETAIL_IS_UINT(unsigned long long)
//////////////////
// float
template <typename T>
struct is_float
{
enum is_float_enum
{
_YES = 0,
_NO = 1
};
};
#define GLM_DETAIL_IS_FLOAT(T) \
template <> \
struct is_float<T> \
{ \
enum is_float_enum \
{ \
_YES = 1, \
_NO = 0 \
}; \
}
//////////////////
// bool
template <typename T>
struct is_bool
{
enum is_bool_enum
{
_YES = 0,
_NO = 1
};
};
template <>
struct is_bool<bool>
{
enum is_bool_enum
{
_YES = 1,
_NO = 0
};
};
//////////////////
// vector
template <typename T>
struct is_vector
{
enum is_vector_enum
{
_YES = 0,
_NO = 1
};
};
#define GLM_DETAIL_IS_VECTOR(T) \
template <> \
struct is_vector \
{ \
enum is_vector_enum \
{ \
_YES = 1, \
_NO = 0 \
}; \
}
//////////////////
// matrix
template <typename T>
struct is_matrix
{
enum is_matrix_enum
{
_YES = 0,
_NO = 1
};
};
#define GLM_DETAIL_IS_MATRIX(T) \
template <> \
struct is_matrix \
{ \
enum is_matrix_enum \
{ \
_YES = 1, \
_NO = 0 \
}; \
}
//////////////////
// type
template <typename T>
struct type
{
enum type_enum
{
is_float = is_float<T>::_YES,
is_int = is_int<T>::_YES,
is_uint = is_uint<T>::_YES,
is_bool = is_bool<T>::_YES
};
};
//////////////////
// type
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef detail::sint64 int64;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef detail::uint64 uint64;
typedef detail::thalf float16;
typedef float float32;
typedef double float64;
}//namespace detail
}//namespace glm
#endif//glm_core_detail
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2006-04-27
// Updated : 2006-04-27
// Licence : This source is under MIT License
// File : _swizzle.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef __swizzle_inl__
#define __swizzle_inl__
#include "./_swizzle.h"
namespace glm
{
}
#endif//__swizzle_inl__
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2011-01-19
// Updated : 2011-01-19
// Licence : This source is under MIT License
// File : glm/setup.hpp
///////////////////////////////////////////////////////////////////////////////////////////////////
// Dummy file, GLM is a header only library
#include "../glm.hpp"
#include "../ext.hpp"
int main()
{
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-03-08
// Updated : 2010-01-26
// Licence : This source is under MIT License
// File : glm/core/func_common.hpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef glm_core_func_common
#define glm_core_func_common
namespace glm
{
namespace test{
void main_core_func_common();
}//namespace test
namespace core{
namespace function{
//! Define common functions from Section 8.3 of GLSL 1.30.8 specification. Included in glm namespace.
namespace common{
//! Returns x if x >= 0; otherwise, it returns -x.
//! (From GLSL 1.30.08 specification, section 8.3)
template <typename genFIType>
genFIType abs(genFIType const & x);
//! Returns 1.0 if x > 0, 0.0 if x = 0, or -1.0 if x < 0.
//! (From GLSL 1.30.08 specification, section 8.3)
template <typename genFIType>
genFIType sign(genFIType const & x);
//! Returns a value equal to the nearest integer that is less then or equal to x.
//! (From GLSL 1.30.08 specification, section 8.3)
template <typename genType>
genType floor(genType const & x);
//! Returns a value equal to the nearest integer to x
//! whose absolute value is not larger than the absolute value of x.
//! (From GLSL 1.30.08 specification, section 8.3)
template <typename genType>
genType trunc(genType const & x);
//! Returns a value equal to the nearest integer to x.
//! The fraction 0.5 will round in a direction chosen by the
//! implementation, presumably the direction that is fastest.
//! This includes the possibility that round(x) returns the
//! same value as roundEven(x) for all values of x.
//! (From GLSL 1.30.08 specification, section 8.3)
template <typename genType>
genType round(genType const & x);
//! Returns a value equal to the nearest integer to x.
//! A fractional part of 0.5 will round toward the nearest even
//! integer. (Both 3.5 and 4.5 for x will return 4.0.)
//! (From GLSL 1.30.08 specification, section 8.3)
template <typename genType>
genType roundEven(genType const & x);
//! Returns a value equal to the nearest integer
//! that is greater than or equal to x.
//! (From GLSL 1.30.08 specification, section 8.3)
template <typename genType>
genType ceil(genType const & x);
//! Return x - floor(x).
//! (From GLSL 1.30.08 specification, section 8.3)
template <typename genType>
genType fract(genType const & x);
//! Modulus. Returns x - y * floor(x / y)
//! for each component in x using the floating point value y.
//! (From GLSL 1.30.08 specification, section 8.3)
template <typename genType>
genType mod(
genType const & x,
genType const & y);
//! Modulus. Returns x - y * floor(x / y)
//! for each component in x using the floating point value y.
//! (From GLSL 1.30.08 specification, section 8.3)
template <typename genType>
genType mod(
genType const & x,
typename genType::value_type const & y);
//! Returns the fractional part of x and sets i to the integer
//! part (as a whole number floating point value). Both the
//! return value and the output parameter will have the same
//! sign as x.
//! (From GLSL 1.30.08 specification, section 8.3)
template <typename genType>
genType modf(
genType const & x,
genType & i);
//! Returns y if y < x; otherwise, it returns x.
//! (From GLSL 1.30.08 specification, section 8.3)
template <typename genType>
genType min(
genType const & x,
genType const & y);
template <typename genType>
genType min(
genType const & x,
typename genType::value_type const & y);
//! Returns y if x < y; otherwise, it returns x.
//! (From GLSL 1.30.08 specification, section 8.3)
template <typename genType>
genType max(
genType const & x,
genType const & y);
template <typename genType>
genType max(
genType const & x,
typename genType::value_type const & y);
//! Returns min(max(x, minVal), maxVal) for each component in x
//! using the floating-point values minVal and maxVal.
//! (From GLSL 1.30.08 specification, section 8.3)
template <typename genType>
genType clamp(
genType const & x,
genType const & minVal,
genType const & maxVal);
template <typename genType>
genType clamp(
genType const & x,
typename genType::value_type const & minVal,
typename genType::value_type const & maxVal);
//! \return If genTypeU is a floating scalar or vector:
//! Returns x * (1.0 - a) + y * a, i.e., the linear blend of
//! x and y using the floating-point value a.
//! The value for a is not restricted to the range [0, 1].
//!
//! \return If genTypeU is a boolean scalar or vector:
//! Selects which vector each returned component comes
//! from. For a component of a that is false, the
//! corresponding component of x is returned. For a
//! component of a that is true, the corresponding
//! component of y is returned. Components of x and y that
//! are not selected are allowed to be invalid floating point
//! values and will have no effect on the results. Thus, this
//! provides different functionality than
//! genType mix(genType x, genType y, genType(a))
//! where a is a Boolean vector.
//!
//! From GLSL 1.30.08 specification, section 8.3
//!
//! \param[in] x Floating point scalar or vector.
//! \param[in] y Floating point scalar or vector.
//! \param[in] a Floating point or boolean scalar or vector.
//!
// \todo Test when 'a' is a boolean.
template <typename genTypeT, typename genTypeU>
genTypeT mix(genTypeT const & x, genTypeT const & y, genTypeU const & a);
//! Returns 0.0 if x < edge, otherwise it returns 1.0.
//! (From GLSL 1.30.08 specification, section 8.3)
template <typename genType>
genType step(
genType const & edge,
genType const & x);
template <typename genType>
genType step(
typename genType::value_type const & edge,
genType const & x);
//! Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and
//! performs smooth Hermite interpolation between 0 and 1
//! when edge0 < x < edge1. This is useful in cases where
//! you would want a threshold function with a smooth
//! transition. This is equivalent to:
//! genType t;
//! t = clamp ((x – edge0) / (edge1 – edge0), 0, 1);
//! return t * t * (3 – 2 * t);
//! Results are undefined if edge0 >= edge1.
//! (From GLSL 1.30.08 specification, section 8.3)
template <typename genType>
genType smoothstep(
genType const & edge0,
genType const & edge1,
genType const & x);
template <typename genType>
genType smoothstep(
typename genType::value_type const & edge0,
typename genType::value_type const & edge1,
genType const & x);