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.meta;
17 import godot.core;
18 import godot.c;
19 import godot.d.bind;
20 import godot.d.reference;
21 import godot.object;
22 import godot.classdb;
23 import godot.material;
24 import godot.resource;
25 import godot.reference;
26 /**
27 A material for $(D CanvasItem)s.
28 
29 `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).
30 */
31 @GodotBaseClass struct CanvasItemMaterial
32 {
33 	enum string _GODOT_internal_name = "CanvasItemMaterial";
34 public:
35 @nogc nothrow:
36 	union { godot_object _godot_object; Material _GODOT_base; }
37 	alias _GODOT_base this;
38 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
39 	package(godot) __gshared bool _classBindingInitialized = false;
40 	package(godot) static struct _classBinding
41 	{
42 		__gshared:
43 		@GodotName("set_blend_mode") GodotMethod!(void, long) setBlendMode;
44 		@GodotName("get_blend_mode") GodotMethod!(CanvasItemMaterial.BlendMode) getBlendMode;
45 		@GodotName("set_light_mode") GodotMethod!(void, long) setLightMode;
46 		@GodotName("get_light_mode") GodotMethod!(CanvasItemMaterial.LightMode) getLightMode;
47 	}
48 	bool opEquals(in CanvasItemMaterial other) const { return _godot_object.ptr is other._godot_object.ptr; }
49 	CanvasItemMaterial opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
50 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
51 	mixin baseCasts;
52 	static CanvasItemMaterial _new()
53 	{
54 		static godot_class_constructor constructor;
55 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("CanvasItemMaterial");
56 		if(constructor is null) return typeof(this).init;
57 		return cast(CanvasItemMaterial)(constructor());
58 	}
59 	@disable new(size_t s);
60 	/// 
61 	enum LightMode : int
62 	{
63 		/**
64 		Render the material using both light and non-light sensitive material properties.
65 		*/
66 		lightModeNormal = 0,
67 		/**
68 		Render the material as if there were no light.
69 		*/
70 		lightModeUnshaded = 1,
71 		/**
72 		Render the material as if there were only light.
73 		*/
74 		lightModeLightOnly = 2,
75 	}
76 	/// 
77 	enum BlendMode : int
78 	{
79 		/**
80 		Mix blending mode. Colors are assumed to be independent of the alpha (opacity) value.
81 		*/
82 		blendModeMix = 0,
83 		/**
84 		Additive blending mode.
85 		*/
86 		blendModeAdd = 1,
87 		/**
88 		Subtractive blending mode.
89 		*/
90 		blendModeSub = 2,
91 		/**
92 		Multiplicative blending mode.
93 		*/
94 		blendModeMul = 3,
95 		/**
96 		Mix blending mode. Colors are assumed to be premultiplied by the alpha (opacity) value.
97 		*/
98 		blendModePremultAlpha = 4,
99 	}
100 	/// 
101 	enum Constants : int
102 	{
103 		lightModeNormal = 0,
104 		blendModeMix = 0,
105 		blendModeAdd = 1,
106 		lightModeUnshaded = 1,
107 		lightModeLightOnly = 2,
108 		blendModeSub = 2,
109 		blendModeMul = 3,
110 		blendModePremultAlpha = 4,
111 	}
112 	/**
113 	
114 	*/
115 	void setBlendMode(in long blend_mode)
116 	{
117 		checkClassBinding!(typeof(this))();
118 		ptrcall!(void)(_classBinding.setBlendMode, _godot_object, blend_mode);
119 	}
120 	/**
121 	
122 	*/
123 	CanvasItemMaterial.BlendMode getBlendMode() const
124 	{
125 		checkClassBinding!(typeof(this))();
126 		return ptrcall!(CanvasItemMaterial.BlendMode)(_classBinding.getBlendMode, _godot_object);
127 	}
128 	/**
129 	
130 	*/
131 	void setLightMode(in long light_mode)
132 	{
133 		checkClassBinding!(typeof(this))();
134 		ptrcall!(void)(_classBinding.setLightMode, _godot_object, light_mode);
135 	}
136 	/**
137 	
138 	*/
139 	CanvasItemMaterial.LightMode getLightMode() const
140 	{
141 		checkClassBinding!(typeof(this))();
142 		return ptrcall!(CanvasItemMaterial.LightMode)(_classBinding.getLightMode, _godot_object);
143 	}
144 	/**
145 	The manner in which a material's rendering is applied to underlying textures.
146 	*/
147 	@property CanvasItemMaterial.BlendMode blendMode()
148 	{
149 		return getBlendMode();
150 	}
151 	/// ditto
152 	@property void blendMode(long v)
153 	{
154 		setBlendMode(v);
155 	}
156 	/**
157 	The manner in which material reacts to lighting.
158 	*/
159 	@property CanvasItemMaterial.LightMode lightMode()
160 	{
161 		return getLightMode();
162 	}
163 	/// ditto
164 	@property void lightMode(long v)
165 	{
166 		setLightMode(v);
167 	}
168 }