1 /**
2 A material for $(D CanvasItem)s.
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.canvasitemmaterial;
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.material;
25 /**
26 A material for $(D CanvasItem)s.
27 
28 $(D CanvasItemMaterial)s provide a means of modifying the textures associated with a CanvasItem. They specialize in describing blend and lighting behaviors for textures. Use a $(D ShaderMaterial) to more fully customize a material's interactions with a $(D CanvasItem).
29 */
30 @GodotBaseClass struct CanvasItemMaterial
31 {
32 	package(godot) enum string _GODOT_internal_name = "CanvasItemMaterial";
33 public:
34 @nogc nothrow:
35 	union { /** */ godot_object _godot_object; /** */ Material _GODOT_base; }
36 	alias _GODOT_base this;
37 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
38 	package(godot) __gshared bool _classBindingInitialized = false;
39 	package(godot) static struct GDNativeClassBinding
40 	{
41 		__gshared:
42 		@GodotName("get_blend_mode") GodotMethod!(CanvasItemMaterial.BlendMode) getBlendMode;
43 		@GodotName("get_light_mode") GodotMethod!(CanvasItemMaterial.LightMode) getLightMode;
44 		@GodotName("get_particles_anim_h_frames") GodotMethod!(long) getParticlesAnimHFrames;
45 		@GodotName("get_particles_anim_loop") GodotMethod!(bool) getParticlesAnimLoop;
46 		@GodotName("get_particles_anim_v_frames") GodotMethod!(long) getParticlesAnimVFrames;
47 		@GodotName("get_particles_animation") GodotMethod!(bool) getParticlesAnimation;
48 		@GodotName("set_blend_mode") GodotMethod!(void, long) setBlendMode;
49 		@GodotName("set_light_mode") GodotMethod!(void, long) setLightMode;
50 		@GodotName("set_particles_anim_h_frames") GodotMethod!(void, long) setParticlesAnimHFrames;
51 		@GodotName("set_particles_anim_loop") GodotMethod!(void, bool) setParticlesAnimLoop;
52 		@GodotName("set_particles_anim_v_frames") GodotMethod!(void, long) setParticlesAnimVFrames;
53 		@GodotName("set_particles_animation") GodotMethod!(void, bool) setParticlesAnimation;
54 	}
55 	/// 
56 	pragma(inline, true) bool opEquals(in CanvasItemMaterial other) const
57 	{ return _godot_object.ptr is other._godot_object.ptr; }
58 	/// 
59 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
60 	{ _godot_object.ptr = n; return null; }
61 	/// 
62 	pragma(inline, true) bool opEquals(typeof(null) n) const
63 	{ return _godot_object.ptr is n; }
64 	/// 
65 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
66 	mixin baseCasts;
67 	/// Construct a new instance of CanvasItemMaterial.
68 	/// Note: use `memnew!CanvasItemMaterial` instead.
69 	static CanvasItemMaterial _new()
70 	{
71 		static godot_class_constructor constructor;
72 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("CanvasItemMaterial");
73 		if(constructor is null) return typeof(this).init;
74 		return cast(CanvasItemMaterial)(constructor());
75 	}
76 	@disable new(size_t s);
77 	/// 
78 	enum LightMode : int
79 	{
80 		/**
81 		Render the material using both light and non-light sensitive material properties.
82 		*/
83 		lightModeNormal = 0,
84 		/**
85 		Render the material as if there were no light.
86 		*/
87 		lightModeUnshaded = 1,
88 		/**
89 		Render the material as if there were only light.
90 		*/
91 		lightModeLightOnly = 2,
92 	}
93 	/// 
94 	enum BlendMode : int
95 	{
96 		/**
97 		Mix blending mode. Colors are assumed to be independent of the alpha (opacity) value.
98 		*/
99 		blendModeMix = 0,
100 		/**
101 		Additive blending mode.
102 		*/
103 		blendModeAdd = 1,
104 		/**
105 		Subtractive blending mode.
106 		*/
107 		blendModeSub = 2,
108 		/**
109 		Multiplicative blending mode.
110 		*/
111 		blendModeMul = 3,
112 		/**
113 		Mix blending mode. Colors are assumed to be premultiplied by the alpha (opacity) value.
114 		*/
115 		blendModePremultAlpha = 4,
116 	}
117 	/// 
118 	enum Constants : int
119 	{
120 		lightModeNormal = 0,
121 		blendModeMix = 0,
122 		blendModeAdd = 1,
123 		lightModeUnshaded = 1,
124 		lightModeLightOnly = 2,
125 		blendModeSub = 2,
126 		blendModeMul = 3,
127 		blendModePremultAlpha = 4,
128 	}
129 	/**
130 	
131 	*/
132 	CanvasItemMaterial.BlendMode getBlendMode() const
133 	{
134 		checkClassBinding!(typeof(this))();
135 		return ptrcall!(CanvasItemMaterial.BlendMode)(GDNativeClassBinding.getBlendMode, _godot_object);
136 	}
137 	/**
138 	
139 	*/
140 	CanvasItemMaterial.LightMode getLightMode() const
141 	{
142 		checkClassBinding!(typeof(this))();
143 		return ptrcall!(CanvasItemMaterial.LightMode)(GDNativeClassBinding.getLightMode, _godot_object);
144 	}
145 	/**
146 	
147 	*/
148 	long getParticlesAnimHFrames() const
149 	{
150 		checkClassBinding!(typeof(this))();
151 		return ptrcall!(long)(GDNativeClassBinding.getParticlesAnimHFrames, _godot_object);
152 	}
153 	/**
154 	
155 	*/
156 	bool getParticlesAnimLoop() const
157 	{
158 		checkClassBinding!(typeof(this))();
159 		return ptrcall!(bool)(GDNativeClassBinding.getParticlesAnimLoop, _godot_object);
160 	}
161 	/**
162 	
163 	*/
164 	long getParticlesAnimVFrames() const
165 	{
166 		checkClassBinding!(typeof(this))();
167 		return ptrcall!(long)(GDNativeClassBinding.getParticlesAnimVFrames, _godot_object);
168 	}
169 	/**
170 	
171 	*/
172 	bool getParticlesAnimation() const
173 	{
174 		checkClassBinding!(typeof(this))();
175 		return ptrcall!(bool)(GDNativeClassBinding.getParticlesAnimation, _godot_object);
176 	}
177 	/**
178 	
179 	*/
180 	void setBlendMode(in long blend_mode)
181 	{
182 		checkClassBinding!(typeof(this))();
183 		ptrcall!(void)(GDNativeClassBinding.setBlendMode, _godot_object, blend_mode);
184 	}
185 	/**
186 	
187 	*/
188 	void setLightMode(in long light_mode)
189 	{
190 		checkClassBinding!(typeof(this))();
191 		ptrcall!(void)(GDNativeClassBinding.setLightMode, _godot_object, light_mode);
192 	}
193 	/**
194 	
195 	*/
196 	void setParticlesAnimHFrames(in long frames)
197 	{
198 		checkClassBinding!(typeof(this))();
199 		ptrcall!(void)(GDNativeClassBinding.setParticlesAnimHFrames, _godot_object, frames);
200 	}
201 	/**
202 	
203 	*/
204 	void setParticlesAnimLoop(in bool loop)
205 	{
206 		checkClassBinding!(typeof(this))();
207 		ptrcall!(void)(GDNativeClassBinding.setParticlesAnimLoop, _godot_object, loop);
208 	}
209 	/**
210 	
211 	*/
212 	void setParticlesAnimVFrames(in long frames)
213 	{
214 		checkClassBinding!(typeof(this))();
215 		ptrcall!(void)(GDNativeClassBinding.setParticlesAnimVFrames, _godot_object, frames);
216 	}
217 	/**
218 	
219 	*/
220 	void setParticlesAnimation(in bool particles_anim)
221 	{
222 		checkClassBinding!(typeof(this))();
223 		ptrcall!(void)(GDNativeClassBinding.setParticlesAnimation, _godot_object, particles_anim);
224 	}
225 	/**
226 	The manner in which a material's rendering is applied to underlying textures.
227 	*/
228 	@property CanvasItemMaterial.BlendMode blendMode()
229 	{
230 		return getBlendMode();
231 	}
232 	/// ditto
233 	@property void blendMode(long v)
234 	{
235 		setBlendMode(v);
236 	}
237 	/**
238 	The manner in which material reacts to lighting.
239 	*/
240 	@property CanvasItemMaterial.LightMode lightMode()
241 	{
242 		return getLightMode();
243 	}
244 	/// ditto
245 	@property void lightMode(long v)
246 	{
247 		setLightMode(v);
248 	}
249 	/**
250 	The number of columns in the spritesheet assigned as $(D Texture) for a $(D Particles2D) or $(D CPUParticles2D).
251 	$(B Note:) This property is only used and visible in the editor if $(D particlesAnimation) is `true`.
252 	*/
253 	@property long particlesAnimHFrames()
254 	{
255 		return getParticlesAnimHFrames();
256 	}
257 	/// ditto
258 	@property void particlesAnimHFrames(long v)
259 	{
260 		setParticlesAnimHFrames(v);
261 	}
262 	/**
263 	If `true`, the particles animation will loop.
264 	$(B Note:) This property is only used and visible in the editor if $(D particlesAnimation) is `true`.
265 	*/
266 	@property bool particlesAnimLoop()
267 	{
268 		return getParticlesAnimLoop();
269 	}
270 	/// ditto
271 	@property void particlesAnimLoop(bool v)
272 	{
273 		setParticlesAnimLoop(v);
274 	}
275 	/**
276 	The number of rows in the spritesheet assigned as $(D Texture) for a $(D Particles2D) or $(D CPUParticles2D).
277 	$(B Note:) This property is only used and visible in the editor if $(D particlesAnimation) is `true`.
278 	*/
279 	@property long particlesAnimVFrames()
280 	{
281 		return getParticlesAnimVFrames();
282 	}
283 	/// ditto
284 	@property void particlesAnimVFrames(long v)
285 	{
286 		setParticlesAnimVFrames(v);
287 	}
288 	/**
289 	If `true`, enable spritesheet-based animation features when assigned to $(D Particles2D) and $(D CPUParticles2D) nodes. The $(D ParticlesMaterial.animSpeed) or $(D CPUParticles2D.animSpeed) should also be set to a positive value for the animation to play.
290 	This property (and other `particles_anim_*` properties that depend on it) has no effect on other types of nodes.
291 	*/
292 	@property bool particlesAnimation()
293 	{
294 		return getParticlesAnimation();
295 	}
296 	/// ditto
297 	@property void particlesAnimation(bool v)
298 	{
299 		setParticlesAnimation(v);
300 	}
301 }