1 /**
2 A CSG Mesh shape that uses a mesh resource.
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.csgmesh;
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.csgprimitive;
25 import godot.material;
26 import godot.mesh;
27 /**
28 A CSG Mesh shape that uses a mesh resource.
29 
30 This CSG node allows you to use any mesh resource as a CSG shape, provided it is closed, does not self-intersect, does not contain internal faces and has no edges that connect to more then two faces.
31 */
32 @GodotBaseClass struct CSGMesh
33 {
34 	package(godot) enum string _GODOT_internal_name = "CSGMesh";
35 public:
36 @nogc nothrow:
37 	union { /** */ godot_object _godot_object; /** */ CSGPrimitive _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("_mesh_changed") GodotMethod!(void) _meshChanged;
45 		@GodotName("get_material") GodotMethod!(Material) getMaterial;
46 		@GodotName("get_mesh") GodotMethod!(Mesh) getMesh;
47 		@GodotName("set_material") GodotMethod!(void, Material) setMaterial;
48 		@GodotName("set_mesh") GodotMethod!(void, Mesh) setMesh;
49 	}
50 	/// 
51 	pragma(inline, true) bool opEquals(in CSGMesh other) const
52 	{ return _godot_object.ptr is other._godot_object.ptr; }
53 	/// 
54 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
55 	{ _godot_object.ptr = n; return null; }
56 	/// 
57 	pragma(inline, true) bool opEquals(typeof(null) n) const
58 	{ return _godot_object.ptr is n; }
59 	/// 
60 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
61 	mixin baseCasts;
62 	/// Construct a new instance of CSGMesh.
63 	/// Note: use `memnew!CSGMesh` instead.
64 	static CSGMesh _new()
65 	{
66 		static godot_class_constructor constructor;
67 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("CSGMesh");
68 		if(constructor is null) return typeof(this).init;
69 		return cast(CSGMesh)(constructor());
70 	}
71 	@disable new(size_t s);
72 	/**
73 	
74 	*/
75 	void _meshChanged()
76 	{
77 		Array _GODOT_args = Array.make();
78 		String _GODOT_method_name = String("_mesh_changed");
79 		this.callv(_GODOT_method_name, _GODOT_args);
80 	}
81 	/**
82 	
83 	*/
84 	Ref!Material getMaterial() const
85 	{
86 		checkClassBinding!(typeof(this))();
87 		return ptrcall!(Material)(GDNativeClassBinding.getMaterial, _godot_object);
88 	}
89 	/**
90 	
91 	*/
92 	Ref!Mesh getMesh()
93 	{
94 		checkClassBinding!(typeof(this))();
95 		return ptrcall!(Mesh)(GDNativeClassBinding.getMesh, _godot_object);
96 	}
97 	/**
98 	
99 	*/
100 	void setMaterial(Material material)
101 	{
102 		checkClassBinding!(typeof(this))();
103 		ptrcall!(void)(GDNativeClassBinding.setMaterial, _godot_object, material);
104 	}
105 	/**
106 	
107 	*/
108 	void setMesh(Mesh mesh)
109 	{
110 		checkClassBinding!(typeof(this))();
111 		ptrcall!(void)(GDNativeClassBinding.setMesh, _godot_object, mesh);
112 	}
113 	/**
114 	The $(D Mesh) resource to use as a CSG shape.
115 	*/
116 	@property Mesh mesh()
117 	{
118 		return getMesh();
119 	}
120 	/// ditto
121 	@property void mesh(Mesh v)
122 	{
123 		setMesh(v);
124 	}
125 }