From dbca36a123ec7422ce098193a929a75945a84eb5 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 26 Apr 2011 15:46:22 +0100 Subject: [PATCH] Added noise function declarations --- glm/gtx/noise.inl | 62 +++++++++++++++++++++++++++++++++++++++--- test/gtx/gtx-noise.cpp | 8 +++++- 2 files changed, 65 insertions(+), 5 deletions(-) diff --git a/glm/gtx/noise.inl b/glm/gtx/noise.inl index 8533704e..8353d8f8 100644 --- a/glm/gtx/noise.inl +++ b/glm/gtx/noise.inl @@ -18,13 +18,13 @@ namespace glm { template class vecType> - inline vecType permute(vecType const & x) + GLM_FUNC_QUALIFIER vecType permute(vecType const & x) { return mod(((x * T(34)) + T(1)) * x, T(289)); } template class vecType> - inline vecType taylorInvSqrt(vecType const & r) + GLM_FUNC_QUALIFIER vecType taylorInvSqrt(vecType const & r) { return T(1.79284291400159) - T(0.85373472095314) * r; } @@ -32,8 +32,56 @@ namespace glm namespace gtx{ namespace noise { + template + GLM_FUNC_QUALIFIER T cnoise(glm::detail::tvec2 const & v) + { + return T(0); + } + + template + GLM_FUNC_QUALIFIER T cnoise(glm::detail::tvec3 const & v) + { + return T(0); + } + + template + GLM_FUNC_QUALIFIER T cnoise(glm::detail::tvec4 const & v) + { + return T(0); + } + + template + GLM_FUNC_QUALIFIER T pnoise + ( + glm::detail::tvec2 const & p, + glm::detail::tvec2 const & rep + ) + { + return T(0); + } + + template + GLM_FUNC_QUALIFIER T pnoise + ( + glm::detail::tvec3 const & p, + glm::detail::tvec3 const & rep + ) + { + return T(0); + } + + template + GLM_FUNC_QUALIFIER T pnoise + ( + glm::detail::tvec4 const & p, + glm::detail::tvec4 const & rep + ) + { + return T(0); + } + template - inline T snoise(glm::detail::tvec2 const & v) + GLM_FUNC_QUALIFIER T snoise(glm::detail::tvec2 const & v) { detail::tvec4 const C = detail::tvec4( T( 0.211324865405187), // (3.0 - sqrt(3.0)) / 6.0 @@ -90,7 +138,7 @@ namespace noise } template - inline T snoise(glm::detail::tvec3 const & v) + GLM_FUNC_QUALIFIER T snoise(glm::detail::tvec3 const & v) { detail::tvec2 const C = detail::tvec2(1.0 / 6.0, 1.0 / 3.0); detail::tvec4 const D = detail::tvec4(0.0, 0.5, 1.0, 2.0); @@ -176,6 +224,12 @@ namespace noise dot(p3, x3))); } + template + GLM_FUNC_QUALIFIER T snoise(glm::detail::tvec4 const & v) + { + return T(0); + } + }//namespace noise }//namespace gtx }//namespace glm diff --git a/test/gtx/gtx-noise.cpp b/test/gtx/gtx-noise.cpp index 5123be08..8068cf21 100644 --- a/test/gtx/gtx-noise.cpp +++ b/test/gtx/gtx-noise.cpp @@ -2,7 +2,7 @@ // OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2011-04-21 -// Updated : 2011-04-21 +// Updated : 2011-04-26 // Licence : This source is under MIT licence // File : test/gtx/noise.cpp /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -14,4 +14,10 @@ int main() { 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)); }