/***************************************************************************************************
 * Copyright 2022 NVIDIA Corporation. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *  * Neither the name of NVIDIA CORPORATION nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 **************************************************************************************************/

mdl 1.8;

import ::anno::*;
import ::math::*;

using .::aux_definitions import xy;
import ::state::*;
import ::scene::*;

export using ::state import coordinate_space; //enum type
import ::tex::*;
export using ::tex import gamma_mode; //enum type
export using ::tex import wrap_mode; //enum type
module [[
    anno::version( 1, 1, 0),
    anno::display_name("NVIDIA support definitions")
]];


export float data_lookup_float( uniform string name, float default_value = float()) [[
    anno::display_name("Data lookup float"),
    anno::description("Returns a scene data of a given name if it exists on the mesh"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars")
]]
{
    return scene::data_lookup_float(name, default_value);
}

export float2 data_lookup_float2( uniform string name, float2 default_value = float2()) [[
    anno::display_name("Data lookup float2"),
    anno::description("Returns a scene data of a given name if it exists on the mesh"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars")
]]
{
    return scene::data_lookup_float2(name, default_value);
}

export float3 data_lookup_float3( uniform string name, float3 default_value = float3()) [[
    anno::display_name("Data lookup float3"),
    anno::description("Returns a scene data of a given name if it exists on the mesh"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars")
]]
{
    return scene::data_lookup_float3(name, default_value);
}

export float4 data_lookup_float4( uniform string name, float4 default_value = float4()) [[
    anno::display_name("Data lookup float4"),
    anno::description("Returns a scene data of a given name if it exists on the mesh"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars")
]]
{
    return scene::data_lookup_float4(name, default_value);
}

export int data_lookup_int( uniform string name, int default_value = int()) [[
    anno::display_name("Data lookup int"),
    anno::description("Returns a scene data of a given name if it exists on the mesh"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars")
]]
{
    return scene::data_lookup_int(name, default_value);
}

export int2 data_lookup_int2( uniform string name, int2 default_value = int2()) [[
    anno::display_name("Data lookup int2"),
    anno::description("Returns a scene data of a given name if it exists on the mesh"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars")
]]
{
    return scene::data_lookup_int2(name, default_value);
}

export int3 data_lookup_int3( uniform string name, int3 default_value = int3()) [[
    anno::display_name("Data lookup int3"),
    anno::description("Returns a scene data of a given name if it exists on the mesh"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars")
]]
{
    return scene::data_lookup_int3(name, default_value);
}

export int4 data_lookup_int4( uniform string name, int4 default_value = int4()) [[
    anno::display_name("Data lookup int4"),
    anno::description("Returns a scene data of a given name if it exists on the mesh"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars")
]]
{
    return scene::data_lookup_int4(name, default_value);
}

export color data_lookup_color( uniform string name, color default_value = color()) [[
    anno::display_name("Data lookup color"),
    anno::description("Returns a scene data of a given name if it exists on the mesh"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars")
]]
{
    return scene::data_lookup_color(name, default_value);
}

export uniform float data_lookup_uniform_float( uniform string name, uniform float default_value = float()) [[
    anno::display_name("Data lookup unfirom float"),
    anno::description("Returns a scene data of a given name if it exists on the mesh"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars")
]]
{
    return scene::data_lookup_uniform_float(name, default_value);
}

export uniform float2 data_lookup_uniform_float2( uniform string name, uniform float2 default_value = float2()) [[
    anno::display_name("Data lookup uniform float2"),
    anno::description("Returns a scene data of a given name if it exists on the mesh"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars")
]]
{
    return scene::data_lookup_uniform_float2(name, default_value);
}

export uniform float3 data_lookup_uniform_float3( uniform string name, uniform float3 default_value = float3()) [[
    anno::display_name("Data lookup uniform float3"),
    anno::description("Returns a scene data of a given name if it exists on the mesh"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars")
]]
{
    return scene::data_lookup_uniform_float3(name, default_value);
}

export uniform float4 data_lookup_uniform_float4( uniform string name, uniform float4 default_value = float4()) [[
    anno::display_name("Data lookup unfirom float4"),
    anno::description("Returns a scene data of a given name if it exists on the mesh"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars")
]]
{
    return scene::data_lookup_uniform_float4(name, default_value);
}

export uniform int data_lookup_uniform_int( uniform string name, uniform int default_value = int()) [[
    anno::display_name("Data lookup uniform int"),
    anno::description("Returns a scene data of a given name if it exists on the mesh"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars")
]]
{
    return scene::data_lookup_uniform_int(name, default_value);
}

export uniform int2 data_lookup_uniform_int2( uniform string name, uniform int2 default_value = int2()) [[
    anno::display_name("Data lookup uniform int2"),
    anno::description("Returns a scene data of a given name if it exists on the mesh"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars")
]]
{
    return scene::data_lookup_uniform_int2(name, default_value);
}

export uniform int3 data_lookup_uniform_int3( uniform string name, uniform int3 default_value = int3()) [[
    anno::display_name("Data lookup uniform int3"),
    anno::description("Returns a scene data of a given name if it exists on the mesh"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars")
]]
{
    return scene::data_lookup_uniform_int3(name, default_value);
}

export uniform int4 data_lookup_uniform_int4( uniform string name, uniform int4 default_value = int4())
 [[
    anno::display_name("Data lookup uniform int4"),
    anno::description("Returns a scene data of a given name if it exists on the mesh"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars")
]]
{
    return scene::data_lookup_uniform_int4(name, default_value);
}

export uniform color data_lookup_uniform_color( uniform string name, uniform color default_value = color()) [[
    anno::display_name("Data lookup uniform color"),
    anno::description("Returns a scene data of a given name if it exists on the mesh"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars")
]]
{
    return scene::data_lookup_uniform_color(name, default_value);
}



//operator nodes
export int add(int a=0, int b=0)
[[
    anno::display_name("Add"),
    anno::description("Returns the sum of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(300)
]]{return a+b;}
export float add(float a=0.0, float b=0.0)
[[
    anno::display_name("Add"),
    anno::description("Returns the sum of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(301)
]]{return a+b;}
export float2 add(float2 a=float2(0.0), float2 b=float2(0.0))
[[
    anno::display_name("Add"),
    anno::description("Returns the sum of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(302)
]]{return a+b;}
export float3 add(float3 a=float3(0.0), float3 b=float3(0.0))
[[
    anno::display_name("Add"),
    anno::description("Returns the sum of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(303)
]]{return a+b;}
export float4 add(float4 a=float4(0.0), float4 b=float4(0.0))
[[
    anno::display_name("Add"),
    anno::description("Returns the sum of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(304)
]]{return a+b;}
export color add(color a=color(0.0), color b=color(0.0))
[[
    anno::display_name("Add"),
    anno::description("Returns the sum of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(305)
]]{return a+b;}
export int subtract(int a=0, int b=0)
[[
    anno::display_name("Subtract"),
    anno::description("Returns the difference of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(310)
]]{return a-b;}
export float subtract(float a=0.0, float b=0.0)
[[
    anno::display_name("Subtract"),
    anno::description("Returns the difference of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(311)
]]{return a-b;}
export float2 subtract(float2 a=float2(0.0), float2 b=float2(0.0))
[[
    anno::display_name("Subtract"),
    anno::description("Returns the difference of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(312)
]]{return a-b;}
export float3 subtract(float3 a=float3(0.0), float3 b=float3(0.0))
[[
    anno::display_name("Subtract"),
    anno::description("Returns the difference of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(313)
]]{return a-b;}
export float4 subtract(float4 a=float4(0.0), float4 b=float4(0.0))
[[
    anno::display_name("Subtract"),
    anno::description("Returns the difference of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(314)
]]{return a-b;}
export color subtract(color a=color(0.0), color b=color(0.0))
[[
    anno::display_name("Subtract"),
    anno::description("Returns the difference of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(315)
]]{return a-b;}
export int multiply(int a=0, int b=0)
[[
    anno::display_name("Multiply"),
    anno::description("Returns the difference of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(320)
]]{return a*b;}
export float multiply(float a=0.0, float b=0.0)
[[
    anno::display_name("Multiply"),
    anno::description("Returns the product of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(321)
]]{return a*b;}
export float2 multiply(float2 a=float2(0.0), float2 b=float2(0.0))
[[
    anno::display_name("Multiply"),
    anno::description("Returns the product of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(322)
]]{return a*b;}
export float3 multiply(float3 a=float3(0.0), float3 b=float3(0.0))
[[
    anno::display_name("Multiply"),
    anno::description("Returns the product of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(323)
]]{return a*b;}
export float4 multiply(float4 a=float4(0.0), float4 b=float4(0.0))
[[
    anno::display_name("Multiply"),
    anno::description("Returns the product of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(324)
]]{return a*b;}
export color multiply(color a=color(0.0), color b=color(0.0))
[[
    anno::display_name("Multiply"),
    anno::description("Returns the product of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(325)
]]{return a*b;}
export int divide(int a=0, int b=0)
[[
    anno::display_name("Divide"),
    anno::description("Returns the quotient of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(326)
]]{return a/b;}
export float divide(float a=0.0, float b=0.0)
[[
    anno::display_name("Divide"),
    anno::description("Returns the quotient of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(327)
]]{return a/b;}
export float2 divide(float2 a=float2(0.0), float2 b=float2(0.0))
[[
    anno::display_name("Divide"),
    anno::description("Returns the quotient of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(328)
]]{return a/b;}
export float3 divide(float3 a=float3(0.0), float3 b=float3(0.0))
[[
    anno::display_name("Divide"),
    anno::description("Returns the quotient of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(329)
]]{return a/b;}
export float4 divide(float4 a=float4(0.0), float4 b=float4(0.0))
[[
    anno::display_name("Divide"),
    anno::description("Returns the quotient of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(330)
]]{return a/b;}
export color divide(color a=color(0.0), color b=color(0.0))
[[
    anno::display_name("Divide"),
    anno::description("Returns the quotient of 2 values. For vector types it operates per component."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(331)
]]{return a/b;}
export int condition(uniform bool x=true,int a=0, int b=0)
[[
    anno::display_name("Condition?"),
    anno::description("Returns either a or b based on a condition"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(332)
]]{return x?a:b;}
export float condition(uniform bool x=true,float a=0.0, float b=0.0)
[[
    anno::display_name("Condition?"),
    anno::description("Returns either a or b based on a condition"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(333)
]]{return x?a:b;}
export float2 condition(uniform bool x=true,float2 a=float2(0.0), float2 b=float2(0.0))
[[
    anno::display_name("Condition?"),
    anno::description("Returns either a or b based on a condition"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(334)
]]{return x?a:b;}
export float3 condition(uniform bool x=true,float3 a=float3(0.0), float3 b=float3(0.0))
[[
    anno::display_name("Condition?"),
    anno::description("Returns either a or b based on a condition"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(335)
]]{return x?a:b;}
export float4 condition(uniform bool x=true,float4 a=float4(0.0), float4 b=float4(0.0))
[[
    anno::display_name("Condition?"),
    anno::description("Returns either a or b based on a condition"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(336)
]]{return x?a:b;}
export color condition(uniform bool x=true,color a=color(0.0), color b=color(0.0))
[[
    anno::display_name("Condition?"),
    anno::description("Returns either a or b based on a condition"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(337)
]]{return x?a:b;}
export bool compare(float a, float b)
[[
    anno::display_name("Compare"),
    anno::description("Returns true if a is lager then b"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(338)
]]{return a>b;}
export bool equality(bool a, bool b)
[[
    anno::display_name("Check equality bool"),
    anno::description("Returns true if a equals b"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(339)
]]{return a==b;}
export bool equality(int a, int b)
[[
    anno::display_name("Check equality int"),
    anno::description("Returns true if a equals b"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(340)
]]{return a==b;}
export bool equality(int2 a, int2 b)
[[
    anno::display_name("Check equality int2"),
    anno::description("Returns true if a equals b"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(341)
]]{return a==b;}
export bool equality(int3 a, int3 b)
[[
    anno::display_name("Check equality int3"),
    anno::description("Returns true if a equals b"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(342)
]]{return a==b;}
export bool equality(float a, float b)
[[
    anno::display_name("Check equality float"),
    anno::description("Returns true if a equals b"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(343)
]]{return a==b;}
export bool equality(float2 a, float2 b)
[[
    anno::display_name("Check equality float2"),
    anno::description("Returns true if a equals b"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(344)
]]{return a==b;}
export bool equality(float3 a, float3 b)
[[
    anno::display_name("Check equality float3"),
    anno::description("Returns true if a equals b"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(345)
]]{return a==b;}
export bool equality(color a, color b)
[[
    anno::display_name("Check equality color"),
    anno::description("Returns true if a equals b"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(346)
]]{return a==b;}

//constants nodes.
export bool bool_const(uniform bool b = true)
[[
    anno::display_name("Constant bool"),
    anno::description("A node just returning a value without changing it"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Constants"),
    anno::ui_order(1000)
]]{return b;}
export int int_const(uniform int i = 0)
[[
    anno::display_name("Constant int"),
    anno::description("A node just returning a value without changing it"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Constants"),
    anno::ui_order(1001)
]]{return i;}
export float float_const(uniform float f = 0.)
[[
    anno::display_name("Constant float"),
    anno::description("A node just returning a value without changing it"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Constants"),
    anno::ui_order(1002)
]]{return f;}
export float2 float2_const(uniform float2 f2 = float2(0.))
[[
    anno::display_name("Constant float2"),
    anno::description("A node just returning a value without changing it"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Constants"),
    anno::ui_order(1003)
]]{return f2;}
export float3 float3_const(uniform float3 f3 = float3(0.))
[[
    anno::display_name("Constant float3"),
    anno::description("A node just returning a value without changing it"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Constants"),
    anno::ui_order(1004)
]]{return f3;}
export float4 float4_const(uniform float4 f4 = float4(0.))
[[
    anno::display_name("Constant float4"),
    anno::description("A node just returning a value without changing it"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Constants"),
    anno::ui_order(1005)
]]{return f4;}
export color color_const(uniform color c = color(0.))
[[
    anno::display_name("Constant color"),
    anno::description("A node just returning a value without changing it"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Constants"),
    anno::ui_order(1006)
]]{return c;}
export uniform texture_2d texture_2d_const(uniform texture_2d tex = texture_2d())[[
    anno::display_name("Constant texture_2d"),
    anno::description("A node just returning a value without changing it"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Constants"),
    anno::ui_order(1007)
]]{return tex;}

//exports from tex:
export int texture_width( uniform texture_2d tex = texture_2d()) uniform
[[
    anno::display_name("Width of texture"),
    anno::description("Returns width of a texture in pixel"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Texturing, basic"),
    anno::ui_order(141)
]]{ return tex::width(tex); }
export int texture_width( uniform texture_2d tex = texture_2d(), int2 uv_tile = int2(0, 0)) uniform
[[
    anno::display_name("Width of a texture tile"),
    anno::description("Returns width of a texture tile in pixel"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Texturing, basic"),
    anno::ui_order(143)
]]{ return tex::width(tex, uv_tile); }
export int height( uniform texture_2d tex = texture_2d()) uniform
[[
    anno::display_name("Height of texture"),
    anno::description("Returns height of a texture in pixel"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Texturing, basic"),
    anno::ui_order(142)
]]{ return tex::height(tex); }
export int height( uniform texture_2d tex = texture_2d(), int2 uv_tile = int2(0, 0)) uniform
[[
    anno::display_name("Height of a texture tile"),
    anno::description("Returns height of a texture tile in pixel"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Texturing, basic"),
    anno::ui_order(144)
]]{ return tex::height(tex,uv_tile); }

/*export int width(uniform texture_3d tex) uniform [[ intrinsic() ]];
export int height(uniform texture_3d tex) uniform [[ intrinsic() ]];
export int depth(uniform texture_3d tex) uniform [[ intrinsic() ]];

export int width(uniform texture_cube tex) uniform [[ intrinsic() ]];
export int height(uniform texture_cube tex) uniform [[ intrinsic() ]];
*/

export float2 transform_st(float rotation = 0.0, float2 translation = float2(0.0), float2 scale = float2(1.0), float2 st = float2(0.0))
[[
    anno::display_name("Transform 2D"),
    anno::description("Rotate/translate/scale a 2D coordinate"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(1019)
]]{
    float s = math::sin(rotation);
	float c = math::cos(rotation);
	float2 st_t=st;
	st_t = float2(s*st_t.x+c*st_t.y,s*st_t.y-c*st_t.x);
	return st_t*scale+ translation;
}

export color biased_color_blend(float w1 = 0.0, color c1 = color(0.0), float w2 = 0.0, color c2 = color(0.0), float w3 = 0.0, color c3 = color(0.0), color mean = color(0.5))
[[
    anno::display_name("Biased color blend"),
    anno::description("Blend up to 3 colors. Set mean to the average color to preserve contrast when blending textures"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(539)
]]
{
	color o=w1*c1+w2*c2+w3*c3;
	float s=w1+w2+w3;
	float s2=w1*w1+w2*w2+w3*w3;
return mean + (o-s*mean)/   math::sqrt(s2);
}	


export float lookup_float( uniform texture_2d tex = texture_2d(), float2 coord = float2(0.),
    uniform wrap_mode wrap_u = wrap_repeat, uniform wrap_mode  wrap_v = wrap_repeat,
    uniform float2 crop_u = float2(0.0, 1.0), uniform float2 crop_v = float2(0.0, 1.0), float frame = 0.0) uniform
[[
    anno::display_name("Texture lookup float"),
    anno::description("Returns a value from a bitmap texture"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Texturing, basic"),
    anno::ui_order(100)
]]{ return tex::lookup_float( tex, coord, wrap_u, wrap_v, crop_u, crop_v, frame); }
/*
export float lookup_float(
    uniform texture_3d tex,
    float3             coord,
    uniform wrap_mode  wrap_u = wrap_repeat,
    uniform wrap_mode  wrap_v = wrap_repeat,
    uniform wrap_mode  wrap_w = wrap_repeat,
    uniform float2     crop_u = float2(0.0, 1.0),
    uniform float2     crop_v = float2(0.0, 1.0),
    uniform float2     crop_w = float2(0.0, 1.0)) uniform [[ intrinsic() ]];

export float lookup_float(
    uniform texture_cube tex,
    float3 coord) uniform [[ intrinsic() ]];
*/

/*export float2 lookup_float2(
    uniform texture_2d tex,
    float2             coord [[ derivable() ]],
    uniform wrap_mode  wrap_u = wrap_repeat,
    uniform wrap_mode  wrap_v = wrap_repeat,
    uniform float2     crop_u = float2(0.0, 1.0),
    uniform float2     crop_v = float2(0.0, 1.0)) uniform [[ intrinsic() ]];

export float2 lookup_float2(
    uniform texture_3d tex,
    float3             coord,
    uniform wrap_mode  wrap_u = wrap_repeat,
    uniform wrap_mode  wrap_v = wrap_repeat,
    uniform wrap_mode  wrap_w = wrap_repeat,
    uniform float2     crop_u = float2(0.0, 1.0),
    uniform float2     crop_v = float2(0.0, 1.0),
    uniform float2     crop_w = float2(0.0, 1.0)) uniform [[ intrinsic() ]];

export float2 lookup_float2(
    uniform texture_cube tex,
    float3 coord) uniform [[ intrinsic() ]];

*/
export float3 lookup_float3( uniform texture_2d tex = texture_2d(), float2 coord = float2(0.),
    uniform wrap_mode  wrap_u = wrap_repeat, uniform wrap_mode  wrap_v = wrap_repeat,
    uniform float2     crop_u = float2(0.0, 1.0), uniform float2 crop_v = float2(0.0, 1.0), float frame = 0.0) uniform
[[
    anno::display_name("Texture lookup float3"),
    anno::description("Returns a value from a bitmap texture"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Texturing, basic"),
    anno::ui_order(110)
]]{ return tex::lookup_float3( tex, coord, wrap_u, wrap_v, crop_u, crop_v, frame); }

/*export float3 lookup_float3(
    uniform texture_3d tex,
    float3             coord,
    uniform wrap_mode  wrap_u = wrap_repeat,
    uniform wrap_mode  wrap_v = wrap_repeat,
    uniform wrap_mode  wrap_w = wrap_repeat,
    uniform float2     crop_u = float2(0.0, 1.0),
    uniform float2     crop_v = float2(0.0, 1.0),
    uniform float2     crop_w = float2(0.0, 1.0)) uniform [[ intrinsic() ]];

export float3 lookup_float3(
    uniform texture_cube tex,
    float3 coord) uniform [[ intrinsic() ]];
*/

export float4 lookup_float4( uniform texture_2d tex = texture_2d(), float2 coord = float2(0.),
    uniform wrap_mode  wrap_u = wrap_repeat, uniform wrap_mode  wrap_v = wrap_repeat,
    uniform float2     crop_u = float2(0.0, 1.0), uniform float2 crop_v = float2(0.0, 1.0), float frame = 0.0) uniform
[[
    anno::display_name("Texture lookup float4"),
    anno::description("Returns a value from a bitmap texture"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Texturing, basic"),
    anno::ui_order(120)
]]  { return tex::lookup_float4( tex, coord, wrap_u, wrap_v, crop_u, crop_v, frame); }

/*export float4 lookup_float4(
    uniform texture_3d tex,
    float3             coord,
    uniform wrap_mode  wrap_u = wrap_repeat,
    uniform wrap_mode  wrap_v = wrap_repeat,
    uniform wrap_mode  wrap_w = wrap_repeat,
    uniform float2     crop_u = float2(0.0, 1.0),
    uniform float2     crop_v = float2(0.0, 1.0),
    uniform float2     crop_w = float2(0.0, 1.0)) uniform [[ intrinsic() ]];

export float4 lookup_float4(
    uniform texture_cube tex,
    float3 coord) uniform [[ intrinsic() ]];
*/

export color lookup_color( uniform texture_2d tex = texture_2d(), float2 coord = float2(0.),
    uniform wrap_mode  wrap_u = wrap_repeat, uniform wrap_mode  wrap_v = wrap_repeat,
    uniform float2     crop_u = float2(0.0, 1.0), uniform float2 crop_v = float2(0.0, 1.0), float frame = 0.0) uniform
[[
    anno::display_name("Texture lookup color"),
    anno::description("Returns a value from a bitmap texture"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Texturing, basic"),
    anno::ui_order(130)
]]  { return tex::lookup_color( tex, coord, wrap_u, wrap_v, crop_u, crop_v, frame); }

/*export color lookup_color(
    uniform texture_3d tex,
    float3             coord,
    uniform wrap_mode  wrap_u = wrap_repeat,
    uniform wrap_mode  wrap_v = wrap_repeat,
    uniform wrap_mode  wrap_w = wrap_repeat,
    uniform float2     crop_u = float2(0.0, 1.0),
    uniform float2     crop_v = float2(0.0, 1.0),
    uniform float2     crop_w = float2(0.0, 1.0)) uniform [[ intrinsic() ]];

export color lookup_color(
    uniform texture_cube tex,
    float3 coord) uniform [[ intrinsic() ]];
*/

// texel functions

/*export float  texel_float(
    uniform texture_2d tex,
    int2 coord,
    int2 uv_tile = int2(0, 0)) uniform [[ intrinsic(), since(1,4) ]];
*/
/*
export float2 texel_float2(
    uniform texture_2d tex,
    int2 coord,
    int2 uv_tile = int2(0, 0)) uniform [[ intrinsic(), since(1,4) ]];


export float3 texel_float3(
    uniform texture_2d tex,
    int2 coord,
    int2 uv_tile = int2(0, 0)) uniform [[ intrinsic(), since(1,4) ]];


export float4 texel_float4(
    uniform texture_2d tex,
    int2 coord,
    int2 uv_tile = int2(0, 0)) uniform [[ intrinsic(), since(1,4) ]];


export color  texel_color(
    uniform texture_2d tex,
    int2 coord,
    int2 uv_tile = int2(0, 0)) uniform [[ intrinsic(), since(1,4) ]];

export float  texel_float(uniform texture_3d tex, int3 coord) uniform [[ intrinsic(), since(1,3) ]];
export float2 texel_float2(uniform texture_3d tex, int3 coord) uniform [[ intrinsic(), since(1,3) ]];
export float3 texel_float3(uniform texture_3d tex, int3 coord) uniform [[ intrinsic(), since(1,3) ]];
export float4 texel_float4(uniform texture_3d tex, int3 coord) uniform [[ intrinsic(), since(1,3) ]];
export color  texel_color(uniform texture_3d tex, int3 coord) uniform [[ intrinsic(), since(1,3) ]];
*/
// check for valid resource
export bool texture_isvalid(uniform texture_2d tex = texture_2d()) uniform
[[
    anno::display_name("Is texture valid?"),
    anno::description("Check if a valid texture is provided"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Texturing, basic"),
    anno::ui_order(140)
]]{ return tex::texture_isvalid(tex); }
//export bool texture_isvalid(uniform texture_3d   tex) uniform [[ intrinsic(), since(1,2) ]];
//export bool texture_isvalid(uniform texture_cube tex) uniform [[ intrinsic(), since(1,2) ]];

//exports from state:
export float3 position()
[[
    anno::display_name("Hit position"),
    anno::description("Position in the scene in internal, renderer specific space."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars"),
    anno::ui_order(1012)
]]{return state::position();}
export float3 normal()
[[
    anno::display_name("Shade normal"),
    anno::description("Shade normal in internal, renderer specific space."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars"),
    anno::ui_order(1013)
]]{return state::normal();}
//export float3 motion(){return state::motion();}

//new: quick access to xy:
export float2 texture_coordinate_2d(uniform int i = 0)
[[
    anno::display_name("Texture coordinate 2D"),
    anno::description("Access to authored texture spaces"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars"),
    anno::ui_order(1010)
]]{return xy(state::texture_coordinate(i)); }
export float3 texture_coordinate_3d(uniform int i = 0)
[[
    anno::display_name("Texture coordinate 3D"),
    anno::description("Access to authored texture spaces"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars"),
    anno::ui_order(1011)
]]{return state::texture_coordinate(i);}
export float3 texture_tangent_u(uniform int i = 0)
[[
    anno::display_name("Shade tangent"),
    anno::description("Shade tangent in internal, renderer specific space."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars"),
    anno::ui_order(1014)
]]{return state::texture_tangent_u(i);}
export float3 texture_tangent_v(uniform int i = 0)
[[
    anno::display_name("Shade bi-tangent"),
    anno::description("Shade bi-tangent in internal, renderer specific space."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars"),
    anno::ui_order(1015)
]]{return state::texture_tangent_v(i);}
export float animation_time()
[[
    anno::display_name("Animation time"),
    anno::description("Animation time in seconds from the start of the animation."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Application"),
    anno::ui_order(1030)
]]{return state::animation_time();}


export float3 transform_point(
    uniform coordinate_space from=coordinate_internal,
    uniform coordinate_space to=coordinate_object,
    float3 point=float3(0.))
[[
    anno::display_name("Transform point"),
    anno::description("Transform between internal, object and world space."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars"),
    anno::ui_order(1020)
]]{return state::transform_point(from, to, point);}
export float3 transform_vector(
    uniform coordinate_space from=coordinate_internal,
    uniform coordinate_space to=coordinate_object,
    float3 vector=float3(0.))
[[
    anno::display_name("Transform vector"),
    anno::description("Transform between internal, object and world space."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars"),
    anno::ui_order(1021)
]]{return state::transform_vector(from, to, vector);}
export float3 transform_normal(
    uniform coordinate_space from=coordinate_internal,
    uniform coordinate_space to=coordinate_object,
    float3 normal=float3(0.,1.,0.))
[[
    anno::display_name("Transform normal"),
    anno::description("Transform between internal, object and world space."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars"),
    anno::ui_order(1022)
]]{return state::transform_normal(from, to, normal);}
export float transform_scale(
    uniform coordinate_space from=coordinate_internal,
    uniform coordinate_space to=coordinate_object,
    float scale=0.)
[[
    anno::display_name("Transform scale"),
    anno::description("Transform between internal, object and world space."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars"),
    anno::ui_order(1023)
]]{return state::transform_scale(from, to, scale);}

float2 r2d(float2 x, float theta)
{
    theta *= math::acos(-1.0) * 2.0;
    return float2(
        math::cos(theta) * x[0] + math::sin(theta) * x[1], 
        math::cos(theta) * x[1] - math::sin(theta) * x[0]);
}
export float3 rotate_around_x(float3 p, float theta)
[[
    anno::display_name("Rotate Around X"),
    anno::description("Rotate a point around X axis"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(1024)
]]
{
    float2 v = r2d(float2(p.y, p.z), theta);
    return float3(p.x, v[0], v[1]);
}
export float3 rotate_around_y(float3 p, float theta)
[[
    anno::display_name("Rotate Around Y"),
    anno::description("Rotate a point around Y axis"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(1025)
]]
{
    float2 v = r2d(float2(p.x, p.z), theta);
    return float3(v[0], p.y, v[1]);
}
export float3 rotate_around_z(float3 p, float theta)
[[
    anno::display_name("Rotate Around Z"),
    anno::description("Rotate a point around Z axis"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(1026)
]]
{
    float2 v = r2d(float2(p.x, p.y), theta);
    return float3(v[0], v[1], p.z);
}

export float meters_per_scene_unit()
[[
    anno::display_name("Meters per scene unit"),
    anno::description("Get the actual units the scene is modelled in."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars"),
    anno::ui_order(1031)
]]{return state::meters_per_scene_unit();}
export float scene_units_per_meter()
[[
    anno::display_name("Scene units per meter"),
    anno::description("Get the actual units the scene is modelled in."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars"),
    anno::ui_order(1032)
]]{return state::scene_units_per_meter();}
export int object_id()
[[
    anno::display_name("Object Id"),
    anno::description("Get the unique id of the current object."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("State and Primvars"),
    anno::ui_order(1033)
]]{return state::object_id();}

//exported from math:
export color blackbody(float temperature=6500.)
[[
    anno::display_name("Blackbody color"),
    anno::description("Returns the color for a blackbody radiator at the given temperaturein Kelvin."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(409)
]]{return math::blackbody(temperature);}

export float PI()
[[
    anno::display_name("Pi"),
    anno::description("3.1415926, https://www.youtube.com/watch?v=kZSHr5E7fZY"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(1007)
]]{return math::PI;}
export int abs(int a=0)
[[
    anno::display_name("Abs"),
    anno::description("Returns the absolute value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(350)
]]{return math::abs(a);}
export float abs(float a=0.)
[[
    anno::display_name("Abs"),
    anno::description("Returns the absolute value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(351)
]]{return math::abs(a);}
export float2 abs(float2 a=float2(0.))
[[
    anno::display_name("Abs"),
    anno::description("Returns the absolute value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(352)
]]{return math::abs(a);}
export float3 abs(float3 a=float3(0.))
[[
    anno::display_name("Abs"),
    anno::description("Returns the absolute value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(353)
]]{return math::abs(a);}
export float4 abs(float4 a=float4(0.))
[[
    anno::display_name("Abs"),
    anno::description("Returns the absolute value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(354)
]]{return math::abs(a);}
export color abs(color a=color(0.))
[[
    anno::display_name("Abs"),
    anno::description("Returns the absolute value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(355)
]]{return math::abs(a);}

export float acos(float a=0.)
[[
    anno::display_name("Acos"),
    anno::description("Returns the arc cosine."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(360)
]]{return math::acos(a);}
export float2 acos(float2 a=float2(0.))
[[
    anno::display_name("Acos"),
    anno::description("Returns the arc cosine."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(361)
]]{return math::acos(a);}
export float3 acos(float3 a=float3(0.))
[[
    anno::display_name("Acos"),
    anno::description("Returns the arc cosine."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(362)
]]{return math::acos(a);}
export float4 acos(float4 a=float4(0.))
[[
    anno::display_name("Acos"),
    anno::description("Returns the arc cosine."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(363)
]]{return math::acos(a);}


export float asin(float a=0.)
[[
    anno::display_name("Asin"),
    anno::description("Returns the arc sine."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(370)
]]{return math::asin(a);}
export float2 asin(float2 a=float2(0.))
[[
    anno::display_name("Asin"),
    anno::description("Returns the arc sine."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(371)
]]{return math::asin(a);}
export float3 asin(float3 a=float3(0.))
[[
    anno::display_name("Asin"),
    anno::description("Returns the arc sine."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(372)
]]{return math::asin(a);}
export float4 asin(float4 a=float4(0.))
[[
    anno::display_name("Asin"),
    anno::description("Returns the arc sine."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(373)
]]{return math::asin(a);}

export float atan(float a=0.)
[[
    anno::display_name("Atan"),
    anno::description("Returns the arc tangent."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(380)
]]{return math::atan(a);}
export float2 atan(float2 a=float2(0.))
[[
    anno::display_name("Atan"),
    anno::description("Returns the arc tangent."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(381)
]]{return math::atan(a);}
export float3 atan(float3 a=float3(0.))
[[
    anno::display_name("Atan"),
    anno::description("Returns the arc tangent."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(382)
]]{return math::atan(a);}
export float4 atan(float4 a=float4(0.))
[[
    anno::display_name("Atan"),
    anno::description("Returns the arc tangent."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(383)
]]{return math::atan(a);}

export float atan2(float y=0., float x=0.)
[[
    anno::display_name("Atan2"),
    anno::description("Returns the arc tangent ofy/x. The signs of y and x are used to determine the quadrant of the result."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(390)
]]{return math::atan2(y,x);}
export float2 atan2(float2 y=float2(0.), float2 x=float2(0.))
[[
    anno::display_name("Atan2"),
    anno::description("Returns the arc tangent ofy/x. The signs of y and x are used to determine the quadrant of the result."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(391)
]]{return math::atan2(y,x);}
export float3 atan2(float3 y=float3(0.), float3 x=float3(0.))
[[
    anno::display_name("Atan2"),
    anno::description("Returns the arc tangent ofy/x. The signs of y and x are used to determine the quadrant of the result."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(392)
]]{return math::atan2(y,x);}
export float4 atan2(float4 y=float4(0.), float4 x=float4(0.))
[[
    anno::display_name("Atan2"),
    anno::description("Returns the arc tangent ofy/x. The signs of y and x are used to determine the quadrant of the result."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(393)
]]{return math::atan2(y,x);}

//export float average(float a=0.){return math::average(a);}
export float average(float2 a=float2(0.))
[[
    anno::display_name("Average"),
    anno::description("Returns the average value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(400)
]]{return math::average(a);}
export float average(float3 a=float3(0.))
[[
    anno::display_name("Average"),
    anno::description("Returns the average value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(401)
]]{return math::average(a);}
export float average(float4 a=float4(0.))
[[
    anno::display_name("Average"),
    anno::description("Returns the average value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(402)
]]{return math::average(a);}
export float average(color a=color(0.))
[[
    anno::display_name("Average"),
    anno::description("Returns the average value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(403)
]]{return math::average(a);}

export float ceil(float a=0.)
[[
    anno::display_name("Ceil"),
    anno::description("Returns the nearest integer that is greater than or equal to the value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(410)
]]{return math::ceil(a);}
export float2 ceil(float2 a=float2(0.))
[[
    anno::display_name("Ceil"),
    anno::description("Returns the nearest integer that is greater than or equal to the value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(411)
]]{return math::ceil(a);}
export float3 ceil(float3 a=float3(0.))
[[
    anno::display_name("Ceil"),
    anno::description("Returns the nearest integer that is greater than or equal to the value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(411)
]]{return math::ceil(a);}
export float4 ceil(float4 a=float4(0.))
[[
    anno::display_name("Ceil"),
    anno::description("Returns the nearest integer that is greater than or equal to the value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(412)
]]{return math::ceil(a);}

export int clamp(int a=0, int min=0, int max=1)
[[
    anno::display_name("Clamp"),
    anno::description("Clamps a value to a given range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(420)
]]{return math::clamp(a,min,max);}
export float clamp(float a=0., float min=0., float max=0.)
[[
    anno::display_name("Clamp"),
    anno::description("Clamps a value to a given range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(421)
]]{return math::clamp(a,min,max);}
export float2 clamp(float2 a=float2(0.), float2 min=float2(0.), float2 max=float2(1.))
[[
    anno::display_name("Clamp"),
    anno::description("Clamps a value to a given range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(422)
]]{return math::clamp(a,min,max);}
export float3 clamp(float3 a=float3(0.), float3 min=float3(0.), float3 max=float3(1.))
[[
    anno::display_name("Clamp"),
    anno::description("Clamps a value to a given range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(423)
]]{return math::clamp(a,min,max);}
export float4 clamp(float4 a=float4(0.), float4 min=float4(0.), float4 max=float4(1.))
[[
    anno::display_name("Clamp"),
    anno::description("Clamps a value to a given range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(424)
]]{return math::clamp(a,min,max);}
export color clamp(color a=color(0.), color min=color(0.), color max=color(1.))
[[
    anno::display_name("Clamp"),
    anno::description("Clamps a value to a given range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(425)
]]{return math::clamp(a,min,max);}
export float2 clamp(float2 a=float2(0.), float2 min=float2(0.), float max=1.)
[[
    anno::display_name("Clamp"),
    anno::description("Clamps a value to a given range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(426)
]]{return math::clamp(a,min,max);}
export float2 clamp(float2 a=float2(0.), float min=0., float2 max=float2(1.))
[[
    anno::display_name("Clamp"),
    anno::description("Clamps a value to a given range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(427)
]]{return math::clamp(a,min,max);}
export float2 clamp(float2 a=float2(0.), float min=0., float max=1.)
[[
    anno::display_name("Clamp"),
    anno::description("Clamps a value to a given range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(428)
]]{return math::clamp(a,min,max);}
export float3 clamp(float3 a=float3(0.), float3 min=float3(0.), float max=0.)
[[
    anno::display_name("Clamp"),
    anno::description("Clamps a value to a given range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(429)
]]{return math::clamp(a,min,max);}
export float3 clamp(float3 a=float3(0.), float min=0., float3 max=float3(1.))
[[
    anno::display_name("Clamp"),
    anno::description("Clamps a value to a given range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(430)
]]{return math::clamp(a,min,max);}
export float3 clamp(float3 a=float3(0.), float min=0., float max=0.)
[[
    anno::display_name("Clamp"),
    anno::description("Clamps a value to a given range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(431)
]]{return math::clamp(a,min,max);}
export float4 clamp(float4 a=float4(0.), float4 min=float4(0.), float max=0.)
[[
    anno::display_name("Clamp"),
    anno::description("Clamps a value to a given range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(432)
]]{return math::clamp(a,min,max);}
export float4 clamp(float4 a=float4(0.), float min=0., float4 max=float4(1.))
[[
    anno::display_name("Clamp"),
    anno::description("Clamps a value to a given range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(433)
]]{return math::clamp(a,min,max);}
export float4 clamp(float4 a=float4(0.), float min=0., float max=0.)
[[
    anno::display_name("Clamp"),
    anno::description("Clamps a value to a given range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(434)
]]{return math::clamp(a,min,max);}
export color clamp(color a=color(0.), color min=color(0.), float max=0.)
[[
    anno::display_name("Clamp"),
    anno::description("Clamps a value to a given range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(435)
]]{return math::clamp(a,min,max);}
export color clamp(color a=color(0.), float min=0., color max=color(1.))
[[
    anno::display_name("Clamp"),
    anno::description("Clamps a value to a given range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(436)
]]{return math::clamp(a,min,max);}
export color clamp(color a=color(0.), float min=0., float max=0.)
[[
    anno::display_name("Clamp"),
    anno::description("Clamps a value to a given range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(437)
]]{return math::clamp(a,min,max);}

export float cos(float a=0.)
[[
    anno::display_name("Cos"),
    anno::description("Returns the cosine of a given value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(440)
]]{return math::cos(a);}
export float2 cos(float2 a=float2(0.))
[[
    anno::display_name("Cos"),
    anno::description("Returns the cosine of a given value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(441)
]]{return math::cos(a);}
export float3 cos(float3 a=float3(0.))
[[
    anno::display_name("Cos"),
    anno::description("Returns the cosine of a given value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(442)
]]{return math::cos(a);}
export float4 cos(float4 a=float4(0.))
[[
    anno::display_name("Cos"),
    anno::description("Returns the cosine of a given value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(443)
]]{return math::cos(a);}

export float3 cross(float3 a=float3(0.), float3 b=float3(0.))
[[
    anno::display_name("Cross"),
    anno::description("Returns the cross product of 2 vectors."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(449)
]]{return math::cross(a,b);}

export float degrees(float a=0.)
[[
    anno::display_name("Degrees"),
    anno::description("Converts an angular value from radians to degrees."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(450)
]]{return math::degrees(a);}
export float2 degrees(float2 a=float2(0.))
[[
    anno::display_name("Degrees"),
    anno::description("Converts an angular value from radians to degrees."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(451)
]]{return math::degrees(a);}
export float3 degrees(float3 a=float3(0.))
[[
    anno::display_name("Degrees"),
    anno::description("Converts an angular value from radians to degrees."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(452)
]]{return math::degrees(a);}
export float4 degrees(float4 a=float4(0.))
[[
    anno::display_name("Degrees"),
    anno::description("Converts an angular value from radians to degrees."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(453)
]]{return math::degrees(a);}

export float distance(float a=0., float b=0.)
[[
    anno::display_name("Distance"),
    anno::description("Returns the Euclidean distance between 2 points."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(460)
]]{return math::distance(a,b);}
export float distance(float2 a=float2(0.), float2 b=float2(0.))
[[
    anno::display_name("Distance"),
    anno::description("Returns the Euclidean distance between 2 points."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(461)
]]{return math::distance(a,b);}
export float distance(float3 a=float3(0.), float3 b=float3(0.))
[[
    anno::display_name("Distance"),
    anno::description("Returns the Euclidean distance between 2 points."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(462)
]]{return math::distance(a,b);}
export float distance(float4 a=float4(0.), float4 b=float4(0.))
[[
    anno::display_name("Distance"),
    anno::description("Returns the Euclidean distance between 2 points."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(463)
]]{return math::distance(a,b);}

//export float dot(float a=0., float b=0.){return math::dot(a,b);}
export float dot(float2 a=float2(0.), float2 b=float2(0.))
[[
    anno::display_name("Dot"),
    anno::description("Returns the dot product of 2 vectors."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(470)
]]{return math::dot(a,b);}
export float dot(float3 a=float3(0.), float3 b=float3(0.))
[[
    anno::display_name("Dot"),
    anno::description("Returns the dot product of 2 vectors."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(471)
]]{return math::dot(a,b);}
export float dot(float4 a=float4(0.), float4 b=float4(0.))
[[
    anno::display_name("Dot"),
    anno::description("Returns the dot product of 2 vectors."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(472)
]]{return math::dot(a,b);}

export float exp(float a=0.)
[[
    anno::display_name("Exp"),
    anno::description("Returns the constant 'e' raised to the power a."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(480)
]]{return math::exp(a);}
export float2 exp(float2 a=float2(0.))
[[
    anno::display_name("Exp"),
    anno::description("Returns the constant 'e' raised to the power a."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(481)
]]{return math::exp(a);}
export float3 exp(float3 a=float3(0.))
[[
    anno::display_name("Exp"),
    anno::description("Returns the constant 'e' raised to the power a."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(481)
]]{return math::exp(a);}
export float4 exp(float4 a=float4(0.))
[[
    anno::display_name("Exp"),
    anno::description("Returns the constant 'e' raised to the power a."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(482)
]]{return math::exp(a);}
export color exp(color a=color(0.))
[[
    anno::display_name("Exp"),
    anno::description("Returns the constant 'e' raised to the power a."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(483)
]]{return math::exp(a);}

export float exp2(float a=0.)
[[
    anno::display_name("Exp 2"),
    anno::description("Returns the value 2.0 raised to the power a."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(490)
]]{return math::exp2(a);}
export float2 exp2(float2 a=float2(0.))
[[
    anno::display_name("Exp 2"),
    anno::description("Returns the value 2.0 raised to the power a."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(491)
]]{return math::exp2(a);}
export float3 exp2(float3 a=float3(0.))
[[
    anno::display_name("Exp 2"),
    anno::description("Returns the value 2.0 raised to the power a."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(492)
]]{return math::exp2(a);}
export float4 exp2(float4 a=float4(0.))
[[
    anno::display_name("Exp 2"),
    anno::description("Returns the value 2.0 raised to the power a."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(493)
]]{return math::exp2(a);}
export color exp2(color a=color(0.))
[[
    anno::display_name("Exp 2"),
    anno::description("Returns the value 2.0 raised to the power a."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(494)
]]{return math::exp2(a);}

export float floor(float a=0.)
[[
    anno::display_name("Floor"),
    anno::description("Returns the nearest integer that is less than or equal to the value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(500)
]]{return math::floor(a);}
export float2 floor(float2 a=float2(0.))
[[
    anno::display_name("Floor"),
    anno::description("Returns the nearest integer that is less than or equal to the value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(501)
]]{return math::floor(a);}
export float3 floor(float3 a=float3(0.))
[[
    anno::display_name("Floor"),
    anno::description("Returns the nearest integer that is less than or equal to the value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(502)
]]{return math::floor(a);}
export float4 floor(float4 a=float4(0.))
[[
    anno::display_name("Floor"),
    anno::description("Returns the nearest integer that is less than or equal to the value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(503)
]]{return math::floor(a);}

export float fmod(float a=0., float b=1.)
[[
    anno::display_name("Fmod"),
    anno::description("Returns the remainder of a/b."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(510)
]]{return math::fmod(a,b);}
export float2 fmod(float2 a=float2(0.), float2 b=float2(1.))
[[
    anno::display_name("Fmod"),
    anno::description("Returns the remainder of a/b."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(511)
]]{return math::fmod(a,b);}
export float3 fmod(float3 a=float3(0.), float3 b=float3(1.))
[[
    anno::display_name("Fmod"),
    anno::description("Returns the remainder of a/b."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(512)
]]{return math::fmod(a,b);}
export float4 fmod(float4 a=float4(0.), float4 b=float4(1.))
[[
    anno::display_name("Fmod"),
    anno::description("Returns the remainder of a/b."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(513)
]]{return math::fmod(a,b);}
export float2 fmod(float2 a=float2(0.), float b=1.)
[[
    anno::display_name("Fmod"),
    anno::description("Returns the remainder of a/b."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(514)
]]{return math::fmod(a,b);}
export float3 fmod(float3 a=float3(0.), float b=1.)
[[
    anno::display_name("Fmod"),
    anno::description("Returns the remainder of a/b."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(515)
]]{return math::fmod(a,b);}
export float4 fmod(float4 a=float4(0.), float b=1.)
[[
    anno::display_name("Fmod"),
    anno::description("Returns the remainder of a/b."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(516)
]]{return math::fmod(a,b);}

export float frac(float a=0.)
[[
    anno::display_name("Frac"),
    anno::description("Returns the positive fractional part."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(520)
]]{return math::frac(a);}
export float2 frac(float2 a=float2(0.))
[[
    anno::display_name("Frac"),
    anno::description("Returns the positive fractional part."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(521)
]]{return math::frac(a);}
export float3 frac(float3 a=float3(0.))
[[
    anno::display_name("Frac"),
    anno::description("Returns the positive fractional part."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(522)
]]{return math::frac(a);}
export float4 frac(float4 a=float4(0.))
[[
    anno::display_name("Frac"),
    anno::description("Returns the positive fractional part."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(523)
]]{return math::frac(a);}

//export float length(float a=0.){return math::length(a);}
export float length(float2 a=float2(0.))
[[
    anno::display_name("Length"),
    anno::description("Returns the length of a vector."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(530)
]]{return math::length(a);}
export float length(float3 a=float3(0.))
[[
    anno::display_name("Length"),
    anno::description("Returns the length of a vector."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(531)
]]{return math::length(a);}
export float length(float4 a=float4(0.))
[[
    anno::display_name("Length"),
    anno::description("Returns the length of a vector."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(532)
]]{return math::length(a);}

export float lerp(float a=0., float b=1., float l=0.[[anno::soft_range(0.0,1.)]])
[[
    anno::display_name("Lerp"),
    anno::description("Linear interpolation between 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(540)
]]{return math::lerp(a,b,l);}
export float2 lerp(float2 a=float2(0.), float2 b=float2(1.), float2 l=float2(0.)[[anno::soft_range(float2(0.0),float2(1.))]])
[[
    anno::display_name("Lerp"),
    anno::description("Linear interpolation between 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(541)
]]{return math::lerp(a,b,l);}
export float3 lerp(float3 a=float3(0.), float3 b=float3(1.), float3 l=float3(0.)[[anno::soft_range(float3(0.0),float3(1.))]])
[[
    anno::display_name("Lerp"),
    anno::description("Linear interpolation between 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(542)
]]{return math::lerp(a,b,l);}
export float4 lerp(float4 a=float4(0.), float4 b=float4(1.), float4 l=float4(0.)[[anno::soft_range(float4(0.0),float4(1.))]])
[[
    anno::display_name("Lerp"),
    anno::description("Linear interpolation between 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(543)
]]{return math::lerp(a,b,l);}
export float2 lerp(float2 a=float2(0.), float2 b=float2(1.), float l=0.[[anno::soft_range(0.0,1.)]])
[[
    anno::display_name("Lerp"),
    anno::description("Linear interpolation between 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(544)
]]{return math::lerp(a,b,l);}
export float3 lerp(float3 a=float3(0.), float3 b=float3(1.), float l=0.[[anno::soft_range(0.0,1.)]])
[[
    anno::display_name("Lerp"),
    anno::description("Linear interpolation between 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(545)
]]{return math::lerp(a,b,l);}
export float4 lerp(float4 a=float4(0.), float4 b=float4(1.), float l=0.[[anno::soft_range(0.0,1.)]])
[[
    anno::display_name("Lerp"),
    anno::description("Linear interpolation between 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(546)
]]{return math::lerp(a,b,l);}
export color lerp(color a=color(0.), color b=color(1.), color l=color(0.)[[anno::soft_range(color(0.0),color(1.))]])
[[
    anno::display_name("Lerp"),
    anno::description("Linear interpolation between 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(547)
]]{return math::lerp(a,b,l);}
export color lerp(color a=color(0.), color b=color(1.), float l=0.[[anno::soft_range(0.0,1.)]])
[[
    anno::display_name("Lerp"),
    anno::description("Linear interpolation between 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(548)
]]{return math::lerp(a,b,l);}

export float log(float a=1.)
[[
    anno::display_name("Log"),
    anno::description("Computes the natural logarithm."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(550)
]]{return math::log(a);}
export float2 log(float2 a=float2(1.))
[[
    anno::display_name("Log"),
    anno::description("Computes the natural logarithm."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(551)
]]{return math::log(a);}
export float3 log(float3 a=float3(1.))
[[
    anno::display_name("Log"),
    anno::description("Computes the natural logarithm."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(552)
]]{return math::log(a);}
export float4 log(float4 a=float4(1.))
[[
    anno::display_name("Log"),
    anno::description("Computes the natural logarithm."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(553)
]]{return math::log(a);}
export color log(color a=color(1.))
[[
    anno::display_name("Log"),
    anno::description("Computes the natural logarithm."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(554)
]]{return math::log(a);}

export float log2(float a=1.)
[[
    anno::display_name("Log 2"),
    anno::description("Computes the base 2 logarithm."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(560)
]]{return math::log2(a);}
export float2 log2(float2 a=float2(1.))
[[
    anno::display_name("Log 2"),
    anno::description("Computes the base 2 logarithm."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(561)
]]{return math::log2(a);}
export float3 log2(float3 a=float3(1.))
[[
    anno::display_name("Log 2"),
    anno::description("Computes the base 2 logarithm."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(562)
]]{return math::log2(a);}
export float4 log2(float4 a=float4(1.))
[[
    anno::display_name("Log 2"),
    anno::description("Computes the base 2 logarithm."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(563)
]]{return math::log2(a);}
export color log2(color a=color(1.))
[[
    anno::display_name("Log 2"),
    anno::description("Computes the base 2 logarithm."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(564)
]]{return math::log2(a);}

export float log10(float a=1.)
[[
    anno::display_name("Log 10"),
    anno::description("Computes the base 10 logarithm."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(570)
]]{return math::log10(a);}
export float2 log10(float2 a=float2(1.))
[[
    anno::display_name("Log 10"),
    anno::description("Computes the base 10 logarithm."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(571)
]]{return math::log10(a);}
export float3 log10(float3 a=float3(1.))
[[
    anno::display_name("Log 10"),
    anno::description("Computes the base 10 logarithm."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(572)
]]{return math::log10(a);}
export float4 log10(float4 a=float4(1.))
[[
    anno::display_name("Log 10"),
    anno::description("Computes the base 10 logarithm."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(573)
]]{return math::log10(a);}
export color log10(color a=color(1.))
[[
    anno::display_name("Log 10"),
    anno::description("Computes the base 10 logarithm."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(574)
]]{return math::log10(a);}

export float luminance(float3 a=float3(0.))
[[
    anno::display_name("Luminance"),
    anno::description("Computes the Y channel of a color."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(580)
]]{return math::luminance(a);}
export float luminance(color a=color(0.))
[[
    anno::display_name("Luminance"),
    anno::description("Computes the Y channel of a color."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(581)
]]{return math::luminance(a);}
export float luminance(float4 a=float4(0.))
[[
    anno::display_name("Luminance"),
    anno::description("Computes the Y channel of a color."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(582)
]]{return math::luminance(float3(a.x,a.y,a.z));}

export int max(int a=0, int b=0)
[[
    anno::display_name("Maximum"),
    anno::description("Returns maximum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(590)
]]{return math::max(a,b);}
export float max(float a=0., float b=0.)
[[
    anno::display_name("Maximum"),
    anno::description("Returns maximum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(591)
]]{return math::max(a,b);}
export float2 max(float2 a=float2(0.), float2 b=float2(0.))
[[
    anno::display_name("Maximum"),
    anno::description("Returns maximum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(592)
]]{return math::max(a,b);}
export float3 max(float3 a=float3(0.), float3 b=float3(0.))
[[
    anno::display_name("Maximum"),
    anno::description("Returns maximum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(593)
]]{return math::max(a,b);}
export float4 max(float4 a=float4(0.), float4 b=float4(0.))
[[
    anno::display_name("Maximum"),
    anno::description("Returns maximum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(594)
]]{return math::max(a,b);}
export float2 max(float2 a=float2(0.), float b=0.)
[[
    anno::display_name("Maximum"),
    anno::description("Returns maximum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(595)
]]{return math::max(a,b);}
export float3 max(float3 a=float3(0.), float b=0.)
[[
    anno::display_name("Maximum"),
    anno::description("Returns maximum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(596)
]]{return math::max(a,b);}
export float4 max(float4 a=float4(0.), float b=0.)
[[
    anno::display_name("Maximum"),
    anno::description("Returns maximum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(597)
]]{return math::max(a,b);}
export float2 max(float a=0., float2 b=float2(0.))
[[
    anno::display_name("Maximum"),
    anno::description("Returns maximum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(598)
]]{return math::max(a,b);}
export float3 max(float a=0., float3 b=float3(0.))
[[
    anno::display_name("Maximum"),
    anno::description("Returns maximum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(599)
]]{return math::max(a,b);}
export float4 max(float a=0., float4 b=float4(0.))
[[
    anno::display_name("Maximum"),
    anno::description("Returns maximum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(600)
]]{return math::max(a,b);}
export color max(color a=color(0.), color b=color(0.))
[[
    anno::display_name("Maximum"),
    anno::description("Returns maximum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(601)
]]{return math::max(a,b);}
export color max(float a=0., color b=0.)
[[
    anno::display_name("Maximum"),
    anno::description("Returns maximum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(602)
]]{return math::max(a,b);}
export color max(color a=color(0.), float b=0.)
[[
    anno::display_name("Maximum"),
    anno::description("Returns maximum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(603)
]]{return math::max(a,b);}

//export float max_value(float a=0.){return math::max_value(a);}
export float max_value(float2 a=float2(0.))
[[
    anno::display_name("Maximum value"),
    anno::description("Returns the maximum value of a vector."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(610)
]]{return math::max_value(a);}
export float max_value(float3 a=float3(0.))
[[
    anno::display_name("Maximum value"),
    anno::description("Returns the maximum value of a vector."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(611)
]]{return math::max_value(a);}
export float max_value(float4 a=float4(0.))
[[
    anno::display_name("Maximum value"),
    anno::description("Returns the maximum value of a vector."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(612)
]]{return math::max_value(a);}
export float max_value(color a=color(0.))
[[
    anno::display_name("Maximum value"),
    anno::description("Returns the maximum value of a color."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(613)
]]{return math::max_value(a);}

export int min(int a=0, int b=0)
[[
    anno::display_name("Minimum"),
    anno::description("Returns minimum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(620)
]]{return math::min(a,b);}
export float min(float a=0., float b=0.)
[[
    anno::display_name("Minimum"),
    anno::description("Returns minimum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(621)
]]{return math::min(a,b);}
export float2 min(float2 a=float2(0.), float2 b=float2(0.))
[[
    anno::display_name("Minimum"),
    anno::description("Returns minimum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(622)
]]{return math::min(a,b);}
export float3 min(float3 a=float3(0.), float3 b=float3(0.))
[[
    anno::display_name("Minimum"),
    anno::description("Returns minimum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(623)
]]{return math::min(a,b);}
export float4 min(float4 a=float4(0.), float4 b=float4(0.))
[[
    anno::display_name("Minimum"),
    anno::description("Returns minimum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(624)
]]{return math::min(a,b);}
export float2 min(float2 a=float2(0.), float b=0.)
[[
    anno::display_name("Minimum"),
    anno::description("Returns minimum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(625)
]]{return math::min(a,b);}
export float3 min(float3 a=float3(0.), float b=0.)
[[
    anno::display_name("Minimum"),
    anno::description("Returns minimum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(626)
]]{return math::min(a,b);}
export float4 min(float4 a=float4(0.), float b=0.)
[[
    anno::display_name("Minimum"),
    anno::description("Returns minimum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(627)
]]{return math::min(a,b);}
export float2 min(float a=0., float2 b=float2(0.))
[[
    anno::display_name("Minimum"),
    anno::description("Returns minimum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(628)
]]{return math::min(a,b);}
export float3 min(float a=0., float3 b=float3(0.))
[[
    anno::display_name("Minimum"),
    anno::description("Returns minimum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(629)
]]{return math::min(a,b);}
export float4 min(float a=0., float4 b=float4(0.))
[[
    anno::display_name("Minimum"),
    anno::description("Returns minimum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(630)
]]{return math::min(a,b);}
export color min(color a=color(0.), color b=color(0.))
[[
    anno::display_name("Minimum"),
    anno::description("Returns minimum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(631)
]]{return math::min(a,b);}
export color min(float a=0., color b=color(0.))
[[
    anno::display_name("Minimum"),
    anno::description("Returns minimum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(632)
]]{return math::min(a,b);}
export color min(color a=color(0.), float b=0.)
[[
    anno::display_name("Minimum"),
    anno::description("Returns minimum of 2 values."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(633)
]]{return math::min(a,b);}

export float min_value(float a=0.)
[[
    anno::display_name("Minimum value"),
    anno::description("Returns the minimum value of a vector."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(640)
]]{return math::min_value(a);}
export float min_value(float2 a=float2(0.))
[[
    anno::display_name("Minimum value"),
    anno::description("Returns the minimum value of a vector."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(641)
]]{return math::min_value(a);}
export float min_value(float3 a=float3(0.))
[[
    anno::display_name("Minimum value"),
    anno::description("Returns the minimum value of a vector."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(642)
]]{return math::min_value(a);}
export float min_value(float4 a=float4(0.))
[[
    anno::display_name("Minimum value"),
    anno::description("Returns the minimum value of a vector."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(643)
]]{return math::min_value(a);}
export float min_value(color a=color(0.))
[[
    anno::display_name("Minimum value"),
    anno::description("Returns the minimum value of a color."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(644)
]]{return math::min_value(a);}

//export float normalize(float a=0.){return math::normalize(a);}
export float2 normalize(float2 a=float2(0.))
[[
    anno::display_name("Normalize"),
    anno::description("Scales a by the reciprocal of its length to give it a length of 1."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(650)
]]{return math::normalize(a);}
export float3 normalize(float3 a=float3(0.))
[[
    anno::display_name("Normalize"),
    anno::description("Scales a by the reciprocal of its length to give it a length of 1."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(651)
]]{return math::normalize(a);}
export float4 normalize(float4 a=float4(0.))
[[
    anno::display_name("Normalize"),
    anno::description("Scales a by the reciprocal of its length to give it a length of 1."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(652)
]]{return math::normalize(a);}

export int pow(int a=0, int b=0)
[[
    anno::display_name("Pow"),
    anno::description("Returns a raised to the power of b."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(660)
]]{return math::pow(a,b);}
export float pow(float a=0., float b=0.)
[[
    anno::display_name("Pow"),
    anno::description("Returns a raised to the power of b. Parameter a must not be negative."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(661)
]]{return math::pow(a,b);}
export float2 pow(float2 a=float2(0.), float2 b=float2(0.))
[[
    anno::display_name("Pow"),
    anno::description("Returns a raised to the power of b. Parameter a must not be negative."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(662)
]]{return math::pow(a,b);}
export float3 pow(float3 a=float3(0.), float3 b=float3(0.))
[[
    anno::display_name("Pow"),
    anno::description("Returns a raised to the power of b. Parameter a must not be negative."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(663)
]]{return math::pow(a,b);}
export float4 pow(float4 a=float4(0.), float4 b=float4(0.))
[[
    anno::display_name("Pow"),
    anno::description("Returns a raised to the power of b. Parameter a must not be negative."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(664)
]]{return math::pow(a,b);}
export float2 pow(float2 a=float2(0.), float b=0.)
[[
    anno::display_name("Pow"),
    anno::description("Returns a raised to the power of b. Parameter a must not be negative."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(665)
]]{return math::pow(a,b);}
export float3 pow(float3 a=float3(0.), float b=0.)
[[
    anno::display_name("Pow"),
    anno::description("Returns a raised to the power of b. Parameter a must not be negative."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(666)
]]{return math::pow(a,b);}
export float4 pow(float4 a=float4(0.), float b=0.)
[[
    anno::display_name("Pow"),
    anno::description("Returns a raised to the power of b. Parameter a must not be negative."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(667)
]]{return math::pow(a,b);}
export color pow(color a=color(0.), color b=color(0.))
[[
    anno::display_name("Pow"),
    anno::description("Returns a raised to the power of b. Parameter a must not be negative."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(668)
]]{return math::pow(a,b);}
export color pow(color a=color(0.), float b=0.)
[[
    anno::display_name("Pow"),
    anno::description("Returns a raised to the power of b. Parameter a must not be negative."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(669)
]]{return math::pow(a,b);}

export float radians(float a=0.)
[[
    anno::display_name("Radians"),
    anno::description("Converts the value from degrees to radians."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(670)
]]{return math::radians(a);}
export float2 radians(float2 a=float2(0.))
[[
    anno::display_name("Radians"),
    anno::description("Converts the value from degrees to radians."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(671)
]]{return math::radians(a);}
export float3 radians(float3 a=float3(0.))
[[
    anno::display_name("Radians"),
    anno::description("Converts the value from degrees to radians."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(672)
]]{return math::radians(a);}
export float4 radians(float4 a=float4(0.))
[[
    anno::display_name("Radians"),
    anno::description("Converts the value from degrees to radians."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(673)
]]{return math::radians(a);}

export float round(float a=0.)
[[
    anno::display_name("Round"),
    anno::description("Returns the nearest integer value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(690)
]]{return math::round(a);}
export float2 round(float2 a=float2(0.))
[[
    anno::display_name("Round"),
    anno::description("Returns the nearest integer value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(691)
]]{return math::round(a);}
export float3 round(float3 a=float3(0.))
[[
    anno::display_name("Round"),
    anno::description("Returns the nearest integer value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(692)
]]{return math::round(a);}
export float4 round(float4 a=float4(0.))
[[
    anno::display_name("Round"),
    anno::description("Returns the nearest integer value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(693)
]]{return math::round(a);}

export float rsqrt(float a=0.)
[[
    anno::display_name("Rsqrt"),
    anno::description("Returns the reciprocal of the square root."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(700)
]]{return math::rsqrt(a);}
export float2 rsqrt(float2 a=float2(0.))
[[
    anno::display_name("Rsqrt"),
    anno::description("Returns the reciprocal of the square root."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(701)
]]{return math::rsqrt(a);}
export float3 rsqrt(float3 a=float3(0.))
[[
    anno::display_name("Rsqrt"),
    anno::description("Returns the reciprocal of the square root."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(702)
]]{return math::rsqrt(a);}
export float4 rsqrt(float4 a=float4(0.))
[[
    anno::display_name("Rsqrt"),
    anno::description("Returns the reciprocal of the square root."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(703)
]]{return math::rsqrt(a);}
export color rsqrt(color a=color(0.))
[[
    anno::display_name("Rsqrt"),
    anno::description("Returns the reciprocal of the square root."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(704)
]]{return math::rsqrt(a);}

export float saturate(float a=0.)
[[
    anno::display_name("Saturate"),
    anno::description("Clamps to the 0-1 range."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(710)
]]{return math::saturate(a);}
export float2 saturate(float2 a=float2(0.))
[[
    anno::display_name("Saturate"),
    anno::description("Clamps to the 0-1 range."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(711)
]]{return math::saturate(a);}
export float3 saturate(float3 a=float3(0.))
[[
    anno::display_name("Saturate"),
    anno::description("Clamps to the 0-1 range."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(712)
]]{return math::saturate(a);}
export float4 saturate(float4 a=float4(0.))
[[
    anno::display_name("Saturate"),
    anno::description("Clamps to the 0-1 range."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(713)
]]{return math::saturate(a);}
export color saturate(color a=color(0.))
[[
    anno::display_name("Saturate"),
    anno::description("Clamps to the 0-1 range."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(714)
]]{return math::saturate(a);}

export int sign(int a=0)
[[
    anno::display_name("Sign"),
    anno::description("Returns 1 if a is greater than 0, -1 if a is less than 0, and 0 otherwise."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(720)
]]{return math::sign(a);}
export float sign(float a=0.)
[[
    anno::display_name("Sign"),
    anno::description("Returns 1 if a is greater than 0, -1 if a is less than 0, and 0 otherwise."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(721)
]]{return math::sign(a);}
export float2 sign(float2 a=float2(0.))
[[
    anno::display_name("Sign"),
    anno::description("Returns 1 if a is greater than 0, -1 if a is less than 0, and 0 otherwise."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(722)
]]{return math::sign(a);}
export float3 sign(float3 a=float3(0.))
[[
    anno::display_name("Sign"),
    anno::description("Returns 1 if a is greater than 0, -1 if a is less than 0, and 0 otherwise."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(723)
]]{return math::sign(a);}
export float4 sign(float4 a=float4(0.))
[[
    anno::display_name("Sign"),
    anno::description("Returns 1 if a is greater than 0, -1 if a is less than 0, and 0 otherwise."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(724)
]]{return math::sign(a);}

export float sin(float a=0.)
[[
    anno::display_name("Sin"),
    anno::description("Returns the sine of a value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(730)
]]{return math::sin(a);}
export float2 sin(float2 a=float2(0.))
[[
    anno::display_name("Sin"),
    anno::description("Returns the sine of a value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(731)
]]{return math::sin(a);}
export float3 sin(float3 a=float3(0.))
[[
    anno::display_name("Sin"),
    anno::description("Returns the sine of a value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(732)
]]{return math::sin(a);}
export float4 sin(float4 a=float4(0.))
[[
    anno::display_name("Sin"),
    anno::description("Returns the sine of a value."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(733)
]]{return math::sin(a);}

export float2 sincos(float a=0.)
[[
    anno::display_name("SinCos"),
    anno::description("Returns the sine and cosine at the same time."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(739)
]]{float[]b = math::sincos(a); return float2(b[0],b[1]); }

export float smoothstep(float a=0., float b=1., float l=0.)
[[
    anno::display_name("Smoothstep"),
    anno::description("Returns 0 if l <= a and 1 if l >= b, and performs a smooth curve interpolation between 0 and 1 when a < l < b."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(740)
]]{return math::smoothstep(a,b,l);}
export float2 smoothstep(float2 a=float2(1.), float2 b=float2(0.), float2 l=float2(0.))
[[
    anno::display_name("Smoothstep"),
    anno::description("Returns 0 if l <= a and 1 if l >= b, and performs a smooth curve interpolation between 0 and 1 when a < l < b."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(741)
]]{return math::smoothstep(a,b,l);}
export float3 smoothstep(float3 a=float3(1.), float3 b=float3(0.), float3 l=float3(0.))
[[
    anno::display_name("Smoothstep"),
    anno::description("Returns 0 if l <= a and 1 if l >= b, and performs a smooth curve interpolation between 0 and 1 when a < l < b."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(742)
]]{return math::smoothstep(a,b,l);}
export float4 smoothstep(float4 a=float4(1.), float4 b=float4(0.), float4 l=float4(0.))
[[
    anno::display_name("Smoothstep"),
    anno::description("Returns 0 if l <= a and 1 if l >= b, and performs a smooth curve interpolation between 0 and 1 when a < l < b."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(743)
]]{return math::smoothstep(a,b,l);}
export float2 smoothstep(float2 a=float2(1.), float2 b=float2(0.), float l=0.)
[[
    anno::display_name("Smoothstep"),
    anno::description("Returns 0 if l <= a and 1 if l >= b, and performs a smooth curve interpolation between 0 and 1 when a < l < b."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(744)
]]{return math::smoothstep(a,b,l);}
export float3 smoothstep(float3 a=float3(1.), float3 b=float3(0.), float l=0.)
[[
    anno::display_name("Smoothstep"),
    anno::description("Returns 0 if l <= a and 1 if l >= b, and performs a smooth curve interpolation between 0 and 1 when a < l < b."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(745)
]]{return math::smoothstep(a,b,l);}
export float4 smoothstep(float4 a=float4(1.), float4 b=float4(0.), float l=0.)
[[
    anno::display_name("Smoothstep"),
    anno::description("Returns 0 if l <= a and 1 if l >= b, and performs a smooth curve interpolation between 0 and 1 when a < l < b."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(746)
]]{return math::smoothstep(a,b,l);}

export float sqrt(float a=0.)
[[
    anno::display_name("Sqrt"),
    anno::description("Returns the square root."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(750)
]]{return math::sqrt(a);}
export float2 sqrt(float2 a=float2(0.))
[[
    anno::display_name("Sqrt"),
    anno::description("Returns the square root."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(751)
]]{return math::sqrt(a);}
export float3 sqrt(float3 a=float3(0.))
[[
    anno::display_name("Sqrt"),
    anno::description("Returns the square root."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(752)
]]{return math::sqrt(a);}
export float4 sqrt(float4 a=float4(0.))
[[
    anno::display_name("Sqrt"),
    anno::description("Returns the square root."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(753)
]]{return math::sqrt(a);}
export color sqrt(color a=color(0.))
[[
    anno::display_name("Sqrt"),
    anno::description("Returns the square root."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(754)
]]{return math::sqrt(a);}

export float step(float a=0., float b=0.)
[[
    anno::display_name("Step"),
    anno::description("Returns 0 if b is less than a and 1 otherwise."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(760)
]]{return math::step(a,b);}
export float2 step(float2 a=float2(0.), float2 b=float2(0.))
[[
    anno::display_name("Step"),
    anno::description("Returns 0 if b is less than a and 1 otherwise."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(761)
]]{return math::step(a,b);}
export float3 step(float3 a=float3(0.), float3 b=float3(0.))
[[
    anno::display_name("Step"),
    anno::description("Returns 0 if b is less than a and 1 otherwise."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(762)
]]{return math::step(a,b);}
export float4 step(float4 a=float4(0.), float4 b=float4(0.))
[[
    anno::display_name("Step"),
    anno::description("Returns 0 if b is less than a and 1 otherwise."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(763)
]]{return math::step(a,b);}

export float tan(float a=0.)
[[
    anno::display_name("Tan"),
    anno::description("Returns the tangent of a. Angles specified by a are in radians."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(770)
]]{return math::tan(a);}
export float2 tan(float2 a=float2(0.))
[[
    anno::display_name("Tan"),
    anno::description("Returns the tangent of a. Angles specified by a are in radians."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(771)
]]{return math::tan(a);}
export float3 tan(float3 a=float3(0.))
[[
    anno::display_name("Tan"),
    anno::description("Returns the tangent of a. Angles specified by a are in radians."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(772)
]]{return math::tan(a);}
export float4 tan(float4 a=float4(0.))
[[
    anno::display_name("Tan"),
    anno::description("Returns the tangent of a. Angles specified by a are in radians."),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(773)
]]{return math::tan(a);}

export float remap(float a=0., float start_old=0., float end_old=1., float start_new=0., float end_new=1.)
[[
    anno::display_name("Remap"),
    anno::description("Remaps a value from its old range to a new range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(680)
]]
    {return start_new + (a - start_old) * (end_new - start_new) / (end_old - start_old);}
export float2 remap(float2 a=0., float2 start_old=0., float2 end_old=1., float2 start_new=0., float2 end_new=1.)
[[
    anno::display_name("Remap"),
    anno::description("Remaps a value from its old range to a new range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(681)
]]  {return start_new + (a - start_old) * (end_new - start_new) / (end_old - start_old);}
export float3 remap(float3 a=0., float3 start_old=0., float3 end_old=1., float3 start_new=0., float3 end_new=1.)
[[
    anno::display_name("Remap"),
    anno::description("Remaps a value from its old range to a new range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(682)
]]
    {return start_new + (a - start_old) * (end_new - start_new) / (end_old - start_old);}
export float4 remap(float4 a=0., float4 start_old=0., float4 end_old=1., float4 start_new=0., float4 end_new=1.)
[[
    anno::display_name("Remap"),
    anno::description("Remaps a value from its old range to a new range"),
    anno::author("NVIDIA Corporation"),
    anno::in_group("Math"),
    anno::ui_order(683)
]]
    {return start_new + (a - start_old) * (end_new - start_new) / (end_old - start_old);}
