1 /**
2 Prerendered indirect light map for a scene.
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.bakedlightmap;
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.visualinstance;
24 import godot.bakedlightmapdata;
25 import godot.spatial;
26 import godot.node;
27 /**
28 Prerendered indirect light map for a scene.
29 
30 Baked lightmaps are an alternative workflow for adding indirect (or baked) lighting to a scene. Unlike the $(D GIProbe) approach, baked lightmaps work fine on low-end PCs and mobile devices as they consume almost no resources in run-time.
31 */
32 @GodotBaseClass struct BakedLightmap
33 {
34 	enum string _GODOT_internal_name = "BakedLightmap";
35 public:
36 @nogc nothrow:
37 	union { godot_object _godot_object; VisualInstance _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 _classBinding
42 	{
43 		__gshared:
44 		@GodotName("set_light_data") GodotMethod!(void, BakedLightmapData) setLightData;
45 		@GodotName("get_light_data") GodotMethod!(BakedLightmapData) getLightData;
46 		@GodotName("set_bake_cell_size") GodotMethod!(void, double) setBakeCellSize;
47 		@GodotName("get_bake_cell_size") GodotMethod!(double) getBakeCellSize;
48 		@GodotName("set_capture_cell_size") GodotMethod!(void, double) setCaptureCellSize;
49 		@GodotName("get_capture_cell_size") GodotMethod!(double) getCaptureCellSize;
50 		@GodotName("set_bake_quality") GodotMethod!(void, long) setBakeQuality;
51 		@GodotName("get_bake_quality") GodotMethod!(BakedLightmap.BakeQuality) getBakeQuality;
52 		@GodotName("set_bake_mode") GodotMethod!(void, long) setBakeMode;
53 		@GodotName("get_bake_mode") GodotMethod!(BakedLightmap.BakeMode) getBakeMode;
54 		@GodotName("set_extents") GodotMethod!(void, Vector3) setExtents;
55 		@GodotName("get_extents") GodotMethod!(Vector3) getExtents;
56 		@GodotName("set_propagation") GodotMethod!(void, double) setPropagation;
57 		@GodotName("get_propagation") GodotMethod!(double) getPropagation;
58 		@GodotName("set_energy") GodotMethod!(void, double) setEnergy;
59 		@GodotName("get_energy") GodotMethod!(double) getEnergy;
60 		@GodotName("set_hdr") GodotMethod!(void, bool) setHdr;
61 		@GodotName("is_hdr") GodotMethod!(bool) isHdr;
62 		@GodotName("set_image_path") GodotMethod!(void, String) setImagePath;
63 		@GodotName("get_image_path") GodotMethod!(String) getImagePath;
64 		@GodotName("bake") GodotMethod!(BakedLightmap.BakeError, GodotObject, bool) bake;
65 		@GodotName("debug_bake") GodotMethod!(void) debugBake;
66 	}
67 	bool opEquals(in BakedLightmap other) const { return _godot_object.ptr is other._godot_object.ptr; }
68 	BakedLightmap opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
69 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
70 	mixin baseCasts;
71 	static BakedLightmap _new()
72 	{
73 		static godot_class_constructor constructor;
74 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("BakedLightmap");
75 		if(constructor is null) return typeof(this).init;
76 		return cast(BakedLightmap)(constructor());
77 	}
78 	@disable new(size_t s);
79 	/// 
80 	enum BakeQuality : int
81 	{
82 		/**
83 		Lowest bake quality mode. Fastest to calculate.
84 		*/
85 		bakeQualityLow = 0,
86 		/**
87 		Default bake quality mode.
88 		*/
89 		bakeQualityMedium = 1,
90 		/**
91 		Highest bake quality mode. Takes longer to calculate.
92 		*/
93 		bakeQualityHigh = 2,
94 	}
95 	/// 
96 	enum BakeError : int
97 	{
98 		/**
99 		
100 		*/
101 		bakeErrorOk = 0,
102 		/**
103 		
104 		*/
105 		bakeErrorNoSavePath = 1,
106 		/**
107 		
108 		*/
109 		bakeErrorNoMeshes = 2,
110 		/**
111 		
112 		*/
113 		bakeErrorCantCreateImage = 3,
114 		/**
115 		
116 		*/
117 		bakeErrorUserAborted = 4,
118 	}
119 	/// 
120 	enum BakeMode : int
121 	{
122 		/**
123 		Less precise but faster bake mode.
124 		*/
125 		bakeModeConeTrace = 0,
126 		/**
127 		More precise bake mode but can take considerably longer to bake.
128 		*/
129 		bakeModeRayTrace = 1,
130 	}
131 	/// 
132 	enum Constants : int
133 	{
134 		bakeErrorOk = 0,
135 		bakeQualityLow = 0,
136 		bakeModeConeTrace = 0,
137 		bakeErrorNoSavePath = 1,
138 		bakeQualityMedium = 1,
139 		bakeModeRayTrace = 1,
140 		bakeQualityHigh = 2,
141 		bakeErrorNoMeshes = 2,
142 		bakeErrorCantCreateImage = 3,
143 		bakeErrorUserAborted = 4,
144 	}
145 	/**
146 	
147 	*/
148 	void setLightData(BakedLightmapData data)
149 	{
150 		checkClassBinding!(typeof(this))();
151 		ptrcall!(void)(_classBinding.setLightData, _godot_object, data);
152 	}
153 	/**
154 	
155 	*/
156 	Ref!BakedLightmapData getLightData() const
157 	{
158 		checkClassBinding!(typeof(this))();
159 		return ptrcall!(BakedLightmapData)(_classBinding.getLightData, _godot_object);
160 	}
161 	/**
162 	
163 	*/
164 	void setBakeCellSize(in double bake_cell_size)
165 	{
166 		checkClassBinding!(typeof(this))();
167 		ptrcall!(void)(_classBinding.setBakeCellSize, _godot_object, bake_cell_size);
168 	}
169 	/**
170 	
171 	*/
172 	double getBakeCellSize() const
173 	{
174 		checkClassBinding!(typeof(this))();
175 		return ptrcall!(double)(_classBinding.getBakeCellSize, _godot_object);
176 	}
177 	/**
178 	
179 	*/
180 	void setCaptureCellSize(in double capture_cell_size)
181 	{
182 		checkClassBinding!(typeof(this))();
183 		ptrcall!(void)(_classBinding.setCaptureCellSize, _godot_object, capture_cell_size);
184 	}
185 	/**
186 	
187 	*/
188 	double getCaptureCellSize() const
189 	{
190 		checkClassBinding!(typeof(this))();
191 		return ptrcall!(double)(_classBinding.getCaptureCellSize, _godot_object);
192 	}
193 	/**
194 	
195 	*/
196 	void setBakeQuality(in long bake_quality)
197 	{
198 		checkClassBinding!(typeof(this))();
199 		ptrcall!(void)(_classBinding.setBakeQuality, _godot_object, bake_quality);
200 	}
201 	/**
202 	
203 	*/
204 	BakedLightmap.BakeQuality getBakeQuality() const
205 	{
206 		checkClassBinding!(typeof(this))();
207 		return ptrcall!(BakedLightmap.BakeQuality)(_classBinding.getBakeQuality, _godot_object);
208 	}
209 	/**
210 	
211 	*/
212 	void setBakeMode(in long bake_mode)
213 	{
214 		checkClassBinding!(typeof(this))();
215 		ptrcall!(void)(_classBinding.setBakeMode, _godot_object, bake_mode);
216 	}
217 	/**
218 	
219 	*/
220 	BakedLightmap.BakeMode getBakeMode() const
221 	{
222 		checkClassBinding!(typeof(this))();
223 		return ptrcall!(BakedLightmap.BakeMode)(_classBinding.getBakeMode, _godot_object);
224 	}
225 	/**
226 	
227 	*/
228 	void setExtents(in Vector3 extents)
229 	{
230 		checkClassBinding!(typeof(this))();
231 		ptrcall!(void)(_classBinding.setExtents, _godot_object, extents);
232 	}
233 	/**
234 	
235 	*/
236 	Vector3 getExtents() const
237 	{
238 		checkClassBinding!(typeof(this))();
239 		return ptrcall!(Vector3)(_classBinding.getExtents, _godot_object);
240 	}
241 	/**
242 	
243 	*/
244 	void setPropagation(in double propagation)
245 	{
246 		checkClassBinding!(typeof(this))();
247 		ptrcall!(void)(_classBinding.setPropagation, _godot_object, propagation);
248 	}
249 	/**
250 	
251 	*/
252 	double getPropagation() const
253 	{
254 		checkClassBinding!(typeof(this))();
255 		return ptrcall!(double)(_classBinding.getPropagation, _godot_object);
256 	}
257 	/**
258 	
259 	*/
260 	void setEnergy(in double energy)
261 	{
262 		checkClassBinding!(typeof(this))();
263 		ptrcall!(void)(_classBinding.setEnergy, _godot_object, energy);
264 	}
265 	/**
266 	
267 	*/
268 	double getEnergy() const
269 	{
270 		checkClassBinding!(typeof(this))();
271 		return ptrcall!(double)(_classBinding.getEnergy, _godot_object);
272 	}
273 	/**
274 	
275 	*/
276 	void setHdr(in bool hdr)
277 	{
278 		checkClassBinding!(typeof(this))();
279 		ptrcall!(void)(_classBinding.setHdr, _godot_object, hdr);
280 	}
281 	/**
282 	
283 	*/
284 	bool isHdr() const
285 	{
286 		checkClassBinding!(typeof(this))();
287 		return ptrcall!(bool)(_classBinding.isHdr, _godot_object);
288 	}
289 	/**
290 	
291 	*/
292 	void setImagePath(StringArg0)(in StringArg0 image_path)
293 	{
294 		checkClassBinding!(typeof(this))();
295 		ptrcall!(void)(_classBinding.setImagePath, _godot_object, image_path);
296 	}
297 	/**
298 	
299 	*/
300 	String getImagePath() const
301 	{
302 		checkClassBinding!(typeof(this))();
303 		return ptrcall!(String)(_classBinding.getImagePath, _godot_object);
304 	}
305 	/**
306 	
307 	*/
308 	BakedLightmap.BakeError bake(GodotObject from_node = GodotObject.init, in bool create_visual_debug = false)
309 	{
310 		checkClassBinding!(typeof(this))();
311 		return ptrcall!(BakedLightmap.BakeError)(_classBinding.bake, _godot_object, from_node, create_visual_debug);
312 	}
313 	/**
314 	
315 	*/
316 	void debugBake()
317 	{
318 		checkClassBinding!(typeof(this))();
319 		ptrcall!(void)(_classBinding.debugBake, _godot_object);
320 	}
321 	/**
322 	Grid subdivision size for lightmapper calculation. Default value of `0.25` will work for most cases. Increase for better lighting on small details or if your scene is very large.
323 	*/
324 	@property double bakeCellSize()
325 	{
326 		return getBakeCellSize();
327 	}
328 	/// ditto
329 	@property void bakeCellSize(double v)
330 	{
331 		setBakeCellSize(v);
332 	}
333 	/**
334 	Three quality modes are available. Higher quality requires more rendering time. See $(D bakequality).
335 	*/
336 	@property BakedLightmap.BakeQuality bakeQuality()
337 	{
338 		return getBakeQuality();
339 	}
340 	/// ditto
341 	@property void bakeQuality(long v)
342 	{
343 		setBakeQuality(v);
344 	}
345 	/**
346 	Lightmapping mode. See $(D bakemode).
347 	*/
348 	@property BakedLightmap.BakeMode bakeMode()
349 	{
350 		return getBakeMode();
351 	}
352 	/// ditto
353 	@property void bakeMode(long v)
354 	{
355 		setBakeMode(v);
356 	}
357 	/**
358 	
359 	*/
360 	@property double bakePropagation()
361 	{
362 		return getPropagation();
363 	}
364 	/// ditto
365 	@property void bakePropagation(double v)
366 	{
367 		setPropagation(v);
368 	}
369 	/**
370 	
371 	*/
372 	@property double bakeEnergy()
373 	{
374 		return getEnergy();
375 	}
376 	/// ditto
377 	@property void bakeEnergy(double v)
378 	{
379 		setEnergy(v);
380 	}
381 	/**
382 	If `true` lightmap can capture light values greater than `1.0`. Turning this off will result in a smaller lightmap. Default value:`false`.
383 	*/
384 	@property bool bakeHdr()
385 	{
386 		return isHdr();
387 	}
388 	/// ditto
389 	@property void bakeHdr(bool v)
390 	{
391 		setHdr(v);
392 	}
393 	/**
394 	Size of affected area.
395 	*/
396 	@property Vector3 bakeExtents()
397 	{
398 		return getExtents();
399 	}
400 	/// ditto
401 	@property void bakeExtents(Vector3 v)
402 	{
403 		setExtents(v);
404 	}
405 	/**
406 	Grid size used for real-time capture information on dynamic objects. Cannot be larger than $(D bakeCellSize).
407 	*/
408 	@property double captureCellSize()
409 	{
410 		return getCaptureCellSize();
411 	}
412 	/// ditto
413 	@property void captureCellSize(double v)
414 	{
415 		setCaptureCellSize(v);
416 	}
417 	/**
418 	Location where lightmaps will be saved.
419 	*/
420 	@property String imagePath()
421 	{
422 		return getImagePath();
423 	}
424 	/// ditto
425 	@property void imagePath(String v)
426 	{
427 		setImagePath(v);
428 	}
429 	/**
430 	The calculated light data.
431 	*/
432 	@property BakedLightmapData lightData()
433 	{
434 		return getLightData();
435 	}
436 	/// ditto
437 	@property void lightData(BakedLightmapData v)
438 	{
439 		setLightData(v);
440 	}
441 }