Debian Codegraph @

scene/resources/multimesh.cpp

raw symbols SCIP
1 /**************************************************************************/
2 /* multimesh.cpp */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10 /* */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the */
13 /* "Software"), to deal in the Software without restriction, including */
14 /* without limitation the rights to use, copy, modify, merge, publish, */
15 /* distribute, sublicense, and/or sell copies of the Software, and to */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions: */
18 /* */
19 /* The above copyright notice and this permission notice shall be */
20 /* included in all copies or substantial portions of the Software. */
21 /* */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29 /**************************************************************************/
30
31 #include "multimesh.h"
32
33 #include "servers/rendering/rendering_server.h"
34
35 #ifndef DISABLE_DEPRECATED
36 // Kept for compatibility from 3.x to 4.0.
37
38 void MultiMesh::_set_transform_array(const Vector<Vector3> &p_array) {
39 if (transform_format != TRANSFORM_3D) {
40 return;
41 }
42
43 const Vector<Vector3> &xforms = p_array;
44 int len = xforms.size();
45 ERR_FAIL_COND((len / 4) != instance_count);
46 if (len == 0) {
47 return;
48 }
49
50 const Vector3 *r = xforms.ptr();
51
52 for (int i = 0; i < len / 4; i++) {
53 Transform3D t;
54 t.basis[0] = r[i * 4 + 0];
55 t.basis[1] = r[i * 4 + 1];
56 t.basis[2] = r[i * 4 + 2];
57 t.origin = r[i * 4 + 3];
58
59 set_instance_transform(i, t);
60 }
61 }
62
63 Vector<Vector3> MultiMesh::_get_transform_array() const {
64 if (transform_format != TRANSFORM_3D) {
65 return Vector<Vector3>();
66 }
67
68 if (instance_count == 0) {
69 return Vector<Vector3>();
70 }
71
72 Vector<Vector3> xforms;
73 xforms.resize(instance_count * 4);
74
75 Vector3 *w = xforms.ptrw();
76
77 for (int i = 0; i < instance_count; i++) {
78 Transform3D t = get_instance_transform(i);
79 w[i * 4 + 0] = t.basis[0];
80 w[i * 4 + 1] = t.basis[1];
81 w[i * 4 + 2] = t.basis[2];
82 w[i * 4 + 3] = t.origin;
83 }
84
85 return xforms;
86 }
87
88 void MultiMesh::_set_transform_2d_array(const Vector<Vector2> &p_array) {
89 if (transform_format != TRANSFORM_2D) {
90 return;
91 }
92
93 const Vector<Vector2> &xforms = p_array;
94 int len = xforms.size();
95 ERR_FAIL_COND((len / 3) != instance_count);
96 if (len == 0) {
97 return;
98 }
99
100 const Vector2 *r = xforms.ptr();
101
102 for (int i = 0; i < len / 3; i++) {
103 Transform2D t;
104 t.columns[0] = r[i * 3 + 0];
105 t.columns[1] = r[i * 3 + 1];
106 t.columns[2] = r[i * 3 + 2];
107
108 set_instance_transform_2d(i, t);
109 }
110 }
111
112 Vector<Vector2> MultiMesh::_get_transform_2d_array() const {
113 if (transform_format != TRANSFORM_2D) {
114 return Vector<Vector2>();
115 }
116
117 if (instance_count == 0) {
118 return Vector<Vector2>();
119 }
120
121 Vector<Vector2> xforms;
122 xforms.resize(instance_count * 3);
123
124 Vector2 *w = xforms.ptrw();
125
126 for (int i = 0; i < instance_count; i++) {
127 Transform2D t = get_instance_transform_2d(i);
128 w[i * 3 + 0] = t.columns[0];
129 w[i * 3 + 1] = t.columns[1];
130 w[i * 3 + 2] = t.columns[2];
131 }
132
133 return xforms;
134 }
135
136 void MultiMesh::_set_color_array(const Vector<Color> &p_array) {
137 const Vector<Color> &colors = p_array;
138 int len = colors.size();
139 if (len == 0) {
140 return;
141 }
142 ERR_FAIL_COND(len != instance_count);
143
144 const Color *r = colors.ptr();
145
146 for (int i = 0; i < len; i++) {
147 set_instance_color(i, r[i]);
148 }
149 }
150
151 Vector<Color> MultiMesh::_get_color_array() const {
152 if (instance_count == 0 || !use_colors) {
153 return Vector<Color>();
154 }
155
156 Vector<Color> colors;
157 colors.resize(instance_count);
158
159 for (int i = 0; i < instance_count; i++) {
160 colors.set(i, get_instance_color(i));
161 }
162
163 return colors;
164 }
165
166 void MultiMesh::_set_custom_data_array(const Vector<Color> &p_array) {
167 const Vector<Color> &custom_datas = p_array;
168 int len = custom_datas.size();
169 if (len == 0) {
170 return;
171 }
172 ERR_FAIL_COND(len != instance_count);
173
174 const Color *r = custom_datas.ptr();
175
176 for (int i = 0; i < len; i++) {
177 set_instance_custom_data(i, r[i]);
178 }
179 }
180
181 Vector<Color> MultiMesh::_get_custom_data_array() const {
182 if (instance_count == 0 || !use_custom_data) {
183 return Vector<Color>();
184 }
185
186 Vector<Color> custom_datas;
187 custom_datas.resize(instance_count);
188
189 for (int i = 0; i < instance_count; i++) {
190 custom_datas.set(i, get_instance_custom_data(i));
191 }
192
193 return custom_datas;
194 }
195 #endif // DISABLE_DEPRECATED
196
197 void MultiMesh::set_buffer(const Vector<float> &p_buffer) {
198 if (instance_count == 0) {
199 return;
200 }
201
202 uint32_t stride = transform_format == TRANSFORM_2D ? 8 : 12;
203 stride += use_colors ? 4 : 0;
204 stride += use_custom_data ? 4 : 0;
205 ERR_FAIL_COND_MSG(stride * instance_count != p_buffer.size(), "Cannot set a buffer on a Multimesh that is a different size from the Multimesh's existing buffer.");
206
207 RS::get_singleton()->multimesh_set_buffer(multimesh, p_buffer);
208 }
209
210 Vector<float> MultiMesh::get_buffer() const {
211 return RS::get_singleton()->multimesh_get_buffer(multimesh);
212 }
213
214 void MultiMesh::set_buffer_interpolated(const Vector<float> &p_buffer_curr, const Vector<float> &p_buffer_prev) {
215 RS::get_singleton()->multimesh_set_buffer_interpolated(multimesh, p_buffer_curr, p_buffer_prev);
216 }
217
218 void MultiMesh::set_mesh(const Ref<Mesh> &p_mesh) {
219 mesh = p_mesh;
220 if (mesh.is_valid()) {
221 RenderingServer::get_singleton()->multimesh_set_mesh(multimesh, mesh->get_rid());
222 } else {
223 RenderingServer::get_singleton()->multimesh_set_mesh(multimesh, RID());
224 }
225 }
226
227 Ref<Mesh> MultiMesh::get_mesh() const {
228 return mesh;
229 }
230
231 void MultiMesh::set_instance_count(int p_count) {
232 ERR_FAIL_COND(p_count < 0);
233 RenderingServer::get_singleton()->multimesh_allocate_data(multimesh, p_count, RS::MultimeshTransformFormat(transform_format), use_colors, use_custom_data);
234 instance_count = p_count;
235 }
236
237 int MultiMesh::get_instance_count() const {
238 return instance_count;
239 }
240
241 void MultiMesh::set_visible_instance_count(int p_count) {
242 ERR_FAIL_COND(p_count < -1);
243 ERR_FAIL_COND(p_count > instance_count);
244 RenderingServer::get_singleton()->multimesh_set_visible_instances(multimesh, p_count);
245 visible_instance_count = p_count;
246 }
247
248 int MultiMesh::get_visible_instance_count() const {
249 return visible_instance_count;
250 }
251
252 void MultiMesh::set_physics_interpolation_quality(PhysicsInterpolationQuality p_quality) {
253 _physics_interpolation_quality = p_quality;
254 RenderingServer::get_singleton()->multimesh_set_physics_interpolation_quality(multimesh, (RS::MultimeshPhysicsInterpolationQuality)p_quality);
255 }
256
257 void MultiMesh::set_instance_transform(int p_instance, const Transform3D &p_transform) {
258 ERR_FAIL_INDEX_MSG(p_instance, instance_count, "Instance index out of bounds. Instance index must be less than `instance_count` and greater than or equal to zero.");
259 ERR_FAIL_COND_MSG(transform_format == TRANSFORM_2D, "Can't set Transform3D on a Multimesh configured to use Transform2D. Ensure that you have set the `transform_format` to `TRANSFORM_3D`.");
260 RenderingServer::get_singleton()->multimesh_instance_set_transform(multimesh, p_instance, p_transform);
261 }
262
263 void MultiMesh::set_instance_transform_2d(int p_instance, const Transform2D &p_transform) {
264 ERR_FAIL_INDEX_MSG(p_instance, instance_count, "Instance index out of bounds. Instance index must be less than `instance_count` and greater than or equal to zero.");
265 ERR_FAIL_COND_MSG(transform_format == TRANSFORM_3D, "Can't set Transform2D on a Multimesh configured to use Transform3D. Ensure that you have set the `transform_format` to `TRANSFORM_2D`.");
266 RenderingServer::get_singleton()->multimesh_instance_set_transform_2d(multimesh, p_instance, p_transform);
267 emit_changed();
268 }
269
270 Transform3D MultiMesh::get_instance_transform(int p_instance) const {
271 ERR_FAIL_INDEX_V_MSG(p_instance, instance_count, Transform3D(), "Instance index out of bounds. Instance index must be less than `instance_count` and greater than or equal to zero.");
272 ERR_FAIL_COND_V_MSG(transform_format == TRANSFORM_2D, Transform3D(), "Can't get Transform3D on a Multimesh configured to use Transform2D. Ensure that you have set the `transform_format` to `TRANSFORM_3D`.");
273 return RenderingServer::get_singleton()->multimesh_instance_get_transform(multimesh, p_instance);
274 }
275
276 Transform2D MultiMesh::get_instance_transform_2d(int p_instance) const {
277 ERR_FAIL_INDEX_V_MSG(p_instance, instance_count, Transform2D(), "Instance index out of bounds. Instance index must be less than `instance_count` and greater than or equal to zero.");
278 ERR_FAIL_COND_V_MSG(transform_format == TRANSFORM_3D, Transform2D(), "Can't get Transform2D on a Multimesh configured to use Transform3D. Ensure that you have set the `transform_format` to `TRANSFORM_2D`.");
279 return RenderingServer::get_singleton()->multimesh_instance_get_transform_2d(multimesh, p_instance);
280 }
281
282 void MultiMesh::set_instance_color(int p_instance, const Color &p_color) {
283 ERR_FAIL_INDEX_MSG(p_instance, instance_count, "Instance index out of bounds. Instance index must be less than `instance_count` and greater than or equal to zero.");
284 ERR_FAIL_COND_MSG(!use_colors, "Can't set instance color on a Multimesh that isn't using colors. Ensure that you have `use_colors` property of this Multimesh set to `true`.");
285 RenderingServer::get_singleton()->multimesh_instance_set_color(multimesh, p_instance, p_color);
286 }
287
288 Color MultiMesh::get_instance_color(int p_instance) const {
289 ERR_FAIL_INDEX_V_MSG(p_instance, instance_count, Color(), "Instance index out of bounds. Instance index must be less than `instance_count` and greater than or equal to zero.");
290 ERR_FAIL_COND_V_MSG(!use_colors, Color(), "Can't get instance color on a Multimesh that isn't using colors. Ensure that you have `use_colors` property of this Multimesh set to `true`.");
291 return RenderingServer::get_singleton()->multimesh_instance_get_color(multimesh, p_instance);
292 }
293
294 void MultiMesh::set_instance_custom_data(int p_instance, const Color &p_custom_data) {
295 ERR_FAIL_INDEX_MSG(p_instance, instance_count, "Instance index out of bounds. Instance index must be less than `instance_count` and greater than or equal to zero.");
296 ERR_FAIL_COND_MSG(!use_custom_data, "Can't get instance custom data on a Multimesh that isn't using custom data. Ensure that you have `use_custom_data` property of this Multimesh set to `true`.");
297 RenderingServer::get_singleton()->multimesh_instance_set_custom_data(multimesh, p_instance, p_custom_data);
298 }
299
300 Color MultiMesh::get_instance_custom_data(int p_instance) const {
301 ERR_FAIL_INDEX_V_MSG(p_instance, instance_count, Color(), "Instance index out of bounds. Instance index must be less than `instance_count` and greater than or equal to zero.");
302 ERR_FAIL_COND_V_MSG(!use_custom_data, Color(), "Can't get instance custom data on a Multimesh that isn't using custom data. Ensure that you have `use_custom_data` property of this Multimesh set to `true`.");
303 return RenderingServer::get_singleton()->multimesh_instance_get_custom_data(multimesh, p_instance);
304 }
305
306 void MultiMesh::reset_instance_physics_interpolation(int p_instance) {
307 ERR_FAIL_INDEX_MSG(p_instance, instance_count, "Instance index out of bounds. Instance index must be less than `instance_count` and greater than or equal to zero.");
308 RenderingServer::get_singleton()->multimesh_instance_reset_physics_interpolation(multimesh, p_instance);
309 }
310
311 void MultiMesh::reset_instances_physics_interpolation() {
312 RenderingServer::get_singleton()->multimesh_instances_reset_physics_interpolation(multimesh);
313 }
314
315 void MultiMesh::set_physics_interpolated(bool p_interpolated) {
316 RenderingServer::get_singleton()->multimesh_set_physics_interpolated(multimesh, p_interpolated);
317 }
318
319 void MultiMesh::set_custom_aabb(const AABB &p_custom) {
320 custom_aabb = p_custom;
321 RS::get_singleton()->multimesh_set_custom_aabb(multimesh, custom_aabb);
322 emit_changed();
323 }
324
325 AABB MultiMesh::get_custom_aabb() const {
326 return custom_aabb;
327 }
328
329 AABB MultiMesh::get_aabb() const {
330 return RenderingServer::get_singleton()->multimesh_get_aabb(multimesh);
331 }
332
333 RID MultiMesh::get_rid() const {
334 return multimesh;
335 }
336
337 void MultiMesh::set_use_colors(bool p_enable) {
338 ERR_FAIL_COND_MSG(instance_count > 0, "Instance count must be 0 to toggle whether colors are used.");
339 use_colors = p_enable;
340 }
341
342 bool MultiMesh::is_using_colors() const {
343 return use_colors;
344 }
345
346 void MultiMesh::set_use_custom_data(bool p_enable) {
347 ERR_FAIL_COND_MSG(instance_count > 0, "Instance count must be 0 to toggle whether custom data is used.");
348 use_custom_data = p_enable;
349 }
350
351 bool MultiMesh::is_using_custom_data() const {
352 return use_custom_data;
353 }
354
355 void MultiMesh::set_transform_format(TransformFormat p_transform_format) {
356 ERR_FAIL_COND_MSG(instance_count > 0, "Instance count must be 0 to change the transform format.");
357 transform_format = p_transform_format;
358 }
359
360 MultiMesh::TransformFormat MultiMesh::get_transform_format() const {
361 return transform_format;
362 }
363
364 void MultiMesh::_bind_methods() {
365 ClassDB::bind_method(D_METHOD("set_mesh", "mesh"), &MultiMesh::set_mesh);
366 ClassDB::bind_method(D_METHOD("get_mesh"), &MultiMesh::get_mesh);
367 ClassDB::bind_method(D_METHOD("set_use_colors", "enable"), &MultiMesh::set_use_colors);
368 ClassDB::bind_method(D_METHOD("is_using_colors"), &MultiMesh::is_using_colors);
369 ClassDB::bind_method(D_METHOD("set_use_custom_data", "enable"), &MultiMesh::set_use_custom_data);
370 ClassDB::bind_method(D_METHOD("is_using_custom_data"), &MultiMesh::is_using_custom_data);
371 ClassDB::bind_method(D_METHOD("set_transform_format", "format"), &MultiMesh::set_transform_format);
372 ClassDB::bind_method(D_METHOD("get_transform_format"), &MultiMesh::get_transform_format);
373
374 ClassDB::bind_method(D_METHOD("set_instance_count", "count"), &MultiMesh::set_instance_count);
375 ClassDB::bind_method(D_METHOD("get_instance_count"), &MultiMesh::get_instance_count);
376 ClassDB::bind_method(D_METHOD("set_visible_instance_count", "count"), &MultiMesh::set_visible_instance_count);
377 ClassDB::bind_method(D_METHOD("get_visible_instance_count"), &MultiMesh::get_visible_instance_count);
378 ClassDB::bind_method(D_METHOD("set_physics_interpolation_quality", "quality"), &MultiMesh::set_physics_interpolation_quality);
379 ClassDB::bind_method(D_METHOD("get_physics_interpolation_quality"), &MultiMesh::get_physics_interpolation_quality);
380 ClassDB::bind_method(D_METHOD("set_instance_transform", "instance", "transform"), &MultiMesh::set_instance_transform);
381 ClassDB::bind_method(D_METHOD("set_instance_transform_2d", "instance", "transform"), &MultiMesh::set_instance_transform_2d);
382 ClassDB::bind_method(D_METHOD("get_instance_transform", "instance"), &MultiMesh::get_instance_transform);
383 ClassDB::bind_method(D_METHOD("get_instance_transform_2d", "instance"), &MultiMesh::get_instance_transform_2d);
384 ClassDB::bind_method(D_METHOD("set_instance_color", "instance", "color"), &MultiMesh::set_instance_color);
385 ClassDB::bind_method(D_METHOD("get_instance_color", "instance"), &MultiMesh::get_instance_color);
386 ClassDB::bind_method(D_METHOD("set_instance_custom_data", "instance", "custom_data"), &MultiMesh::set_instance_custom_data);
387 ClassDB::bind_method(D_METHOD("get_instance_custom_data", "instance"), &MultiMesh::get_instance_custom_data);
388 ClassDB::bind_method(D_METHOD("reset_instance_physics_interpolation", "instance"), &MultiMesh::reset_instance_physics_interpolation);
389 ClassDB::bind_method(D_METHOD("reset_instances_physics_interpolation"), &MultiMesh::reset_instances_physics_interpolation);
390 ClassDB::bind_method(D_METHOD("set_custom_aabb", "aabb"), &MultiMesh::set_custom_aabb);
391 ClassDB::bind_method(D_METHOD("get_custom_aabb"), &MultiMesh::get_custom_aabb);
392 ClassDB::bind_method(D_METHOD("get_aabb"), &MultiMesh::get_aabb);
393
394 ClassDB::bind_method(D_METHOD("get_buffer"), &MultiMesh::get_buffer);
395 ClassDB::bind_method(D_METHOD("set_buffer", "buffer"), &MultiMesh::set_buffer);
396
397 ClassDB::bind_method(D_METHOD("set_buffer_interpolated", "buffer_curr", "buffer_prev"), &MultiMesh::set_buffer_interpolated);
398
399 ADD_PROPERTY(PropertyInfo(Variant::INT, "transform_format", PROPERTY_HINT_ENUM, "2D,3D"), "set_transform_format", "get_transform_format");
400 ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_colors"), "set_use_colors", "is_using_colors");
401 ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_custom_data"), "set_use_custom_data", "is_using_custom_data");
402 ADD_PROPERTY(PropertyInfo(Variant::AABB, "custom_aabb", PROPERTY_HINT_NONE, "suffix:m"), "set_custom_aabb", "get_custom_aabb");
403 ADD_PROPERTY(PropertyInfo(Variant::INT, "instance_count", PROPERTY_HINT_RANGE, "0,16384,1,or_greater"), "set_instance_count", "get_instance_count");
404 ADD_PROPERTY(PropertyInfo(Variant::INT, "visible_instance_count", PROPERTY_HINT_RANGE, "-1,16384,1,or_greater"), "set_visible_instance_count", "get_visible_instance_count");
405 ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "mesh", PROPERTY_HINT_RESOURCE_TYPE, "Mesh"), "set_mesh", "get_mesh");
406 ADD_PROPERTY(PropertyInfo(Variant::PACKED_FLOAT32_ARRAY, "buffer", PROPERTY_HINT_NONE), "set_buffer", "get_buffer");
407
408 #ifndef DISABLE_DEPRECATED
409 // Kept for compatibility from 3.x to 4.0.
410 ClassDB::bind_method(D_METHOD("_set_transform_array", "array"), &MultiMesh::_set_transform_array);
411 ClassDB::bind_method(D_METHOD("_get_transform_array"), &MultiMesh::_get_transform_array);
412 ClassDB::bind_method(D_METHOD("_set_transform_2d_array", "array"), &MultiMesh::_set_transform_2d_array);
413 ClassDB::bind_method(D_METHOD("_get_transform_2d_array"), &MultiMesh::_get_transform_2d_array);
414 ClassDB::bind_method(D_METHOD("_set_color_array", "array"), &MultiMesh::_set_color_array);
415 ClassDB::bind_method(D_METHOD("_get_color_array"), &MultiMesh::_get_color_array);
416 ClassDB::bind_method(D_METHOD("_set_custom_data_array", "array"), &MultiMesh::_set_custom_data_array);
417 ClassDB::bind_method(D_METHOD("_get_custom_data_array"), &MultiMesh::_get_custom_data_array);
418
419 ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR3_ARRAY, "transform_array", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "_set_transform_array", "_get_transform_array");
420 ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "transform_2d_array", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "_set_transform_2d_array", "_get_transform_2d_array");
421 ADD_PROPERTY(PropertyInfo(Variant::PACKED_COLOR_ARRAY, "color_array", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "_set_color_array", "_get_color_array");
422 ADD_PROPERTY(PropertyInfo(Variant::PACKED_COLOR_ARRAY, "custom_data_array", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "_set_custom_data_array", "_get_custom_data_array");
423 #endif
424
425 ADD_GROUP("Physics Interpolation", "physics_interpolation");
426 ADD_PROPERTY(PropertyInfo(Variant::INT, "physics_interpolation_quality", PROPERTY_HINT_ENUM, "Fast,High"), "set_physics_interpolation_quality", "get_physics_interpolation_quality");
427
428 BIND_ENUM_CONSTANT(TRANSFORM_2D);
429 BIND_ENUM_CONSTANT(TRANSFORM_3D);
430
431 BIND_ENUM_CONSTANT(INTERP_QUALITY_FAST);
432 BIND_ENUM_CONSTANT(INTERP_QUALITY_HIGH);
433 }
434
435 MultiMesh::MultiMesh() {
436 multimesh = RenderingServer::get_singleton()->multimesh_create();
437 }
438
439 MultiMesh::~MultiMesh() {
440 ERR_FAIL_NULL(RenderingServer::get_singleton());
441 RenderingServer::get_singleton()->free_rid(multimesh);
442 }