From c068f22329d5cc722622a2183bbb22eef2093df7 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Mon, 24 Aug 2026 11:16:07 +0200 Subject: initial import --- src/libraries/glm/gtx/wrap.inl | 165 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100755 src/libraries/glm/gtx/wrap.inl (limited to 'src/libraries/glm/gtx/wrap.inl') diff --git a/src/libraries/glm/gtx/wrap.inl b/src/libraries/glm/gtx/wrap.inl new file mode 100755 index 0000000..bd3f125 --- /dev/null +++ b/src/libraries/glm/gtx/wrap.inl @@ -0,0 +1,165 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2009-11-25 +// Updated : 2010-02-13 +// Licence : This source is under MIT License +// File : glm/gtx/wrap.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + template + GLM_FUNC_QUALIFIER genType clamp + ( + genType const & Texcoord + ) + { + return glm::clamp(Texcoord, genType(0), genType(1)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 clamp + ( + detail::tvec2 const & Texcoord + ) + { + detail::tvec2 Result; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + Result[i] = clamp(Texcoord[i]); + return Result; + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 clamp + ( + detail::tvec3 const & Texcoord + ) + { + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + Result[i] = clamp(Texcoord[i]); + return Result; + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 clamp + ( + detail::tvec4 const & Texcoord + ) + { + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + Result[i] = clamp(Texcoord[i]); + return Result; + } + + //////////////////////// + // repeat + + template + GLM_FUNC_QUALIFIER genType repeat + ( + genType const & Texcoord + ) + { + return glm::fract(Texcoord); + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 repeat + ( + detail::tvec2 const & Texcoord + ) + { + detail::tvec2 Result; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + Result[i] = repeat(Texcoord[i]); + return Result; + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 repeat + ( + detail::tvec3 const & Texcoord + ) + { + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + Result[i] = repeat(Texcoord[i]); + return Result; + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 repeat + ( + detail::tvec4 const & Texcoord + ) + { + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + Result[i] = repeat(Texcoord[i]); + return Result; + } + + //////////////////////// + // mirrorRepeat + + template + GLM_FUNC_QUALIFIER genType mirrorRepeat + ( + genType const & Texcoord + ) + { + genType const Clamp = genType(int(glm::floor(Texcoord)) % 2); + genType const Floor = glm::floor(Texcoord); + genType const Rest = Texcoord - Floor; + genType const Mirror = Clamp + Rest; + + genType Out; + if(Mirror >= genType(1)) + Out = genType(1) - Rest; + else + Out = Rest; + return Out; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 mirrorRepeat + ( + detail::tvec2 const & Texcoord + ) + { + detail::tvec2 Result; + for(typename detail::tvec2::size_type i = 0; i < detail::tvec2::value_size(); ++i) + Result[i] = mirrorRepeat(Texcoord[i]); + return Result; + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 mirrorRepeat + ( + detail::tvec3 const & Texcoord + ) + { + detail::tvec3 Result; + for(typename detail::tvec3::size_type i = 0; i < detail::tvec3::value_size(); ++i) + Result[i] = mirrorRepeat(Texcoord[i]); + return Result; + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 mirrorRepeat + ( + detail::tvec4 const & Texcoord + ) + { + detail::tvec4 Result; + for(typename detail::tvec4::size_type i = 0; i < detail::tvec4::value_size(); ++i) + Result[i] = mirrorRepeat(Texcoord[i]); + return Result; + } +}//namespace glm -- cgit v1.2.3