# -*- coding: utf-8 -*-

# The MIT License (MIT)
#
# Copyright (c) 2014 mack stone
#
# 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
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.


@@ -1134,8 +1134,838 @@
 TWARE.%0A%0A
+%0Afrom func_exponential import *%0A%0A%0Adef normalize(x):%0A    %22%22%22Returns a vector in the same direction as x but with length of 1.%0A    .. seealso::%0A        %60GLSL normalize man page %3Chttp://www.opengl.org/sdk/docs/manglsl/xhtml/normalize.xml%3E%60_%0A        %60GLSL 4.20.8 specification, section 8.5 Geometric Functions %3Chttp://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf%3E%60_%22%22%22%0A    if isinstance(x, float) or isinstance(x, int) or isinstance(x, long):%0A        return -1.0 if x %3C 0.0 else 1.0%0A    #elif isinstance(x, Vec2):%0A        #sqr = x.x * x.x + x.y * x.y%0A        #return x * inversesqrt(sqr)%0A    elif isinstance(x, Vec3):%0A        sqr = x.x * x.x + x.y * x.y + x.z * x.z%0A        return x * inversesqrt(sqr)%0A    elif isinstance(x, Vec4):%0A        sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w%0A        return x * inversesqrt(sqr)%0A

implement normalize function