From a805b42f8b5d227307135ce9e1684ea42f527fe0 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 21 Apr 2011 12:27:05 +0100 Subject: [PATCH] Added noise extension and test files --- glm/ext.hpp | 1 + glm/gtx/bit.hpp | 2 ++ glm/gtx/noise.hpp | 70 +++++++++++++++++++++++++++++++++++++++++ glm/gtx/noise.inl | 27 ++++++++++++++++ test/gtx/CMakeLists.txt | 1 + test/gtx/gtx-noise.cpp | 17 ++++++++++ 6 files changed, 118 insertions(+) create mode 100644 glm/gtx/noise.hpp create mode 100644 glm/gtx/noise.inl create mode 100644 test/gtx/gtx-noise.cpp diff --git a/glm/ext.hpp b/glm/ext.hpp index dc296f86..5f1d2121 100644 --- a/glm/ext.hpp +++ b/glm/ext.hpp @@ -53,6 +53,7 @@ #include "./gtx/matrix_query.hpp" #include "./gtx/mixed_product.hpp" #include "./gtx/multiple.hpp" +#include "./gtx/noise.hpp" #include "./gtx/norm.hpp" #include "./gtx/normal.hpp" #include "./gtx/normalize_dot.hpp" diff --git a/glm/gtx/bit.hpp b/glm/gtx/bit.hpp index 240502c4..f6c689f2 100644 --- a/glm/gtx/bit.hpp +++ b/glm/gtx/bit.hpp @@ -36,6 +36,7 @@ namespace glm /// \addtogroup gtx_bit ///@{ + //! Build a mask of 'count' bits //! From GLM_GTX_bit extension. template @@ -99,6 +100,7 @@ namespace glm //! From GLM_GTX_bit extension. template genType bitRotateLeft(genType const & In, std::size_t Shift); + ///@} }//namespace bit diff --git a/glm/gtx/noise.hpp b/glm/gtx/noise.hpp new file mode 100644 index 00000000..d83dc460 --- /dev/null +++ b/glm/gtx/noise.hpp @@ -0,0 +1,70 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Based on the work of Stefan Gustavson and Ashima Arts on "webgl-noise": +// https://github.com/ashima/webgl-noise +// Following Stefan Gustavson's paper "Simplex noise demystified": +// http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2011-04-21 +// Updated : 2011-04-21 +// Licence : This source is under MIT License +// File : glm/gtx/noise.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef glm_gtx_noise +#define glm_gtx_noise + +// Dependency: +#include "../glm.hpp" + +#if(defined(GLM_MESSAGES) && !defined(glm_ext)) +# pragma message("GLM: GLM_GTX_noise extension included") +#endif + +namespace glm +{ + namespace test{ + void main_gtx_noise(); + }//namespace test + + namespace gtx{ + //! GLM_GTX_noise extension: Comparison functions for a user defined epsilon values. + namespace noise + { + /// \addtogroup gtx_noise + ///@{ + + //! Classic perlin noise. + //! From GLM_GTX_noise extension. + template + typename vecType::value_type cnoise( + vecType const & p); + + //! Periodic perlin noise. + //! From GLM_GTX_noise extension. + template + typename vecType::value_type pnoise( + vecType const & p, + vecType const & rep); + + //! Simplex noise. + //! From GLM_GTX_noise extension. + template + typename vecType::value_type snoise( + vecType const & p); + + ///@} + + }//namespace noise + }//namespace gtx +}//namespace glm + +#include "noise.inl" + +namespace glm{using namespace gtx::noise;} + +#endif//glm_gtx_noise diff --git a/glm/gtx/noise.inl b/glm/gtx/noise.inl new file mode 100644 index 00000000..3a7c074f --- /dev/null +++ b/glm/gtx/noise.inl @@ -0,0 +1,27 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Based on the work of Stefan Gustavson and Ashima Arts on "webgl-noise": +// https://github.com/ashima/webgl-noise +// Following Stefan Gustavson's paper "Simplex noise demystified": +// http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2011-04-21 +// Updated : 2011-04-21 +// Licence : This source is under MIT License +// File : glm/gtx/noise.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm{ +namespace gtx{ +namespace noise +{ + + + +}//namespace noise +}//namespace gtx +}//namespace glm diff --git a/test/gtx/CMakeLists.txt b/test/gtx/CMakeLists.txt index a10131e5..955c47f0 100644 --- a/test/gtx/CMakeLists.txt +++ b/test/gtx/CMakeLists.txt @@ -1,3 +1,4 @@ glmCreateTestGTC(gtx-bit) +glmCreateTestGTC(gtx-noise) glmCreateTestGTC(gtx-simd-vec4) glmCreateTestGTC(gtx-simd-mat4) diff --git a/test/gtx/gtx-noise.cpp b/test/gtx/gtx-noise.cpp new file mode 100644 index 00000000..8bcb4c82 --- /dev/null +++ b/test/gtx/gtx-noise.cpp @@ -0,0 +1,17 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2011-04-21 +// Updated : 2011-04-21 +// Licence : This source is under MIT licence +// File : test/gtx/noise.cpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include + +int main() +{ + +}