1 /** 2 A CSG Torus shape. 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.csgtorus; 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.csgprimitive; 25 import godot.csgshape; 26 import godot.geometryinstance; 27 import godot.material; 28 /** 29 A CSG Torus shape. 30 31 This node allows you to create a torus for use with the CSG system. 32 */ 33 @GodotBaseClass struct CSGTorus 34 { 35 package(godot) enum string _GODOT_internal_name = "CSGTorus"; 36 public: 37 @nogc nothrow: 38 union { /** */ godot_object _godot_object; /** */ CSGPrimitive _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_inner_radius") GodotMethod!(double) getInnerRadius; 46 @GodotName("get_material") GodotMethod!(Material) getMaterial; 47 @GodotName("get_outer_radius") GodotMethod!(double) getOuterRadius; 48 @GodotName("get_ring_sides") GodotMethod!(long) getRingSides; 49 @GodotName("get_sides") GodotMethod!(long) getSides; 50 @GodotName("get_smooth_faces") GodotMethod!(bool) getSmoothFaces; 51 @GodotName("set_inner_radius") GodotMethod!(void, double) setInnerRadius; 52 @GodotName("set_material") GodotMethod!(void, Material) setMaterial; 53 @GodotName("set_outer_radius") GodotMethod!(void, double) setOuterRadius; 54 @GodotName("set_ring_sides") GodotMethod!(void, long) setRingSides; 55 @GodotName("set_sides") GodotMethod!(void, long) setSides; 56 @GodotName("set_smooth_faces") GodotMethod!(void, bool) setSmoothFaces; 57 } 58 /// 59 pragma(inline, true) bool opEquals(in CSGTorus other) const 60 { return _godot_object.ptr is other._godot_object.ptr; } 61 /// 62 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 63 { _godot_object.ptr = n; return null; } 64 /// 65 pragma(inline, true) bool opEquals(typeof(null) n) const 66 { return _godot_object.ptr is n; } 67 /// 68 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 69 mixin baseCasts; 70 /// Construct a new instance of CSGTorus. 71 /// Note: use `memnew!CSGTorus` instead. 72 static CSGTorus _new() 73 { 74 static godot_class_constructor constructor; 75 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("CSGTorus"); 76 if(constructor is null) return typeof(this).init; 77 return cast(CSGTorus)(constructor()); 78 } 79 @disable new(size_t s); 80 /** 81 82 */ 83 double getInnerRadius() const 84 { 85 checkClassBinding!(typeof(this))(); 86 return ptrcall!(double)(GDNativeClassBinding.getInnerRadius, _godot_object); 87 } 88 /** 89 90 */ 91 Ref!Material getMaterial() const 92 { 93 checkClassBinding!(typeof(this))(); 94 return ptrcall!(Material)(GDNativeClassBinding.getMaterial, _godot_object); 95 } 96 /** 97 98 */ 99 double getOuterRadius() const 100 { 101 checkClassBinding!(typeof(this))(); 102 return ptrcall!(double)(GDNativeClassBinding.getOuterRadius, _godot_object); 103 } 104 /** 105 106 */ 107 long getRingSides() const 108 { 109 checkClassBinding!(typeof(this))(); 110 return ptrcall!(long)(GDNativeClassBinding.getRingSides, _godot_object); 111 } 112 /** 113 114 */ 115 long getSides() const 116 { 117 checkClassBinding!(typeof(this))(); 118 return ptrcall!(long)(GDNativeClassBinding.getSides, _godot_object); 119 } 120 /** 121 122 */ 123 bool getSmoothFaces() const 124 { 125 checkClassBinding!(typeof(this))(); 126 return ptrcall!(bool)(GDNativeClassBinding.getSmoothFaces, _godot_object); 127 } 128 /** 129 130 */ 131 void setInnerRadius(in double radius) 132 { 133 checkClassBinding!(typeof(this))(); 134 ptrcall!(void)(GDNativeClassBinding.setInnerRadius, _godot_object, radius); 135 } 136 /** 137 138 */ 139 void setMaterial(Material material) 140 { 141 checkClassBinding!(typeof(this))(); 142 ptrcall!(void)(GDNativeClassBinding.setMaterial, _godot_object, material); 143 } 144 /** 145 146 */ 147 void setOuterRadius(in double radius) 148 { 149 checkClassBinding!(typeof(this))(); 150 ptrcall!(void)(GDNativeClassBinding.setOuterRadius, _godot_object, radius); 151 } 152 /** 153 154 */ 155 void setRingSides(in long sides) 156 { 157 checkClassBinding!(typeof(this))(); 158 ptrcall!(void)(GDNativeClassBinding.setRingSides, _godot_object, sides); 159 } 160 /** 161 162 */ 163 void setSides(in long sides) 164 { 165 checkClassBinding!(typeof(this))(); 166 ptrcall!(void)(GDNativeClassBinding.setSides, _godot_object, sides); 167 } 168 /** 169 170 */ 171 void setSmoothFaces(in bool smooth_faces) 172 { 173 checkClassBinding!(typeof(this))(); 174 ptrcall!(void)(GDNativeClassBinding.setSmoothFaces, _godot_object, smooth_faces); 175 } 176 /** 177 The inner radius of the torus. 178 */ 179 @property double innerRadius() 180 { 181 return getInnerRadius(); 182 } 183 /// ditto 184 @property void innerRadius(double v) 185 { 186 setInnerRadius(v); 187 } 188 /** 189 The outer radius of the torus. 190 */ 191 @property double outerRadius() 192 { 193 return getOuterRadius(); 194 } 195 /// ditto 196 @property void outerRadius(double v) 197 { 198 setOuterRadius(v); 199 } 200 /** 201 The number of edges each ring of the torus is constructed of. 202 */ 203 @property long ringSides() 204 { 205 return getRingSides(); 206 } 207 /// ditto 208 @property void ringSides(long v) 209 { 210 setRingSides(v); 211 } 212 /** 213 The number of slices the torus is constructed of. 214 */ 215 @property long sides() 216 { 217 return getSides(); 218 } 219 /// ditto 220 @property void sides(long v) 221 { 222 setSides(v); 223 } 224 /** 225 If `true` the normals of the torus are set to give a smooth effect making the torus seem rounded. If `false` the torus will have a flat shaded look. 226 */ 227 @property bool smoothFaces() 228 { 229 return getSmoothFaces(); 230 } 231 /// ditto 232 @property void smoothFaces(bool v) 233 { 234 setSmoothFaces(v); 235 } 236 }