1 /**
2 Extrudes a 2D polygon shape to create a 3D mesh.
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.csgpolygon;
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.csgprimitive;
24 import godot.material;
25 import godot.csgshape;
26 import godot.visualinstance;
27 import godot.spatial;
28 import godot.node;
29 /**
30 Extrudes a 2D polygon shape to create a 3D mesh.
31 
32 This node takes a 2D polygon shape and extrudes it to create a 3D mesh.
33 */
34 @GodotBaseClass struct CSGPolygon
35 {
36 	enum string _GODOT_internal_name = "CSGPolygon";
37 public:
38 @nogc nothrow:
39 	union { godot_object _godot_object; CSGPrimitive _GODOT_base; }
40 	alias _GODOT_base this;
41 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
42 	package(godot) __gshared bool _classBindingInitialized = false;
43 	package(godot) static struct _classBinding
44 	{
45 		__gshared:
46 		@GodotName("set_polygon") GodotMethod!(void, PoolVector2Array) setPolygon;
47 		@GodotName("get_polygon") GodotMethod!(PoolVector2Array) getPolygon;
48 		@GodotName("set_mode") GodotMethod!(void, long) setMode;
49 		@GodotName("get_mode") GodotMethod!(CSGPolygon.Mode) getMode;
50 		@GodotName("set_depth") GodotMethod!(void, double) setDepth;
51 		@GodotName("get_depth") GodotMethod!(double) getDepth;
52 		@GodotName("set_spin_degrees") GodotMethod!(void, double) setSpinDegrees;
53 		@GodotName("get_spin_degrees") GodotMethod!(double) getSpinDegrees;
54 		@GodotName("set_spin_sides") GodotMethod!(void, long) setSpinSides;
55 		@GodotName("get_spin_sides") GodotMethod!(long) getSpinSides;
56 		@GodotName("set_path_node") GodotMethod!(void, NodePath) setPathNode;
57 		@GodotName("get_path_node") GodotMethod!(NodePath) getPathNode;
58 		@GodotName("set_path_interval") GodotMethod!(void, double) setPathInterval;
59 		@GodotName("get_path_interval") GodotMethod!(double) getPathInterval;
60 		@GodotName("set_path_rotation") GodotMethod!(void, long) setPathRotation;
61 		@GodotName("get_path_rotation") GodotMethod!(CSGPolygon.PathRotation) getPathRotation;
62 		@GodotName("set_path_local") GodotMethod!(void, bool) setPathLocal;
63 		@GodotName("is_path_local") GodotMethod!(bool) isPathLocal;
64 		@GodotName("set_path_continuous_u") GodotMethod!(void, bool) setPathContinuousU;
65 		@GodotName("is_path_continuous_u") GodotMethod!(bool) isPathContinuousU;
66 		@GodotName("set_path_joined") GodotMethod!(void, bool) setPathJoined;
67 		@GodotName("is_path_joined") GodotMethod!(bool) isPathJoined;
68 		@GodotName("set_material") GodotMethod!(void, Material) setMaterial;
69 		@GodotName("get_material") GodotMethod!(Material) getMaterial;
70 		@GodotName("set_smooth_faces") GodotMethod!(void, bool) setSmoothFaces;
71 		@GodotName("get_smooth_faces") GodotMethod!(bool) getSmoothFaces;
72 		@GodotName("_is_editable_3d_polygon") GodotMethod!(bool) _isEditable3dPolygon;
73 		@GodotName("_has_editable_3d_polygon_no_depth") GodotMethod!(bool) _hasEditable3dPolygonNoDepth;
74 		@GodotName("_path_exited") GodotMethod!(void) _pathExited;
75 		@GodotName("_path_changed") GodotMethod!(void) _pathChanged;
76 	}
77 	bool opEquals(in CSGPolygon other) const { return _godot_object.ptr is other._godot_object.ptr; }
78 	CSGPolygon opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
79 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
80 	mixin baseCasts;
81 	static CSGPolygon _new()
82 	{
83 		static godot_class_constructor constructor;
84 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("CSGPolygon");
85 		if(constructor is null) return typeof(this).init;
86 		return cast(CSGPolygon)(constructor());
87 	}
88 	@disable new(size_t s);
89 	/// 
90 	enum PathRotation : int
91 	{
92 		/**
93 		Slice is not rotated.
94 		*/
95 		pathRotationPolygon = 0,
96 		/**
97 		Slice is rotated around the up vector of the path.
98 		*/
99 		pathRotationPath = 1,
100 		/**
101 		Slice is rotate to match the path exactly.
102 		*/
103 		pathRotationPathFollow = 2,
104 	}
105 	/// 
106 	enum Mode : int
107 	{
108 		/**
109 		Shape is extruded to $(D depth).
110 		*/
111 		modeDepth = 0,
112 		/**
113 		Shape is extruded by rotating it around an axis.
114 		*/
115 		modeSpin = 1,
116 		/**
117 		Shape is extruded along a path set by a $(D Shape) set in $(D pathNode).
118 		*/
119 		modePath = 2,
120 	}
121 	/// 
122 	enum Constants : int
123 	{
124 		modeDepth = 0,
125 		pathRotationPolygon = 0,
126 		pathRotationPath = 1,
127 		modeSpin = 1,
128 		modePath = 2,
129 		pathRotationPathFollow = 2,
130 	}
131 	/**
132 	
133 	*/
134 	void setPolygon(in PoolVector2Array polygon)
135 	{
136 		checkClassBinding!(typeof(this))();
137 		ptrcall!(void)(_classBinding.setPolygon, _godot_object, polygon);
138 	}
139 	/**
140 	
141 	*/
142 	PoolVector2Array getPolygon() const
143 	{
144 		checkClassBinding!(typeof(this))();
145 		return ptrcall!(PoolVector2Array)(_classBinding.getPolygon, _godot_object);
146 	}
147 	/**
148 	
149 	*/
150 	void setMode(in long mode)
151 	{
152 		checkClassBinding!(typeof(this))();
153 		ptrcall!(void)(_classBinding.setMode, _godot_object, mode);
154 	}
155 	/**
156 	
157 	*/
158 	CSGPolygon.Mode getMode() const
159 	{
160 		checkClassBinding!(typeof(this))();
161 		return ptrcall!(CSGPolygon.Mode)(_classBinding.getMode, _godot_object);
162 	}
163 	/**
164 	
165 	*/
166 	void setDepth(in double depth)
167 	{
168 		checkClassBinding!(typeof(this))();
169 		ptrcall!(void)(_classBinding.setDepth, _godot_object, depth);
170 	}
171 	/**
172 	
173 	*/
174 	double getDepth() const
175 	{
176 		checkClassBinding!(typeof(this))();
177 		return ptrcall!(double)(_classBinding.getDepth, _godot_object);
178 	}
179 	/**
180 	
181 	*/
182 	void setSpinDegrees(in double degrees)
183 	{
184 		checkClassBinding!(typeof(this))();
185 		ptrcall!(void)(_classBinding.setSpinDegrees, _godot_object, degrees);
186 	}
187 	/**
188 	
189 	*/
190 	double getSpinDegrees() const
191 	{
192 		checkClassBinding!(typeof(this))();
193 		return ptrcall!(double)(_classBinding.getSpinDegrees, _godot_object);
194 	}
195 	/**
196 	
197 	*/
198 	void setSpinSides(in long spin_sides)
199 	{
200 		checkClassBinding!(typeof(this))();
201 		ptrcall!(void)(_classBinding.setSpinSides, _godot_object, spin_sides);
202 	}
203 	/**
204 	
205 	*/
206 	long getSpinSides() const
207 	{
208 		checkClassBinding!(typeof(this))();
209 		return ptrcall!(long)(_classBinding.getSpinSides, _godot_object);
210 	}
211 	/**
212 	
213 	*/
214 	void setPathNode(NodePathArg0)(in NodePathArg0 path)
215 	{
216 		checkClassBinding!(typeof(this))();
217 		ptrcall!(void)(_classBinding.setPathNode, _godot_object, path);
218 	}
219 	/**
220 	
221 	*/
222 	NodePath getPathNode() const
223 	{
224 		checkClassBinding!(typeof(this))();
225 		return ptrcall!(NodePath)(_classBinding.getPathNode, _godot_object);
226 	}
227 	/**
228 	
229 	*/
230 	void setPathInterval(in double distance)
231 	{
232 		checkClassBinding!(typeof(this))();
233 		ptrcall!(void)(_classBinding.setPathInterval, _godot_object, distance);
234 	}
235 	/**
236 	
237 	*/
238 	double getPathInterval() const
239 	{
240 		checkClassBinding!(typeof(this))();
241 		return ptrcall!(double)(_classBinding.getPathInterval, _godot_object);
242 	}
243 	/**
244 	
245 	*/
246 	void setPathRotation(in long mode)
247 	{
248 		checkClassBinding!(typeof(this))();
249 		ptrcall!(void)(_classBinding.setPathRotation, _godot_object, mode);
250 	}
251 	/**
252 	
253 	*/
254 	CSGPolygon.PathRotation getPathRotation() const
255 	{
256 		checkClassBinding!(typeof(this))();
257 		return ptrcall!(CSGPolygon.PathRotation)(_classBinding.getPathRotation, _godot_object);
258 	}
259 	/**
260 	
261 	*/
262 	void setPathLocal(in bool enable)
263 	{
264 		checkClassBinding!(typeof(this))();
265 		ptrcall!(void)(_classBinding.setPathLocal, _godot_object, enable);
266 	}
267 	/**
268 	
269 	*/
270 	bool isPathLocal() const
271 	{
272 		checkClassBinding!(typeof(this))();
273 		return ptrcall!(bool)(_classBinding.isPathLocal, _godot_object);
274 	}
275 	/**
276 	
277 	*/
278 	void setPathContinuousU(in bool enable)
279 	{
280 		checkClassBinding!(typeof(this))();
281 		ptrcall!(void)(_classBinding.setPathContinuousU, _godot_object, enable);
282 	}
283 	/**
284 	
285 	*/
286 	bool isPathContinuousU() const
287 	{
288 		checkClassBinding!(typeof(this))();
289 		return ptrcall!(bool)(_classBinding.isPathContinuousU, _godot_object);
290 	}
291 	/**
292 	
293 	*/
294 	void setPathJoined(in bool enable)
295 	{
296 		checkClassBinding!(typeof(this))();
297 		ptrcall!(void)(_classBinding.setPathJoined, _godot_object, enable);
298 	}
299 	/**
300 	
301 	*/
302 	bool isPathJoined() const
303 	{
304 		checkClassBinding!(typeof(this))();
305 		return ptrcall!(bool)(_classBinding.isPathJoined, _godot_object);
306 	}
307 	/**
308 	
309 	*/
310 	void setMaterial(Material material)
311 	{
312 		checkClassBinding!(typeof(this))();
313 		ptrcall!(void)(_classBinding.setMaterial, _godot_object, material);
314 	}
315 	/**
316 	
317 	*/
318 	Ref!Material getMaterial() const
319 	{
320 		checkClassBinding!(typeof(this))();
321 		return ptrcall!(Material)(_classBinding.getMaterial, _godot_object);
322 	}
323 	/**
324 	
325 	*/
326 	void setSmoothFaces(in bool smooth_faces)
327 	{
328 		checkClassBinding!(typeof(this))();
329 		ptrcall!(void)(_classBinding.setSmoothFaces, _godot_object, smooth_faces);
330 	}
331 	/**
332 	
333 	*/
334 	bool getSmoothFaces() const
335 	{
336 		checkClassBinding!(typeof(this))();
337 		return ptrcall!(bool)(_classBinding.getSmoothFaces, _godot_object);
338 	}
339 	/**
340 	
341 	*/
342 	bool _isEditable3dPolygon() const
343 	{
344 		Array _GODOT_args = Array.empty_array;
345 		String _GODOT_method_name = String("_is_editable_3d_polygon");
346 		return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!bool);
347 	}
348 	/**
349 	
350 	*/
351 	bool _hasEditable3dPolygonNoDepth() const
352 	{
353 		Array _GODOT_args = Array.empty_array;
354 		String _GODOT_method_name = String("_has_editable_3d_polygon_no_depth");
355 		return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!bool);
356 	}
357 	/**
358 	
359 	*/
360 	void _pathExited()
361 	{
362 		Array _GODOT_args = Array.empty_array;
363 		String _GODOT_method_name = String("_path_exited");
364 		this.callv(_GODOT_method_name, _GODOT_args);
365 	}
366 	/**
367 	
368 	*/
369 	void _pathChanged()
370 	{
371 		Array _GODOT_args = Array.empty_array;
372 		String _GODOT_method_name = String("_path_changed");
373 		this.callv(_GODOT_method_name, _GODOT_args);
374 	}
375 	/**
376 	Point array that defines the shape that we'll extrude.
377 	*/
378 	@property PoolVector2Array polygon()
379 	{
380 		return getPolygon();
381 	}
382 	/// ditto
383 	@property void polygon(PoolVector2Array v)
384 	{
385 		setPolygon(v);
386 	}
387 	/**
388 	Extrusion mode.
389 	*/
390 	@property CSGPolygon.Mode mode()
391 	{
392 		return getMode();
393 	}
394 	/// ditto
395 	@property void mode(long v)
396 	{
397 		setMode(v);
398 	}
399 	/**
400 	Extrusion depth when $(D mode) is $(D constant MODE_DEPTH).
401 	*/
402 	@property double depth()
403 	{
404 		return getDepth();
405 	}
406 	/// ditto
407 	@property void depth(double v)
408 	{
409 		setDepth(v);
410 	}
411 	/**
412 	Degrees to rotate our extrusion for each slice when $(D mode) is $(D constant MODE_SPIN).
413 	*/
414 	@property double spinDegrees()
415 	{
416 		return getSpinDegrees();
417 	}
418 	/// ditto
419 	@property void spinDegrees(double v)
420 	{
421 		setSpinDegrees(v);
422 	}
423 	/**
424 	Number of extrusion when $(D mode) is $(D constant MODE_SPIN).
425 	*/
426 	@property long spinSides()
427 	{
428 		return getSpinSides();
429 	}
430 	/// ditto
431 	@property void spinSides(long v)
432 	{
433 		setSpinSides(v);
434 	}
435 	/**
436 	The $(D Shape) object containing the path along which we extrude when $(D mode) is $(D constant MODE_PATH).
437 	*/
438 	@property NodePath pathNode()
439 	{
440 		return getPathNode();
441 	}
442 	/// ditto
443 	@property void pathNode(NodePath v)
444 	{
445 		setPathNode(v);
446 	}
447 	/**
448 	Interval at which a new extrusion slice is added along the path when $(D mode) is $(D constant MODE_PATH).
449 	*/
450 	@property double pathInterval()
451 	{
452 		return getPathInterval();
453 	}
454 	/// ditto
455 	@property void pathInterval(double v)
456 	{
457 		setPathInterval(v);
458 	}
459 	/**
460 	The method by which each slice is rotated along the path when $(D mode) is $(D constant MODE_PATH).
461 	*/
462 	@property CSGPolygon.PathRotation pathRotation()
463 	{
464 		return getPathRotation();
465 	}
466 	/// ditto
467 	@property void pathRotation(long v)
468 	{
469 		setPathRotation(v);
470 	}
471 	/**
472 	If false we extrude centered on our path, if true we extrude in relation to the position of our CSGPolygon when $(D mode) is $(D constant MODE_PATH).
473 	*/
474 	@property bool pathLocal()
475 	{
476 		return isPathLocal();
477 	}
478 	/// ditto
479 	@property void pathLocal(bool v)
480 	{
481 		setPathLocal(v);
482 	}
483 	/**
484 	If true the u component of our uv will continuously increase in unison with the distance traveled along our path when $(D mode) is $(D constant MODE_PATH).
485 	*/
486 	@property bool pathContinuousU()
487 	{
488 		return isPathContinuousU();
489 	}
490 	/// ditto
491 	@property void pathContinuousU(bool v)
492 	{
493 		setPathContinuousU(v);
494 	}
495 	/**
496 	If true the start and end of our path are joined together ensuring there is no seam when $(D mode) is $(D constant MODE_PATH).
497 	*/
498 	@property bool pathJoined()
499 	{
500 		return isPathJoined();
501 	}
502 	/// ditto
503 	@property void pathJoined(bool v)
504 	{
505 		setPathJoined(v);
506 	}
507 	/**
508 	Generates smooth normals so smooth shading is applied to our mesh.
509 	*/
510 	@property bool smoothFaces()
511 	{
512 		return getSmoothFaces();
513 	}
514 	/// ditto
515 	@property void smoothFaces(bool v)
516 	{
517 		setSmoothFaces(v);
518 	}
519 }