1 /** 2 Class representing a planar $(D PrimitiveMesh). 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.planemesh; 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.primitivemesh; 25 /** 26 Class representing a planar $(D PrimitiveMesh). 27 28 This flat mesh does not have a thickness. By default, this mesh is aligned on the X and Z axes; this default rotation isn't suited for use with billboarded materials. For billboarded materials, use $(D QuadMesh) instead. 29 $(B Note:) When using a large textured $(D PlaneMesh) (e.g. as a floor), you may stumble upon UV jittering issues depending on the camera angle. To solve this, increase $(D subdivideDepth) and $(D subdivideWidth) until you no longer notice UV jittering. 30 */ 31 @GodotBaseClass struct PlaneMesh 32 { 33 package(godot) enum string _GODOT_internal_name = "PlaneMesh"; 34 public: 35 @nogc nothrow: 36 union { /** */ godot_object _godot_object; /** */ PrimitiveMesh _GODOT_base; } 37 alias _GODOT_base this; 38 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 39 package(godot) __gshared bool _classBindingInitialized = false; 40 package(godot) static struct GDNativeClassBinding 41 { 42 __gshared: 43 @GodotName("get_size") GodotMethod!(Vector2) getSize; 44 @GodotName("get_subdivide_depth") GodotMethod!(long) getSubdivideDepth; 45 @GodotName("get_subdivide_width") GodotMethod!(long) getSubdivideWidth; 46 @GodotName("set_size") GodotMethod!(void, Vector2) setSize; 47 @GodotName("set_subdivide_depth") GodotMethod!(void, long) setSubdivideDepth; 48 @GodotName("set_subdivide_width") GodotMethod!(void, long) setSubdivideWidth; 49 } 50 /// 51 pragma(inline, true) bool opEquals(in PlaneMesh 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 PlaneMesh. 63 /// Note: use `memnew!PlaneMesh` instead. 64 static PlaneMesh _new() 65 { 66 static godot_class_constructor constructor; 67 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("PlaneMesh"); 68 if(constructor is null) return typeof(this).init; 69 return cast(PlaneMesh)(constructor()); 70 } 71 @disable new(size_t s); 72 /** 73 74 */ 75 Vector2 getSize() const 76 { 77 checkClassBinding!(typeof(this))(); 78 return ptrcall!(Vector2)(GDNativeClassBinding.getSize, _godot_object); 79 } 80 /** 81 82 */ 83 long getSubdivideDepth() const 84 { 85 checkClassBinding!(typeof(this))(); 86 return ptrcall!(long)(GDNativeClassBinding.getSubdivideDepth, _godot_object); 87 } 88 /** 89 90 */ 91 long getSubdivideWidth() const 92 { 93 checkClassBinding!(typeof(this))(); 94 return ptrcall!(long)(GDNativeClassBinding.getSubdivideWidth, _godot_object); 95 } 96 /** 97 98 */ 99 void setSize(in Vector2 size) 100 { 101 checkClassBinding!(typeof(this))(); 102 ptrcall!(void)(GDNativeClassBinding.setSize, _godot_object, size); 103 } 104 /** 105 106 */ 107 void setSubdivideDepth(in long subdivide) 108 { 109 checkClassBinding!(typeof(this))(); 110 ptrcall!(void)(GDNativeClassBinding.setSubdivideDepth, _godot_object, subdivide); 111 } 112 /** 113 114 */ 115 void setSubdivideWidth(in long subdivide) 116 { 117 checkClassBinding!(typeof(this))(); 118 ptrcall!(void)(GDNativeClassBinding.setSubdivideWidth, _godot_object, subdivide); 119 } 120 /** 121 Size of the generated plane. 122 */ 123 @property Vector2 size() 124 { 125 return getSize(); 126 } 127 /// ditto 128 @property void size(Vector2 v) 129 { 130 setSize(v); 131 } 132 /** 133 Number of subdivision along the Z axis. 134 */ 135 @property long subdivideDepth() 136 { 137 return getSubdivideDepth(); 138 } 139 /// ditto 140 @property void subdivideDepth(long v) 141 { 142 setSubdivideDepth(v); 143 } 144 /** 145 Number of subdivision along the X axis. 146 */ 147 @property long subdivideWidth() 148 { 149 return getSubdivideWidth(); 150 } 151 /// ditto 152 @property void subdivideWidth(long v) 153 { 154 setSubdivideWidth(v); 155 } 156 }