1 /** 2 A vector function to be used within the visual shader graph. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.visualshadernodevectorfunc; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.traits; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.globalenums; 22 import godot.object; 23 import godot.classdb; 24 import godot.visualshadernode; 25 import godot.resource; 26 import godot.reference; 27 /** 28 A vector function to be used within the visual shader graph. 29 30 A visual shader node able to perform different functions using vectors. 31 */ 32 @GodotBaseClass struct VisualShaderNodeVectorFunc 33 { 34 package(godot) enum string _GODOT_internal_name = "VisualShaderNodeVectorFunc"; 35 public: 36 @nogc nothrow: 37 union { /** */ godot_object _godot_object; /** */ VisualShaderNode _GODOT_base; } 38 alias _GODOT_base this; 39 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 40 package(godot) __gshared bool _classBindingInitialized = false; 41 package(godot) static struct GDNativeClassBinding 42 { 43 __gshared: 44 @GodotName("get_function") GodotMethod!(VisualShaderNodeVectorFunc.Function) getFunction; 45 @GodotName("set_function") GodotMethod!(void, long) setFunction; 46 } 47 /// 48 pragma(inline, true) bool opEquals(in VisualShaderNodeVectorFunc other) const 49 { return _godot_object.ptr is other._godot_object.ptr; } 50 /// 51 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 52 { _godot_object.ptr = n; return null; } 53 /// 54 pragma(inline, true) bool opEquals(typeof(null) n) const 55 { return _godot_object.ptr is n; } 56 /// 57 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 58 mixin baseCasts; 59 /// Construct a new instance of VisualShaderNodeVectorFunc. 60 /// Note: use `memnew!VisualShaderNodeVectorFunc` instead. 61 static VisualShaderNodeVectorFunc _new() 62 { 63 static godot_class_constructor constructor; 64 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("VisualShaderNodeVectorFunc"); 65 if(constructor is null) return typeof(this).init; 66 return cast(VisualShaderNodeVectorFunc)(constructor()); 67 } 68 @disable new(size_t s); 69 /// 70 enum Function : int 71 { 72 /** 73 Normalizes the vector so that it has a length of `1` but points in the same direction. 74 */ 75 funcNormalize = 0, 76 /** 77 Clamps the value between `0.0` and `1.0`. 78 */ 79 funcSaturate = 1, 80 /** 81 Returns the opposite value of the parameter. 82 */ 83 funcNegate = 2, 84 /** 85 Returns `1/vector`. 86 */ 87 funcReciprocal = 3, 88 /** 89 Converts RGB vector to HSV equivalent. 90 */ 91 funcRgb2hsv = 4, 92 /** 93 Converts HSV vector to RGB equivalent. 94 */ 95 funcHsv2rgb = 5, 96 /** 97 Returns the absolute value of the parameter. 98 */ 99 funcAbs = 6, 100 /** 101 Returns the arc-cosine of the parameter. 102 */ 103 funcAcos = 7, 104 /** 105 Returns the inverse hyperbolic cosine of the parameter. 106 */ 107 funcAcosh = 8, 108 /** 109 Returns the arc-sine of the parameter. 110 */ 111 funcAsin = 9, 112 /** 113 Returns the inverse hyperbolic sine of the parameter. 114 */ 115 funcAsinh = 10, 116 /** 117 Returns the arc-tangent of the parameter. 118 */ 119 funcAtan = 11, 120 /** 121 Returns the inverse hyperbolic tangent of the parameter. 122 */ 123 funcAtanh = 12, 124 /** 125 Finds the nearest integer that is greater than or equal to the parameter. 126 */ 127 funcCeil = 13, 128 /** 129 Returns the cosine of the parameter. 130 */ 131 funcCos = 14, 132 /** 133 Returns the hyperbolic cosine of the parameter. 134 */ 135 funcCosh = 15, 136 /** 137 Converts a quantity in radians to degrees. 138 */ 139 funcDegrees = 16, 140 /** 141 Base-e Exponential. 142 */ 143 funcExp = 17, 144 /** 145 Base-2 Exponential. 146 */ 147 funcExp2 = 18, 148 /** 149 Finds the nearest integer less than or equal to the parameter. 150 */ 151 funcFloor = 19, 152 /** 153 Computes the fractional part of the argument. 154 */ 155 funcFrac = 20, 156 /** 157 Returns the inverse of the square root of the parameter. 158 */ 159 funcInverseSqrt = 21, 160 /** 161 Natural logarithm. 162 */ 163 funcLog = 22, 164 /** 165 Base-2 logarithm. 166 */ 167 funcLog2 = 23, 168 /** 169 Converts a quantity in degrees to radians. 170 */ 171 funcRadians = 24, 172 /** 173 Finds the nearest integer to the parameter. 174 */ 175 funcRound = 25, 176 /** 177 Finds the nearest even integer to the parameter. 178 */ 179 funcRoundeven = 26, 180 /** 181 Extracts the sign of the parameter, i.e. returns `-1` if the parameter is negative, `1` if it's positive and `0` otherwise. 182 */ 183 funcSign = 27, 184 /** 185 Returns the sine of the parameter. 186 */ 187 funcSin = 28, 188 /** 189 Returns the hyperbolic sine of the parameter. 190 */ 191 funcSinh = 29, 192 /** 193 Returns the square root of the parameter. 194 */ 195 funcSqrt = 30, 196 /** 197 Returns the tangent of the parameter. 198 */ 199 funcTan = 31, 200 /** 201 Returns the hyperbolic tangent of the parameter. 202 */ 203 funcTanh = 32, 204 /** 205 Returns a value equal to the nearest integer to the parameter whose absolute value is not larger than the absolute value of the parameter. 206 */ 207 funcTrunc = 33, 208 /** 209 Returns `1.0 - vector`. 210 */ 211 funcOneminus = 34, 212 } 213 /// 214 enum Constants : int 215 { 216 funcNormalize = 0, 217 funcSaturate = 1, 218 funcNegate = 2, 219 funcReciprocal = 3, 220 funcRgb2hsv = 4, 221 funcHsv2rgb = 5, 222 funcAbs = 6, 223 funcAcos = 7, 224 funcAcosh = 8, 225 funcAsin = 9, 226 funcAsinh = 10, 227 funcAtan = 11, 228 funcAtanh = 12, 229 funcCeil = 13, 230 funcCos = 14, 231 funcCosh = 15, 232 funcDegrees = 16, 233 funcExp = 17, 234 funcExp2 = 18, 235 funcFloor = 19, 236 funcFrac = 20, 237 funcInverseSqrt = 21, 238 funcLog = 22, 239 funcLog2 = 23, 240 funcRadians = 24, 241 funcRound = 25, 242 funcRoundeven = 26, 243 funcSign = 27, 244 funcSin = 28, 245 funcSinh = 29, 246 funcSqrt = 30, 247 funcTan = 31, 248 funcTanh = 32, 249 funcTrunc = 33, 250 funcOneminus = 34, 251 } 252 /** 253 254 */ 255 VisualShaderNodeVectorFunc.Function getFunction() const 256 { 257 checkClassBinding!(typeof(this))(); 258 return ptrcall!(VisualShaderNodeVectorFunc.Function)(GDNativeClassBinding.getFunction, _godot_object); 259 } 260 /** 261 262 */ 263 void setFunction(in long func) 264 { 265 checkClassBinding!(typeof(this))(); 266 ptrcall!(void)(GDNativeClassBinding.setFunction, _godot_object, func); 267 } 268 /** 269 The function to be performed. See $(D _function) for options. 270 */ 271 @property VisualShaderNodeVectorFunc.Function _function() 272 { 273 return getFunction(); 274 } 275 /// ditto 276 @property void _function(long v) 277 { 278 setFunction(v); 279 } 280 }