Added noise function declarations
This commit is contained in:
parent
00169d0cde
commit
dbca36a123
@ -18,13 +18,13 @@
|
|||||||
namespace glm
|
namespace glm
|
||||||
{
|
{
|
||||||
template <typename T, template<typename> class vecType>
|
template <typename T, template<typename> class vecType>
|
||||||
inline vecType<T> permute(vecType<T> const & x)
|
GLM_FUNC_QUALIFIER vecType<T> permute(vecType<T> const & x)
|
||||||
{
|
{
|
||||||
return mod(((x * T(34)) + T(1)) * x, T(289));
|
return mod(((x * T(34)) + T(1)) * x, T(289));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, template<typename> class vecType>
|
template <typename T, template<typename> class vecType>
|
||||||
inline vecType<T> taylorInvSqrt(vecType<T> const & r)
|
GLM_FUNC_QUALIFIER vecType<T> taylorInvSqrt(vecType<T> const & r)
|
||||||
{
|
{
|
||||||
return T(1.79284291400159) - T(0.85373472095314) * r;
|
return T(1.79284291400159) - T(0.85373472095314) * r;
|
||||||
}
|
}
|
||||||
@ -33,7 +33,55 @@ namespace gtx{
|
|||||||
namespace noise
|
namespace noise
|
||||||
{
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T snoise(glm::detail::tvec2<T> const & v)
|
GLM_FUNC_QUALIFIER T cnoise(glm::detail::tvec2<T> const & v)
|
||||||
|
{
|
||||||
|
return T(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
GLM_FUNC_QUALIFIER T cnoise(glm::detail::tvec3<T> const & v)
|
||||||
|
{
|
||||||
|
return T(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
GLM_FUNC_QUALIFIER T cnoise(glm::detail::tvec4<T> const & v)
|
||||||
|
{
|
||||||
|
return T(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
GLM_FUNC_QUALIFIER T pnoise
|
||||||
|
(
|
||||||
|
glm::detail::tvec2<T> const & p,
|
||||||
|
glm::detail::tvec2<T> const & rep
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return T(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
GLM_FUNC_QUALIFIER T pnoise
|
||||||
|
(
|
||||||
|
glm::detail::tvec3<T> const & p,
|
||||||
|
glm::detail::tvec3<T> const & rep
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return T(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
GLM_FUNC_QUALIFIER T pnoise
|
||||||
|
(
|
||||||
|
glm::detail::tvec4<T> const & p,
|
||||||
|
glm::detail::tvec4<T> const & rep
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return T(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
GLM_FUNC_QUALIFIER T snoise(glm::detail::tvec2<T> const & v)
|
||||||
{
|
{
|
||||||
detail::tvec4<T> const C = detail::tvec4<T>(
|
detail::tvec4<T> const C = detail::tvec4<T>(
|
||||||
T( 0.211324865405187), // (3.0 - sqrt(3.0)) / 6.0
|
T( 0.211324865405187), // (3.0 - sqrt(3.0)) / 6.0
|
||||||
@ -90,7 +138,7 @@ namespace noise
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T snoise(glm::detail::tvec3<T> const & v)
|
GLM_FUNC_QUALIFIER T snoise(glm::detail::tvec3<T> const & v)
|
||||||
{
|
{
|
||||||
detail::tvec2<T> const C = detail::tvec2<T>(1.0 / 6.0, 1.0 / 3.0);
|
detail::tvec2<T> const C = detail::tvec2<T>(1.0 / 6.0, 1.0 / 3.0);
|
||||||
detail::tvec4<T> const D = detail::tvec4<T>(0.0, 0.5, 1.0, 2.0);
|
detail::tvec4<T> const D = detail::tvec4<T>(0.0, 0.5, 1.0, 2.0);
|
||||||
@ -176,6 +224,12 @@ namespace noise
|
|||||||
dot(p3, x3)));
|
dot(p3, x3)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
GLM_FUNC_QUALIFIER T snoise(glm::detail::tvec4<T> const & v)
|
||||||
|
{
|
||||||
|
return T(0);
|
||||||
|
}
|
||||||
|
|
||||||
}//namespace noise
|
}//namespace noise
|
||||||
}//namespace gtx
|
}//namespace gtx
|
||||||
}//namespace glm
|
}//namespace glm
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Created : 2011-04-21
|
// Created : 2011-04-21
|
||||||
// Updated : 2011-04-21
|
// Updated : 2011-04-26
|
||||||
// Licence : This source is under MIT licence
|
// Licence : This source is under MIT licence
|
||||||
// File : test/gtx/noise.cpp
|
// File : test/gtx/noise.cpp
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -14,4 +14,10 @@
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
float ValueSNoise2D = glm::snoise(glm::vec2(0.5f));
|
float ValueSNoise2D = glm::snoise(glm::vec2(0.5f));
|
||||||
|
float ValueSNoise3D = glm::snoise(glm::vec3(0.5f));
|
||||||
|
float ValueSNoise4D = glm::snoise(glm::vec4(0.5f));
|
||||||
|
|
||||||
|
float ValueCNoise2D = glm::cnoise(glm::vec2(0.5f));
|
||||||
|
float ValueCNoise3D = glm::cnoise(glm::vec3(0.5f));
|
||||||
|
float ValueCNoise4D = glm::cnoise(glm::vec4(0.5f));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user