1 /** 2 Node that instances a $(D MultiMesh) in 2D. 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.multimeshinstance2d; 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.node2d; 25 import godot.multimesh; 26 import godot.texture; 27 /** 28 Node that instances a $(D MultiMesh) in 2D. 29 30 $(D MultiMeshInstance2D) is a specialized node to instance a $(D MultiMesh) resource in 2D. 31 Usage is the same as $(D MultiMeshInstance). 32 */ 33 @GodotBaseClass struct MultiMeshInstance2D 34 { 35 package(godot) enum string _GODOT_internal_name = "MultiMeshInstance2D"; 36 public: 37 @nogc nothrow: 38 union { /** */ godot_object _godot_object; /** */ Node2D _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 GDNativeClassBinding 43 { 44 __gshared: 45 @GodotName("get_multimesh") GodotMethod!(MultiMesh) getMultimesh; 46 @GodotName("get_normal_map") GodotMethod!(Texture) getNormalMap; 47 @GodotName("get_texture") GodotMethod!(Texture) getTexture; 48 @GodotName("set_multimesh") GodotMethod!(void, MultiMesh) setMultimesh; 49 @GodotName("set_normal_map") GodotMethod!(void, Texture) setNormalMap; 50 @GodotName("set_texture") GodotMethod!(void, Texture) setTexture; 51 } 52 /// 53 pragma(inline, true) bool opEquals(in MultiMeshInstance2D other) const 54 { return _godot_object.ptr is other._godot_object.ptr; } 55 /// 56 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 57 { _godot_object.ptr = n; return null; } 58 /// 59 pragma(inline, true) bool opEquals(typeof(null) n) const 60 { return _godot_object.ptr is n; } 61 /// 62 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 63 mixin baseCasts; 64 /// Construct a new instance of MultiMeshInstance2D. 65 /// Note: use `memnew!MultiMeshInstance2D` instead. 66 static MultiMeshInstance2D _new() 67 { 68 static godot_class_constructor constructor; 69 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("MultiMeshInstance2D"); 70 if(constructor is null) return typeof(this).init; 71 return cast(MultiMeshInstance2D)(constructor()); 72 } 73 @disable new(size_t s); 74 /** 75 76 */ 77 Ref!MultiMesh getMultimesh() const 78 { 79 checkClassBinding!(typeof(this))(); 80 return ptrcall!(MultiMesh)(GDNativeClassBinding.getMultimesh, _godot_object); 81 } 82 /** 83 84 */ 85 Ref!Texture getNormalMap() const 86 { 87 checkClassBinding!(typeof(this))(); 88 return ptrcall!(Texture)(GDNativeClassBinding.getNormalMap, _godot_object); 89 } 90 /** 91 92 */ 93 Ref!Texture getTexture() const 94 { 95 checkClassBinding!(typeof(this))(); 96 return ptrcall!(Texture)(GDNativeClassBinding.getTexture, _godot_object); 97 } 98 /** 99 100 */ 101 void setMultimesh(MultiMesh multimesh) 102 { 103 checkClassBinding!(typeof(this))(); 104 ptrcall!(void)(GDNativeClassBinding.setMultimesh, _godot_object, multimesh); 105 } 106 /** 107 108 */ 109 void setNormalMap(Texture normal_map) 110 { 111 checkClassBinding!(typeof(this))(); 112 ptrcall!(void)(GDNativeClassBinding.setNormalMap, _godot_object, normal_map); 113 } 114 /** 115 116 */ 117 void setTexture(Texture texture) 118 { 119 checkClassBinding!(typeof(this))(); 120 ptrcall!(void)(GDNativeClassBinding.setTexture, _godot_object, texture); 121 } 122 /** 123 The $(D MultiMesh) that will be drawn by the $(D MultiMeshInstance2D). 124 */ 125 @property MultiMesh multimesh() 126 { 127 return getMultimesh(); 128 } 129 /// ditto 130 @property void multimesh(MultiMesh v) 131 { 132 setMultimesh(v); 133 } 134 /** 135 The normal map that will be used if using the default $(D CanvasItemMaterial). 136 $(B Note:) Godot expects the normal map to use X+, Y-, and Z+ coordinates. See $(D url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates)this page$(D /url) for a comparison of normal map coordinates expected by popular engines. 137 */ 138 @property Texture normalMap() 139 { 140 return getNormalMap(); 141 } 142 /// ditto 143 @property void normalMap(Texture v) 144 { 145 setNormalMap(v); 146 } 147 /** 148 The $(D Texture) that will be used if using the default $(D CanvasItemMaterial). Can be accessed as `TEXTURE` in CanvasItem shader. 149 */ 150 @property Texture texture() 151 { 152 return getTexture(); 153 } 154 /// ditto 155 @property void texture(Texture v) 156 { 157 setTexture(v); 158 } 159 }