1 /**
2 Library of meshes.
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.meshlibrary;
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.resource;
24 import godot.mesh;
25 import godot.navigationmesh;
26 import godot.texture;
27 import godot.reference;
28 /**
29 Library of meshes.
30 
31 Contains a list of $(D Mesh) resources, each with name and ID. Useful for GridMap or painting Terrain.
32 */
33 @GodotBaseClass struct MeshLibrary
34 {
35 	enum string _GODOT_internal_name = "MeshLibrary";
36 public:
37 @nogc nothrow:
38 	union { godot_object _godot_object; Resource _GODOT_base; }
39 	alias _GODOT_base this;
40 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
41 	package(godot) __gshared bool _classBindingInitialized = false;
42 	package(godot) static struct _classBinding
43 	{
44 		__gshared:
45 		@GodotName("create_item") GodotMethod!(void, long) createItem;
46 		@GodotName("set_item_name") GodotMethod!(void, long, String) setItemName;
47 		@GodotName("set_item_mesh") GodotMethod!(void, long, Mesh) setItemMesh;
48 		@GodotName("set_item_navmesh") GodotMethod!(void, long, NavigationMesh) setItemNavmesh;
49 		@GodotName("set_item_shapes") GodotMethod!(void, long, Array) setItemShapes;
50 		@GodotName("set_item_preview") GodotMethod!(void, long, Texture) setItemPreview;
51 		@GodotName("get_item_name") GodotMethod!(String, long) getItemName;
52 		@GodotName("get_item_mesh") GodotMethod!(Mesh, long) getItemMesh;
53 		@GodotName("get_item_navmesh") GodotMethod!(NavigationMesh, long) getItemNavmesh;
54 		@GodotName("get_item_shapes") GodotMethod!(Array, long) getItemShapes;
55 		@GodotName("get_item_preview") GodotMethod!(Texture, long) getItemPreview;
56 		@GodotName("remove_item") GodotMethod!(void, long) removeItem;
57 		@GodotName("find_item_by_name") GodotMethod!(long, String) findItemByName;
58 		@GodotName("clear") GodotMethod!(void) clear;
59 		@GodotName("get_item_list") GodotMethod!(PoolIntArray) getItemList;
60 		@GodotName("get_last_unused_item_id") GodotMethod!(long) getLastUnusedItemId;
61 	}
62 	bool opEquals(in MeshLibrary other) const { return _godot_object.ptr is other._godot_object.ptr; }
63 	MeshLibrary opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
64 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
65 	mixin baseCasts;
66 	static MeshLibrary _new()
67 	{
68 		static godot_class_constructor constructor;
69 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("MeshLibrary");
70 		if(constructor is null) return typeof(this).init;
71 		return cast(MeshLibrary)(constructor());
72 	}
73 	@disable new(size_t s);
74 	/**
75 	Create a new item in the library, supplied an id.
76 	*/
77 	void createItem(in long id)
78 	{
79 		checkClassBinding!(typeof(this))();
80 		ptrcall!(void)(_classBinding.createItem, _godot_object, id);
81 	}
82 	/**
83 	Set the name of the item.
84 	*/
85 	void setItemName(StringArg1)(in long id, in StringArg1 name)
86 	{
87 		checkClassBinding!(typeof(this))();
88 		ptrcall!(void)(_classBinding.setItemName, _godot_object, id, name);
89 	}
90 	/**
91 	Set the mesh of the item.
92 	*/
93 	void setItemMesh(in long id, Mesh mesh)
94 	{
95 		checkClassBinding!(typeof(this))();
96 		ptrcall!(void)(_classBinding.setItemMesh, _godot_object, id, mesh);
97 	}
98 	/**
99 	
100 	*/
101 	void setItemNavmesh(in long id, NavigationMesh navmesh)
102 	{
103 		checkClassBinding!(typeof(this))();
104 		ptrcall!(void)(_classBinding.setItemNavmesh, _godot_object, id, navmesh);
105 	}
106 	/**
107 	
108 	*/
109 	void setItemShapes(in long id, in Array shapes)
110 	{
111 		checkClassBinding!(typeof(this))();
112 		ptrcall!(void)(_classBinding.setItemShapes, _godot_object, id, shapes);
113 	}
114 	/**
115 	
116 	*/
117 	void setItemPreview(in long id, Texture texture)
118 	{
119 		checkClassBinding!(typeof(this))();
120 		ptrcall!(void)(_classBinding.setItemPreview, _godot_object, id, texture);
121 	}
122 	/**
123 	Return the name of the item.
124 	*/
125 	String getItemName(in long id) const
126 	{
127 		checkClassBinding!(typeof(this))();
128 		return ptrcall!(String)(_classBinding.getItemName, _godot_object, id);
129 	}
130 	/**
131 	Return the mesh of the item.
132 	*/
133 	Ref!Mesh getItemMesh(in long id) const
134 	{
135 		checkClassBinding!(typeof(this))();
136 		return ptrcall!(Mesh)(_classBinding.getItemMesh, _godot_object, id);
137 	}
138 	/**
139 	
140 	*/
141 	Ref!NavigationMesh getItemNavmesh(in long id) const
142 	{
143 		checkClassBinding!(typeof(this))();
144 		return ptrcall!(NavigationMesh)(_classBinding.getItemNavmesh, _godot_object, id);
145 	}
146 	/**
147 	
148 	*/
149 	Array getItemShapes(in long id) const
150 	{
151 		checkClassBinding!(typeof(this))();
152 		return ptrcall!(Array)(_classBinding.getItemShapes, _godot_object, id);
153 	}
154 	/**
155 	
156 	*/
157 	Ref!Texture getItemPreview(in long id) const
158 	{
159 		checkClassBinding!(typeof(this))();
160 		return ptrcall!(Texture)(_classBinding.getItemPreview, _godot_object, id);
161 	}
162 	/**
163 	Remove the item.
164 	*/
165 	void removeItem(in long id)
166 	{
167 		checkClassBinding!(typeof(this))();
168 		ptrcall!(void)(_classBinding.removeItem, _godot_object, id);
169 	}
170 	/**
171 	
172 	*/
173 	long findItemByName(StringArg0)(in StringArg0 name) const
174 	{
175 		checkClassBinding!(typeof(this))();
176 		return ptrcall!(long)(_classBinding.findItemByName, _godot_object, name);
177 	}
178 	/**
179 	Clear the library.
180 	*/
181 	void clear()
182 	{
183 		checkClassBinding!(typeof(this))();
184 		ptrcall!(void)(_classBinding.clear, _godot_object);
185 	}
186 	/**
187 	Return the list of items.
188 	*/
189 	PoolIntArray getItemList() const
190 	{
191 		checkClassBinding!(typeof(this))();
192 		return ptrcall!(PoolIntArray)(_classBinding.getItemList, _godot_object);
193 	}
194 	/**
195 	Get an unused id for a new item.
196 	*/
197 	long getLastUnusedItemId() const
198 	{
199 		checkClassBinding!(typeof(this))();
200 		return ptrcall!(long)(_classBinding.getLastUnusedItemId, _godot_object);
201 	}
202 }