1 /** 2 Base class for all primitive meshes. Handles applying a $(D Material) to a primitive mesh. 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.primitivemesh; 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.mesh; 23 import godot.material; 24 import godot.resource; 25 import godot.reference; 26 /** 27 Base class for all primitive meshes. Handles applying a $(D Material) to a primitive mesh. 28 29 30 */ 31 @GodotBaseClass struct PrimitiveMesh 32 { 33 enum string _GODOT_internal_name = "PrimitiveMesh"; 34 public: 35 @nogc nothrow: 36 union { godot_object _godot_object; Mesh _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 _classBinding 41 { 42 __gshared: 43 @GodotName("_update") GodotMethod!(void) _update; 44 @GodotName("set_material") GodotMethod!(void, Material) setMaterial; 45 @GodotName("get_material") GodotMethod!(Material) getMaterial; 46 @GodotName("get_mesh_arrays") GodotMethod!(Array) getMeshArrays; 47 @GodotName("set_custom_aabb") GodotMethod!(void, AABB) setCustomAabb; 48 @GodotName("get_custom_aabb") GodotMethod!(AABB) getCustomAabb; 49 @GodotName("set_flip_faces") GodotMethod!(void, bool) setFlipFaces; 50 @GodotName("get_flip_faces") GodotMethod!(bool) getFlipFaces; 51 } 52 bool opEquals(in PrimitiveMesh other) const { return _godot_object.ptr is other._godot_object.ptr; } 53 PrimitiveMesh opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 54 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 55 mixin baseCasts; 56 static PrimitiveMesh _new() 57 { 58 static godot_class_constructor constructor; 59 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("PrimitiveMesh"); 60 if(constructor is null) return typeof(this).init; 61 return cast(PrimitiveMesh)(constructor()); 62 } 63 @disable new(size_t s); 64 /** 65 66 */ 67 void _update() const 68 { 69 Array _GODOT_args = Array.empty_array; 70 String _GODOT_method_name = String("_update"); 71 this.callv(_GODOT_method_name, _GODOT_args); 72 } 73 /** 74 75 */ 76 void setMaterial(Material material) 77 { 78 checkClassBinding!(typeof(this))(); 79 ptrcall!(void)(_classBinding.setMaterial, _godot_object, material); 80 } 81 /** 82 83 */ 84 Ref!Material getMaterial() const 85 { 86 checkClassBinding!(typeof(this))(); 87 return ptrcall!(Material)(_classBinding.getMaterial, _godot_object); 88 } 89 /** 90 91 */ 92 Array getMeshArrays() const 93 { 94 checkClassBinding!(typeof(this))(); 95 return ptrcall!(Array)(_classBinding.getMeshArrays, _godot_object); 96 } 97 /** 98 99 */ 100 void setCustomAabb(in AABB aabb) 101 { 102 checkClassBinding!(typeof(this))(); 103 ptrcall!(void)(_classBinding.setCustomAabb, _godot_object, aabb); 104 } 105 /** 106 107 */ 108 AABB getCustomAabb() const 109 { 110 checkClassBinding!(typeof(this))(); 111 return ptrcall!(AABB)(_classBinding.getCustomAabb, _godot_object); 112 } 113 /** 114 115 */ 116 void setFlipFaces(in bool flip_faces) 117 { 118 checkClassBinding!(typeof(this))(); 119 ptrcall!(void)(_classBinding.setFlipFaces, _godot_object, flip_faces); 120 } 121 /** 122 123 */ 124 bool getFlipFaces() const 125 { 126 checkClassBinding!(typeof(this))(); 127 return ptrcall!(bool)(_classBinding.getFlipFaces, _godot_object); 128 } 129 /** 130 131 */ 132 @property AABB customAabb() 133 { 134 return getCustomAabb(); 135 } 136 /// ditto 137 @property void customAabb(AABB v) 138 { 139 setCustomAabb(v); 140 } 141 /** 142 143 */ 144 @property bool flipFaces() 145 { 146 return getFlipFaces(); 147 } 148 /// ditto 149 @property void flipFaces(bool v) 150 { 151 setFlipFaces(v); 152 } 153 }