1 /**
2 A comparison function for common types 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.visualshadernodecompare;
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 comparison function for common types within the visual shader graph.
29 
30 Compares `a` and `b` of $(D type) by $(D _function). Returns a boolean scalar. Translates to `if` instruction in shader code.
31 */
32 @GodotBaseClass struct VisualShaderNodeCompare
33 {
34 	package(godot) enum string _GODOT_internal_name = "VisualShaderNodeCompare";
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_comparison_type") GodotMethod!(VisualShaderNodeCompare.ComparisonType) getComparisonType;
45 		@GodotName("get_condition") GodotMethod!(VisualShaderNodeCompare.Condition) getCondition;
46 		@GodotName("get_function") GodotMethod!(VisualShaderNodeCompare.Function) getFunction;
47 		@GodotName("set_comparison_type") GodotMethod!(void, long) setComparisonType;
48 		@GodotName("set_condition") GodotMethod!(void, long) setCondition;
49 		@GodotName("set_function") GodotMethod!(void, long) setFunction;
50 	}
51 	/// 
52 	pragma(inline, true) bool opEquals(in VisualShaderNodeCompare other) const
53 	{ return _godot_object.ptr is other._godot_object.ptr; }
54 	/// 
55 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
56 	{ _godot_object.ptr = n; return null; }
57 	/// 
58 	pragma(inline, true) bool opEquals(typeof(null) n) const
59 	{ return _godot_object.ptr is n; }
60 	/// 
61 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
62 	mixin baseCasts;
63 	/// Construct a new instance of VisualShaderNodeCompare.
64 	/// Note: use `memnew!VisualShaderNodeCompare` instead.
65 	static VisualShaderNodeCompare _new()
66 	{
67 		static godot_class_constructor constructor;
68 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("VisualShaderNodeCompare");
69 		if(constructor is null) return typeof(this).init;
70 		return cast(VisualShaderNodeCompare)(constructor());
71 	}
72 	@disable new(size_t s);
73 	/// 
74 	enum ComparisonType : int
75 	{
76 		/**
77 		A floating-point scalar.
78 		*/
79 		ctypeScalar = 0,
80 		/**
81 		A 3D vector type.
82 		*/
83 		ctypeVector = 1,
84 		/**
85 		A boolean type.
86 		*/
87 		ctypeBoolean = 2,
88 		/**
89 		A transform (`mat4`) type.
90 		*/
91 		ctypeTransform = 3,
92 	}
93 	/// 
94 	enum Function : int
95 	{
96 		/**
97 		Comparison for equality (`a == b`).
98 		*/
99 		funcEqual = 0,
100 		/**
101 		Comparison for inequality (`a != b`).
102 		*/
103 		funcNotEqual = 1,
104 		/**
105 		Comparison for greater than (`a > b`). Cannot be used if $(D type) set to $(D constant CTYPE_BOOLEAN) or $(D constant CTYPE_TRANSFORM).
106 		*/
107 		funcGreaterThan = 2,
108 		/**
109 		Comparison for greater than or equal (`a >= b`). Cannot be used if $(D type) set to $(D constant CTYPE_BOOLEAN) or $(D constant CTYPE_TRANSFORM).
110 		*/
111 		funcGreaterThanEqual = 3,
112 		/**
113 		Comparison for less than (`a < b`). Cannot be used if $(D type) set to $(D constant CTYPE_BOOLEAN) or $(D constant CTYPE_TRANSFORM).
114 		*/
115 		funcLessThan = 4,
116 		/**
117 		Comparison for less than or equal (`a < b`). Cannot be used if $(D type) set to $(D constant CTYPE_BOOLEAN) or $(D constant CTYPE_TRANSFORM).
118 		*/
119 		funcLessThanEqual = 5,
120 	}
121 	/// 
122 	enum Condition : int
123 	{
124 		/**
125 		The result will be true if all of component in vector satisfy the comparison condition.
126 		*/
127 		condAll = 0,
128 		/**
129 		The result will be true if any of component in vector satisfy the comparison condition.
130 		*/
131 		condAny = 1,
132 	}
133 	/// 
134 	enum Constants : int
135 	{
136 		condAll = 0,
137 		ctypeScalar = 0,
138 		funcEqual = 0,
139 		ctypeVector = 1,
140 		funcNotEqual = 1,
141 		condAny = 1,
142 		funcGreaterThan = 2,
143 		ctypeBoolean = 2,
144 		ctypeTransform = 3,
145 		funcGreaterThanEqual = 3,
146 		funcLessThan = 4,
147 		funcLessThanEqual = 5,
148 	}
149 	/**
150 	
151 	*/
152 	VisualShaderNodeCompare.ComparisonType getComparisonType() const
153 	{
154 		checkClassBinding!(typeof(this))();
155 		return ptrcall!(VisualShaderNodeCompare.ComparisonType)(GDNativeClassBinding.getComparisonType, _godot_object);
156 	}
157 	/**
158 	
159 	*/
160 	VisualShaderNodeCompare.Condition getCondition() const
161 	{
162 		checkClassBinding!(typeof(this))();
163 		return ptrcall!(VisualShaderNodeCompare.Condition)(GDNativeClassBinding.getCondition, _godot_object);
164 	}
165 	/**
166 	
167 	*/
168 	VisualShaderNodeCompare.Function getFunction() const
169 	{
170 		checkClassBinding!(typeof(this))();
171 		return ptrcall!(VisualShaderNodeCompare.Function)(GDNativeClassBinding.getFunction, _godot_object);
172 	}
173 	/**
174 	
175 	*/
176 	void setComparisonType(in long type)
177 	{
178 		checkClassBinding!(typeof(this))();
179 		ptrcall!(void)(GDNativeClassBinding.setComparisonType, _godot_object, type);
180 	}
181 	/**
182 	
183 	*/
184 	void setCondition(in long condition)
185 	{
186 		checkClassBinding!(typeof(this))();
187 		ptrcall!(void)(GDNativeClassBinding.setCondition, _godot_object, condition);
188 	}
189 	/**
190 	
191 	*/
192 	void setFunction(in long func)
193 	{
194 		checkClassBinding!(typeof(this))();
195 		ptrcall!(void)(GDNativeClassBinding.setFunction, _godot_object, func);
196 	}
197 	/**
198 	Extra condition which is applied if $(D type) is set to $(D constant CTYPE_VECTOR).
199 	*/
200 	@property VisualShaderNodeCompare.Condition condition()
201 	{
202 		return getCondition();
203 	}
204 	/// ditto
205 	@property void condition(long v)
206 	{
207 		setCondition(v);
208 	}
209 	/**
210 	A comparison function. See $(D _function) for options.
211 	*/
212 	@property VisualShaderNodeCompare.Function _function()
213 	{
214 		return getFunction();
215 	}
216 	/// ditto
217 	@property void _function(long v)
218 	{
219 		setFunction(v);
220 	}
221 	/**
222 	The type to be used in the comparison. See $(D comparisontype) for options.
223 	*/
224 	@property VisualShaderNodeCompare.ComparisonType type()
225 	{
226 		return getComparisonType();
227 	}
228 	/// ditto
229 	@property void type(long v)
230 	{
231 		setComparisonType(v);
232 	}
233 }