1 /** 2 A vector operator 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.visualshadernodevectorop; 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 operator to be used within the visual shader graph. 29 30 A visual shader node for use of vector operators. Operates on vector `a` and vector `b`. 31 */ 32 @GodotBaseClass struct VisualShaderNodeVectorOp 33 { 34 package(godot) enum string _GODOT_internal_name = "VisualShaderNodeVectorOp"; 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_operator") GodotMethod!(VisualShaderNodeVectorOp.Operator) getOperator; 45 @GodotName("set_operator") GodotMethod!(void, long) setOperator; 46 } 47 /// 48 pragma(inline, true) bool opEquals(in VisualShaderNodeVectorOp 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 VisualShaderNodeVectorOp. 60 /// Note: use `memnew!VisualShaderNodeVectorOp` instead. 61 static VisualShaderNodeVectorOp _new() 62 { 63 static godot_class_constructor constructor; 64 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("VisualShaderNodeVectorOp"); 65 if(constructor is null) return typeof(this).init; 66 return cast(VisualShaderNodeVectorOp)(constructor()); 67 } 68 @disable new(size_t s); 69 /// 70 enum Operator : int 71 { 72 /** 73 Adds two vectors. 74 */ 75 opAdd = 0, 76 /** 77 Subtracts a vector from a vector. 78 */ 79 opSub = 1, 80 /** 81 Multiplies two vectors. 82 */ 83 opMul = 2, 84 /** 85 Divides vector by vector. 86 */ 87 opDiv = 3, 88 /** 89 Returns the remainder of the two vectors. 90 */ 91 opMod = 4, 92 /** 93 Returns the value of the first parameter raised to the power of the second, for each component of the vectors. 94 */ 95 opPow = 5, 96 /** 97 Returns the greater of two values, for each component of the vectors. 98 */ 99 opMax = 6, 100 /** 101 Returns the lesser of two values, for each component of the vectors. 102 */ 103 opMin = 7, 104 /** 105 Calculates the cross product of two vectors. 106 */ 107 opCross = 8, 108 /** 109 Returns the arc-tangent of the parameters. 110 */ 111 opAtan2 = 9, 112 /** 113 Returns the vector that points in the direction of reflection. `a` is incident vector and `b` is the normal vector. 114 */ 115 opReflect = 10, 116 /** 117 Vector step operator. Returns `0.0` if `a` is smaller than `b` and `1.0` otherwise. 118 */ 119 opStep = 11, 120 } 121 /// 122 enum Constants : int 123 { 124 opAdd = 0, 125 opSub = 1, 126 opMul = 2, 127 opDiv = 3, 128 opMod = 4, 129 opPow = 5, 130 opMax = 6, 131 opMin = 7, 132 opCross = 8, 133 opAtan2 = 9, 134 opReflect = 10, 135 opStep = 11, 136 } 137 /** 138 139 */ 140 VisualShaderNodeVectorOp.Operator getOperator() const 141 { 142 checkClassBinding!(typeof(this))(); 143 return ptrcall!(VisualShaderNodeVectorOp.Operator)(GDNativeClassBinding.getOperator, _godot_object); 144 } 145 /** 146 147 */ 148 void setOperator(in long op) 149 { 150 checkClassBinding!(typeof(this))(); 151 ptrcall!(void)(GDNativeClassBinding.setOperator, _godot_object, op); 152 } 153 /** 154 The operator to be used. See $(D operator) for options. 155 */ 156 @property VisualShaderNodeVectorOp.Operator operator() 157 { 158 return getOperator(); 159 } 160 /// ditto 161 @property void operator(long v) 162 { 163 setOperator(v); 164 } 165 }