1 /** 2 Node that instances a $(D MultiMesh). 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.multimeshinstance; 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.geometryinstance; 24 import godot.multimesh; 25 import godot.visualinstance; 26 import godot.spatial; 27 import godot.node; 28 /** 29 Node that instances a $(D MultiMesh). 30 31 `MultiMeshInstance` is a specialized node to instance $(D GeometryInstance)s based on a $(D MultiMesh) resource. 32 This is useful to optimize the rendering of a high amount of instances of a given mesh (for example tree in a forest or grass strands). 33 */ 34 @GodotBaseClass struct MultiMeshInstance 35 { 36 enum string _GODOT_internal_name = "MultiMeshInstance"; 37 public: 38 @nogc nothrow: 39 union { godot_object _godot_object; GeometryInstance _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_multimesh") GodotMethod!(void, MultiMesh) setMultimesh; 47 @GodotName("get_multimesh") GodotMethod!(MultiMesh) getMultimesh; 48 } 49 bool opEquals(in MultiMeshInstance other) const { return _godot_object.ptr is other._godot_object.ptr; } 50 MultiMeshInstance opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 51 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 52 mixin baseCasts; 53 static MultiMeshInstance _new() 54 { 55 static godot_class_constructor constructor; 56 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("MultiMeshInstance"); 57 if(constructor is null) return typeof(this).init; 58 return cast(MultiMeshInstance)(constructor()); 59 } 60 @disable new(size_t s); 61 /** 62 63 */ 64 void setMultimesh(MultiMesh multimesh) 65 { 66 checkClassBinding!(typeof(this))(); 67 ptrcall!(void)(_classBinding.setMultimesh, _godot_object, multimesh); 68 } 69 /** 70 71 */ 72 Ref!MultiMesh getMultimesh() const 73 { 74 checkClassBinding!(typeof(this))(); 75 return ptrcall!(MultiMesh)(_classBinding.getMultimesh, _godot_object); 76 } 77 /** 78 The $(D MultiMesh) resource that will be used and shared among all instances of the `MultiMeshInstance`. 79 */ 80 @property MultiMesh multimesh() 81 { 82 return getMultimesh(); 83 } 84 /// ditto 85 @property void multimesh(MultiMesh v) 86 { 87 setMultimesh(v); 88 } 89 }