Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ACGL
acgl
Commits
7e456138
Commit
7e456138
authored
Oct 21, 2013
by
Robert Menzel
Browse files
updated GLM to 0.9.4.6
parent
29d22745
Changes
225
Hide whitespace changes
Inline
Side-by-side
include/glm/copying.txt
View file @
7e456138
The MIT License
Copyright (c) 2005 - 201
2
G-Truc Creation
Copyright (c) 2005 - 201
3
G-Truc Creation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
...
...
include/glm/core/_detail.hpp
View file @
7e456138
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 201
2
G-Truc Creation (www.g-truc.net)
/// Copyright (c) 2005 - 201
3
G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
...
...
@@ -445,7 +445,14 @@ namespace detail
# define GLM_RESTRICT __declspec(restrict)
# define GLM_RESTRICT_VAR __restrict
# define GLM_CONSTEXPR
#elif((GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_LLVM_GCC)) && (GLM_COMPILER >= GLM_COMPILER_GCC31))
#elif(GLM_COMPILER & GLM_COMPILER_INTEL)
# define GLM_DEPRECATED
# define GLM_ALIGN(x) __declspec(align(x))
# define GLM_ALIGNED_STRUCT(x) __declspec(align(x)) struct
# define GLM_RESTRICT
# define GLM_RESTRICT_VAR __restrict
# define GLM_CONSTEXPR
#elif(((GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_LLVM_GCC)) && (GLM_COMPILER >= GLM_COMPILER_GCC31)) || (GLM_COMPILER & GLM_COMPILER_CLANG))
# define GLM_DEPRECATED __attribute__((__deprecated__))
# define GLM_ALIGN(x) __attribute__((aligned(x)))
# define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x)))
...
...
include/glm/core/_fixes.hpp
View file @
7e456138
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 201
2
G-Truc Creation (www.g-truc.net)
/// Copyright (c) 2005 - 201
3
G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
...
...
include/glm/core/_swizzle.hpp
View file @
7e456138
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 201
2
G-Truc Creation (www.g-truc.net)
/// Copyright (c) 2005 - 201
3
G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
...
...
@@ -60,8 +60,8 @@ namespace detail
typedef
T
value_type
;
protected:
value_type
&
elem
(
size_t
i
)
{
return
(
reinterpret_cast
<
value_type
*>
(
_buffer
))[
i
];
}
const
value_type
&
elem
(
size_t
i
)
const
{
return
(
reinterpret_cast
<
const
value_type
*>
(
_buffer
))[
i
];
}
GLM_FUNC_QUALIFIER
value_type
&
elem
(
size_t
i
)
{
return
(
reinterpret_cast
<
value_type
*>
(
_buffer
))[
i
];
}
GLM_FUNC_QUALIFIER
const
value_type
&
elem
(
size_t
i
)
const
{
return
(
reinterpret_cast
<
const
value_type
*>
(
_buffer
))[
i
];
}
// Use an opaque buffer to *ensure* the compiler doesn't call a constructor.
// The size 1 buffer is assumed to aligned to the actual members so that the
...
...
@@ -77,19 +77,19 @@ namespace detail
template
<
typename
T
,
typename
V
,
int
E0
,
int
E1
>
struct
_swizzle_base1
<
T
,
V
,
E0
,
E1
,
-
1
,
-
2
,
2
>
:
public
_swizzle_base0
<
T
,
2
>
{
V
operator
()()
const
{
return
V
(
this
->
elem
(
E0
),
this
->
elem
(
E1
));
}
GLM_FUNC_QUALIFIER
V
operator
()()
const
{
return
V
(
this
->
elem
(
E0
),
this
->
elem
(
E1
));
}
};
template
<
typename
T
,
typename
V
,
int
E0
,
int
E1
,
int
E2
>
struct
_swizzle_base1
<
T
,
V
,
E0
,
E1
,
E2
,
-
1
,
3
>
:
public
_swizzle_base0
<
T
,
3
>
{
V
operator
()()
const
{
return
V
(
this
->
elem
(
E0
),
this
->
elem
(
E1
),
this
->
elem
(
E2
));
}
GLM_FUNC_QUALIFIER
V
operator
()()
const
{
return
V
(
this
->
elem
(
E0
),
this
->
elem
(
E1
),
this
->
elem
(
E2
));
}
};
template
<
typename
T
,
typename
V
,
int
E0
,
int
E1
,
int
E2
,
int
E3
>
struct
_swizzle_base1
<
T
,
V
,
E0
,
E1
,
E2
,
E3
,
4
>
:
public
_swizzle_base0
<
T
,
4
>
{
V
operator
()()
const
{
return
V
(
this
->
elem
(
E0
),
this
->
elem
(
E1
),
this
->
elem
(
E2
),
this
->
elem
(
E3
));
}
GLM_FUNC_QUALIFIER
V
operator
()()
const
{
return
V
(
this
->
elem
(
E0
),
this
->
elem
(
E1
),
this
->
elem
(
E2
),
this
->
elem
(
E3
));
}
};
// Internal class for implementing swizzle operators
...
...
@@ -110,67 +110,73 @@ namespace detail
typedef
VecType
vec_type
;
typedef
ValueType
value_type
;
_swizzle_base2
&
operator
=
(
const
ValueType
&
t
)
GLM_FUNC_QUALIFIER
_swizzle_base2
&
operator
=
(
const
ValueType
&
t
)
{
for
(
int
i
=
0
;
i
<
N
;
++
i
)
(
*
this
)[
i
]
=
t
;
return
*
this
;
}
_swizzle_base2
&
operator
=
(
const
VecType
&
that
)
GLM_FUNC_QUALIFIER
_swizzle_base2
&
operator
=
(
const
VecType
&
that
)
{
struct
op
{
void
operator
()
(
value_type
&
e
,
value_type
&
t
)
{
e
=
t
;
}
GLM_FUNC_QUALIFIER
void
operator
()
(
value_type
&
e
,
value_type
&
t
)
{
e
=
t
;
}
};
_apply_op
(
that
,
op
());
return
*
this
;
}
void
operator
-=
(
const
VecType
&
that
)
GLM_FUNC_QUALIFIER
void
operator
-=
(
const
VecType
&
that
)
{
struct
op
{
void
operator
()
(
value_type
&
e
,
value_type
&
t
)
{
e
-=
t
;
}
GLM_FUNC_QUALIFIER
void
operator
()
(
value_type
&
e
,
value_type
&
t
)
{
e
-=
t
;
}
};
_apply_op
(
that
,
op
());
}
void
operator
+=
(
const
VecType
&
that
)
GLM_FUNC_QUALIFIER
void
operator
+=
(
const
VecType
&
that
)
{
struct
op
{
void
operator
()
(
value_type
&
e
,
value_type
&
t
)
{
e
+=
t
;
}
GLM_FUNC_QUALIFIER
void
operator
()
(
value_type
&
e
,
value_type
&
t
)
{
e
+=
t
;
}
};
_apply_op
(
that
,
op
());
}
void
operator
*=
(
const
VecType
&
that
)
GLM_FUNC_QUALIFIER
void
operator
*=
(
const
VecType
&
that
)
{
struct
op
{
void
operator
()
(
value_type
&
e
,
value_type
&
t
)
{
e
*=
t
;
}
GLM_FUNC_QUALIFIER
void
operator
()
(
value_type
&
e
,
value_type
&
t
)
{
e
*=
t
;
}
};
_apply_op
(
that
,
op
());
}
void
operator
/=
(
const
VecType
&
that
)
GLM_FUNC_QUALIFIER
void
operator
/=
(
const
VecType
&
that
)
{
struct
op
{
void
operator
()
(
value_type
&
e
,
value_type
&
t
)
{
e
/=
t
;
}
GLM_FUNC_QUALIFIER
void
operator
()
(
value_type
&
e
,
value_type
&
t
)
{
e
/=
t
;
}
};
_apply_op
(
that
,
op
());
}
value_type
&
operator
[]
(
size_t
i
)
GLM_FUNC_QUALIFIER
value_type
&
operator
[]
(
size_t
i
)
{
static
const
int
offset_dst
[
4
]
=
{
E0
,
E1
,
E2
,
E3
};
#ifndef __CUDA_ARCH__
static
#endif
const
int
offset_dst
[
4
]
=
{
E0
,
E1
,
E2
,
E3
};
return
this
->
elem
(
offset_dst
[
i
]);
}
value_type
operator
[]
(
size_t
i
)
const
GLM_FUNC_QUALIFIER
value_type
operator
[]
(
size_t
i
)
const
{
static
const
int
offset_dst
[
4
]
=
{
E0
,
E1
,
E2
,
E3
};
#ifndef __CUDA_ARCH__
static
#endif
const
int
offset_dst
[
4
]
=
{
E0
,
E1
,
E2
,
E3
};
return
this
->
elem
(
offset_dst
[
i
]);
}
protected:
template
<
typename
T
>
void
_apply_op
(
const
VecType
&
that
,
T
op
)
GLM_FUNC_QUALIFIER
void
_apply_op
(
const
VecType
&
that
,
T
op
)
{
// Make a copy of the data in this == &that.
// The copier should optimize out the copy in cases where the function is
...
...
@@ -191,11 +197,14 @@ namespace detail
typedef
ValueType
value_type
;
struct
Stub
{};
_swizzle_base2
&
operator
=
(
Stub
const
&
)
{}
GLM_FUNC_QUALIFIER
_swizzle_base2
&
operator
=
(
Stub
const
&
)
{
return
*
this
;
}
value_type
operator
[]
(
size_t
i
)
const
GLM_FUNC_QUALIFIER
value_type
operator
[]
(
size_t
i
)
const
{
static
const
int
offset_dst
[
4
]
=
{
E0
,
E1
,
E2
,
E3
};
#ifndef __CUDA_ARCH__
static
#endif
const
int
offset_dst
[
4
]
=
{
E0
,
E1
,
E2
,
E3
};
return
this
->
elem
(
offset_dst
[
i
]);
}
};
...
...
@@ -207,7 +216,7 @@ namespace detail
using
base_type
::
operator
=
;
operator
VecType
()
const
{
return
(
*
this
)();
}
GLM_FUNC_QUALIFIER
operator
VecType
()
const
{
return
(
*
this
)();
}
};
//
...
...
@@ -223,17 +232,17 @@ namespace detail
//
#define _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \
_GLM_SWIZZLE_TEMPLATE2
\
V
operator
OPERAND
(
const
_GLM_SWIZZLE_TYPE1
&
a
,
const
_GLM_SWIZZLE_TYPE2
&
b
)
\
GLM_FUNC_QUALIFIER
V
operator
OPERAND
(
const
_GLM_SWIZZLE_TYPE1
&
a
,
const
_GLM_SWIZZLE_TYPE2
&
b
)
\
{
\
return
a
()
OPERAND
b
();
\
}
\
_GLM_SWIZZLE_TEMPLATE1
\
V
operator
OPERAND
(
const
_GLM_SWIZZLE_TYPE1
&
a
,
const
V
&
b
)
\
GLM_FUNC_QUALIFIER
V
operator
OPERAND
(
const
_GLM_SWIZZLE_TYPE1
&
a
,
const
V
&
b
)
\
{
\
return
a
()
OPERAND
b
;
\
}
\
_GLM_SWIZZLE_TEMPLATE1
\
V
operator
OPERAND
(
const
V
&
a
,
const
_GLM_SWIZZLE_TYPE1
&
b
)
\
GLM_FUNC_QUALIFIER
V
operator
OPERAND
(
const
V
&
a
,
const
_GLM_SWIZZLE_TYPE1
&
b
)
\
{
\
return
a
OPERAND
b
();
\
}
...
...
@@ -243,12 +252,12 @@ namespace detail
//
#define _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \
_GLM_SWIZZLE_TEMPLATE1
\
V
operator
OPERAND
(
const
_GLM_SWIZZLE_TYPE1
&
a
,
const
T
&
b
)
\
GLM_FUNC_QUALIFIER
V
operator
OPERAND
(
const
_GLM_SWIZZLE_TYPE1
&
a
,
const
T
&
b
)
\
{
\
return
a
()
OPERAND
b
;
\
}
\
_GLM_SWIZZLE_TEMPLATE1
\
V
operator
OPERAND
(
const
T
&
a
,
const
_GLM_SWIZZLE_TYPE1
&
b
)
\
GLM_FUNC_QUALIFIER
V
operator
OPERAND
(
const
T
&
a
,
const
_GLM_SWIZZLE_TYPE1
&
b
)
\
{
\
return
a
OPERAND
b
();
\
}
...
...
@@ -258,7 +267,7 @@ namespace detail
//
#define _GLM_SWIZZLE_FUNCTION_1_ARGS(RETURN_TYPE,FUNCTION) \
_GLM_SWIZZLE_TEMPLATE1
\
typename
_GLM_SWIZZLE_TYPE1
::
RETURN_TYPE
FUNCTION
(
const
_GLM_SWIZZLE_TYPE1
&
a
)
\
GLM_FUNC_QUALIFIER
typename
_GLM_SWIZZLE_TYPE1
::
RETURN_TYPE
FUNCTION
(
const
_GLM_SWIZZLE_TYPE1
&
a
)
\
{
\
return
FUNCTION
(
a
());
\
}
...
...
@@ -268,22 +277,22 @@ namespace detail
//
#define _GLM_SWIZZLE_FUNCTION_2_ARGS(RETURN_TYPE,FUNCTION) \
_GLM_SWIZZLE_TEMPLATE2
\
typename
_GLM_SWIZZLE_TYPE1
::
RETURN_TYPE
FUNCTION
(
const
_GLM_SWIZZLE_TYPE1
&
a
,
const
_GLM_SWIZZLE_TYPE2
&
b
)
\
GLM_FUNC_QUALIFIER
typename
_GLM_SWIZZLE_TYPE1
::
RETURN_TYPE
FUNCTION
(
const
_GLM_SWIZZLE_TYPE1
&
a
,
const
_GLM_SWIZZLE_TYPE2
&
b
)
\
{
\
return
FUNCTION
(
a
(),
b
());
\
}
\
_GLM_SWIZZLE_TEMPLATE1
\
typename
_GLM_SWIZZLE_TYPE1
::
RETURN_TYPE
FUNCTION
(
const
_GLM_SWIZZLE_TYPE1
&
a
,
const
_GLM_SWIZZLE_TYPE1
&
b
)
\
GLM_FUNC_QUALIFIER
typename
_GLM_SWIZZLE_TYPE1
::
RETURN_TYPE
FUNCTION
(
const
_GLM_SWIZZLE_TYPE1
&
a
,
const
_GLM_SWIZZLE_TYPE1
&
b
)
\
{
\
return
FUNCTION
(
a
(),
b
());
\
}
\
_GLM_SWIZZLE_TEMPLATE1
\
typename
_GLM_SWIZZLE_TYPE1
::
RETURN_TYPE
FUNCTION
(
const
_GLM_SWIZZLE_TYPE1
&
a
,
const
typename
V
&
b
)
\
GLM_FUNC_QUALIFIER
typename
_GLM_SWIZZLE_TYPE1
::
RETURN_TYPE
FUNCTION
(
const
_GLM_SWIZZLE_TYPE1
&
a
,
const
typename
V
&
b
)
\
{
\
return
FUNCTION
(
a
(),
b
);
\
}
\
_GLM_SWIZZLE_TEMPLATE1
\
typename
_GLM_SWIZZLE_TYPE1
::
RETURN_TYPE
FUNCTION
(
const
V
&
a
,
const
_GLM_SWIZZLE_TYPE1
&
b
)
\
GLM_FUNC_QUALIFIER
typename
_GLM_SWIZZLE_TYPE1
::
RETURN_TYPE
FUNCTION
(
const
V
&
a
,
const
_GLM_SWIZZLE_TYPE1
&
b
)
\
{
\
return
FUNCTION
(
a
,
b
());
\
}
...
...
@@ -293,22 +302,22 @@ namespace detail
//
#define _GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(RETURN_TYPE,FUNCTION) \
_GLM_SWIZZLE_TEMPLATE2
\
typename
_GLM_SWIZZLE_TYPE1
::
RETURN_TYPE
FUNCTION
(
const
_GLM_SWIZZLE_TYPE1
&
a
,
const
_GLM_SWIZZLE_TYPE2
&
b
,
const
T
&
c
)
\
GLM_FUNC_QUALIFIER
typename
_GLM_SWIZZLE_TYPE1
::
RETURN_TYPE
FUNCTION
(
const
_GLM_SWIZZLE_TYPE1
&
a
,
const
_GLM_SWIZZLE_TYPE2
&
b
,
const
T
&
c
)
\
{
\
return
FUNCTION
(
a
(),
b
(),
c
);
\
}
\
_GLM_SWIZZLE_TEMPLATE1
\
typename
_GLM_SWIZZLE_TYPE1
::
RETURN_TYPE
FUNCTION
(
const
_GLM_SWIZZLE_TYPE1
&
a
,
const
_GLM_SWIZZLE_TYPE1
&
b
,
const
T
&
c
)
\
GLM_FUNC_QUALIFIER
typename
_GLM_SWIZZLE_TYPE1
::
RETURN_TYPE
FUNCTION
(
const
_GLM_SWIZZLE_TYPE1
&
a
,
const
_GLM_SWIZZLE_TYPE1
&
b
,
const
T
&
c
)
\
{
\
return
FUNCTION
(
a
(),
b
(),
c
);
\
}
\
_GLM_SWIZZLE_TEMPLATE1
\
typename
_GLM_SWIZZLE_TYPE1
::
RETURN_TYPE
FUNCTION
(
const
_GLM_SWIZZLE_TYPE1
&
a
,
const
typename
S0
::
vec_type
&
b
,
const
T
&
c
)
\
GLM_FUNC_QUALIFIER
typename
_GLM_SWIZZLE_TYPE1
::
RETURN_TYPE
FUNCTION
(
const
_GLM_SWIZZLE_TYPE1
&
a
,
const
typename
S0
::
vec_type
&
b
,
const
T
&
c
)
\
{
\
return
FUNCTION
(
a
(),
b
,
c
);
\
}
\
_GLM_SWIZZLE_TEMPLATE1
\
typename
_GLM_SWIZZLE_TYPE1
::
RETURN_TYPE
FUNCTION
(
const
typename
V
&
a
,
const
_GLM_SWIZZLE_TYPE1
&
b
,
const
T
&
c
)
\
GLM_FUNC_QUALIFIER
typename
_GLM_SWIZZLE_TYPE1
::
RETURN_TYPE
FUNCTION
(
const
typename
V
&
a
,
const
_GLM_SWIZZLE_TYPE1
&
b
,
const
T
&
c
)
\
{
\
return
FUNCTION
(
a
,
b
(),
c
);
\
}
...
...
@@ -640,6 +649,22 @@ namespace glm
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
0
,
2
,
3
,
1
>
E0
##
E2
##
E3
##
E1
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
0
,
2
,
3
,
2
>
E0
##
E2
##
E3
##
E2
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
0
,
2
,
3
,
3
>
E0
##
E2
##
E3
##
E3
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
0
,
3
,
0
,
0
>
E0
##
E3
##
E0
##
E0
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
0
,
3
,
0
,
1
>
E0
##
E3
##
E0
##
E1
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
0
,
3
,
0
,
2
>
E0
##
E3
##
E0
##
E2
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
0
,
3
,
0
,
3
>
E0
##
E3
##
E0
##
E3
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
0
,
3
,
1
,
0
>
E0
##
E3
##
E1
##
E0
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
0
,
3
,
1
,
1
>
E0
##
E3
##
E1
##
E1
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
0
,
3
,
1
,
2
>
E0
##
E3
##
E1
##
E2
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
0
,
3
,
1
,
3
>
E0
##
E3
##
E1
##
E3
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
0
,
3
,
2
,
0
>
E0
##
E3
##
E2
##
E0
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
0
,
3
,
2
,
1
>
E0
##
E3
##
E2
##
E1
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
0
,
3
,
2
,
2
>
E0
##
E3
##
E2
##
E2
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
0
,
3
,
2
,
3
>
E0
##
E3
##
E2
##
E3
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
0
,
3
,
3
,
0
>
E0
##
E3
##
E3
##
E0
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
0
,
3
,
3
,
1
>
E0
##
E3
##
E3
##
E1
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
0
,
3
,
3
,
2
>
E0
##
E3
##
E3
##
E2
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
0
,
3
,
3
,
3
>
E0
##
E3
##
E3
##
E3
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
1
,
0
,
0
,
0
>
E1
##
E0
##
E0
##
E0
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
1
,
0
,
0
,
1
>
E1
##
E0
##
E0
##
E1
;
};
\
struct
{
glm
::
detail
::
swizzle
<
4
,
T
,
P
,
1
,
0
,
0
,
2
>
E1
##
E0
##
E0
##
E2
;
};
\
...
...
include/glm/core/_swizzle_func.hpp
View file @
7e456138
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 201
2
G-Truc Creation (www.g-truc.net)
/// Copyright (c) 2005 - 201
3
G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
...
...
include/glm/core/_vectorize.hpp
View file @
7e456138
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 201
2
G-Truc Creation (www.g-truc.net)
/// Copyright (c) 2005 - 201
3
G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
...
...
include/glm/core/dummy.cpp
View file @
7e456138
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 201
2
G-Truc Creation (www.g-truc.net)
/// Copyright (c) 2005 - 201
3
G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
...
...
include/glm/core/func_common.hpp
View file @
7e456138
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 201
2
G-Truc Creation (www.g-truc.net)
/// Copyright (c) 2005 - 201
3
G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
...
...
@@ -50,7 +50,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/abs.xml">GLSL abs man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template
<
typename
genType
>
genType
abs
(
genType
const
&
x
);
GLM_FUNC_DECL
genType
abs
(
genType
const
&
x
);
/// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0.
///
...
...
@@ -59,7 +59,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sign.xml">GLSL sign man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template
<
typename
genType
>
genType
sign
(
genType
const
&
x
);
GLM_FUNC_DECL
genType
sign
(
genType
const
&
x
);
/// Returns a value equal to the nearest integer that is less then or equal to x.
///
...
...
@@ -68,7 +68,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floor.xml">GLSL floor man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template
<
typename
genType
>
genType
floor
(
genType
const
&
x
);
GLM_FUNC_DECL
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.
...
...
@@ -78,7 +78,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/trunc.xml">GLSL trunc man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template
<
typename
genType
>
genType
trunc
(
genType
const
&
x
);
GLM_FUNC_DECL
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
...
...
@@ -91,7 +91,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template
<
typename
genType
>
genType
round
(
genType
const
&
x
);
GLM_FUNC_DECL
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
...
...
@@ -103,7 +103,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
/// @see <a href="http://developer.amd.com/documentation/articles/pages/New-Round-to-Even-Technique.aspx">New round to even technique</a>
template
<
typename
genType
>
genType
roundEven
(
genType
const
&
x
);
GLM_FUNC_DECL
genType
roundEven
(
genType
const
&
x
);
/// Returns a value equal to the nearest integer
/// that is greater than or equal to x.
...
...
@@ -113,7 +113,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ceil.xml">GLSL ceil man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template
<
typename
genType
>
genType
ceil
(
genType
const
&
x
);
GLM_FUNC_DECL
genType
ceil
(
genType
const
&
x
);
/// Return x - floor(x).
///
...
...
@@ -122,7 +122,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fract.xml">GLSL fract man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template
<
typename
genType
>
genType
fract
(
genType
const
&
x
);
GLM_FUNC_DECL
genType
fract
(
genType
const
&
x
);
/// Modulus. Returns x - y * floor(x / y)
/// for each component in x using the floating point value y.
...
...
@@ -132,7 +132,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template
<
typename
genType
>
genType
mod
(
GLM_FUNC_DECL
genType
mod
(
genType
const
&
x
,
genType
const
&
y
);
...
...
@@ -144,7 +144,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template
<
typename
genType
>
genType
mod
(
GLM_FUNC_DECL
genType
mod
(
genType
const
&
x
,
typename
genType
::
value_type
const
&
y
);
...
...
@@ -158,7 +158,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/modf.xml">GLSL modf man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template
<
typename
genType
>
genType
modf
(
GLM_FUNC_DECL
genType
modf
(
genType
const
&
x
,
genType
&
i
);
...
...
@@ -169,12 +169,12 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/min.xml">GLSL min man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template
<
typename
genType
>
genType
min
(
GLM_FUNC_DECL
genType
min
(
genType
const
&
x
,
genType
const
&
y
);
template
<
typename
genType
>
genType
min
(
GLM_FUNC_DECL
genType
min
(
genType
const
&
x
,
typename
genType
::
value_type
const
&
y
);
...
...
@@ -185,12 +185,12 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/max.xml">GLSL max man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template
<
typename
genType
>
genType
max
(
GLM_FUNC_DECL
genType
max
(
genType
const
&
x
,
genType
const
&
y
);
template
<
typename
genType
>
genType
max
(
GLM_FUNC_DECL
genType
max
(
genType
const
&
x
,
typename
genType
::
value_type
const
&
y
);
...
...
@@ -202,33 +202,33 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template
<
typename
genType
>
genType
clamp
(
GLM_FUNC_DECL
genType
clamp
(
genType
const
&
x
,
genType
const
&
minVal
,
genType
const
&
maxVal
);
template
<
typename
genType
>
genType
clamp
(
GLM_FUNC_DECL
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.
//
/
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].
//
/
//
/
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.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mix.xml">GLSL mix man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
...
...
@@ -256,19 +256,19 @@ namespace glm
/// glm::vec4 u = glm::mix(g, h, r); // Interpolations can be perform per component with a vector for the last parameter.
/// @endcode
template
<
typename
genTypeT
,
typename
genTypeU
>
genTypeT
mix
(
genTypeT
const
&
x
,
genTypeT
const
&
y
,
genTypeU
const
&
a
);
GLM_FUNC_DECL
genTypeT
mix
(
genTypeT
const
&
x
,
genTypeT
const
&
y
,
genTypeU
const
&
a
);
//! Returns 0.0 if x < edge, otherwise it returns 1.0.
//!
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template
<
typename
genType
>
genType
step
(
GLM_FUNC_DECL
genType
step
(
genType
const
&
edge
,
genType
const
&
x
);
template
<
typename
genType
>
genType
step
(
GLM_FUNC_DECL
genType
step
(
typename
genType
::
value_type
const
&
edge
,
genType
const
&
x
);
...
...
@@ -278,8 +278,8 @@ namespace glm
/// 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);
/// t = clamp ((x
-
edge0) / (edge1
-
edge0), 0, 1);
/// return t * t * (3
-
2 * t);
/// Results are undefined if edge0 >= edge1.
///
/// @tparam genType Floating-point scalar or vector types.
...
...
@@ -287,13 +287,13 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/smoothstep.xml">GLSL smoothstep man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template
<
typename
genType
>
genType
smoothstep
(
GLM_FUNC_DECL
genType
smoothstep
(
genType
const
&
edge0
,
genType
const
&
edge1
,
genType
const
&
x
);
template
<
typename
genType
>
genType
smoothstep
(
GLM_FUNC_DECL
genType
smoothstep
(
typename
genType
::
value_type
const
&
edge0
,
typename
genType
::
value_type
const
&
edge1
,
genType
const
&
x
);
...
...
@@ -311,7 +311,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isnan.xml">GLSL isnan man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template
<
typename
genType
>
typename
genType
::
bool_type
isnan
(
genType
const
&
x
);
GLM_FUNC_DECL
typename
genType
::
bool_type
isnan
(
genType
const
&
x
);
/// Returns true if x holds a positive infinity or negative
/// infinity representation in the underlying implementation's
...
...
@@ -324,7 +324,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isinf.xml">GLSL isinf man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template
<
typename
genType
>
typename
genType
::
bool_type
isinf
(
genType
const
&
x
);
GLM_FUNC_DECL
typename
genType
::
bool_type
isinf
(
genType
const
&
x
);