1 /** 2 A CSG Sphere 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.csgsphere; 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 Sphere shape. 30 31 This node allows you to create a sphere for use with the CSG system. 32 */ 33 @GodotBaseClass struct CSGSphere 34 { 35 package(godot) enum string _GODOT_internal_name = "CSGSphere"; 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_material") GodotMethod!(Material) getMaterial; 46 @GodotName("get_radial_segments") GodotMethod!(long) getRadialSegments; 47 @GodotName("get_radius") GodotMethod!(double) getRadius; 48 @GodotName("get_rings") GodotMethod!(long) getRings; 49 @GodotName("get_smooth_faces") GodotMethod!(bool) getSmoothFaces; 50 @GodotName("set_material") GodotMethod!(void, Material) setMaterial; 51 @GodotName("set_radial_segments") GodotMethod!(void, long) setRadialSegments; 52 @GodotName("set_radius") GodotMethod!(void, double) setRadius; 53 @GodotName("set_rings") GodotMethod!(void, long) setRings; 54 @GodotName("set_smooth_faces") GodotMethod!(void, bool) setSmoothFaces; 55 } 56 /// 57 pragma(inline, true) bool opEquals(in CSGSphere other) const 58 { return _godot_object.ptr is other._godot_object.ptr; } 59 /// 60 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 61 { _godot_object.ptr = n; return null; } 62 /// 63 pragma(inline, true) bool opEquals(typeof(null) n) const 64 { return _godot_object.ptr is n; } 65 /// 66 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 67 mixin baseCasts; 68 /// Construct a new instance of CSGSphere. 69 /// Note: use `memnew!CSGSphere` instead. 70 static CSGSphere _new() 71 { 72 static godot_class_constructor constructor; 73 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("CSGSphere"); 74 if(constructor is null) return typeof(this).init; 75 return cast(CSGSphere)(constructor()); 76 } 77 @disable new(size_t s); 78 /** 79 80 */ 81 Ref!Material getMaterial() const 82 { 83 checkClassBinding!(typeof(this))(); 84 return ptrcall!(Material)(GDNativeClassBinding.getMaterial, _godot_object); 85 } 86 /** 87 88 */ 89 long getRadialSegments() const 90 { 91 checkClassBinding!(typeof(this))(); 92 return ptrcall!(long)(GDNativeClassBinding.getRadialSegments, _godot_object); 93 } 94 /** 95 96 */ 97 double getRadius() const 98 { 99 checkClassBinding!(typeof(this))(); 100 return ptrcall!(double)(GDNativeClassBinding.getRadius, _godot_object); 101 } 102 /** 103 104 */ 105 long getRings() const 106 { 107 checkClassBinding!(typeof(this))(); 108 return ptrcall!(long)(GDNativeClassBinding.getRings, _godot_object); 109 } 110 /** 111 112 */ 113 bool getSmoothFaces() const 114 { 115 checkClassBinding!(typeof(this))(); 116 return ptrcall!(bool)(GDNativeClassBinding.getSmoothFaces, _godot_object); 117 } 118 /** 119 120 */ 121 void setMaterial(Material material) 122 { 123 checkClassBinding!(typeof(this))(); 124 ptrcall!(void)(GDNativeClassBinding.setMaterial, _godot_object, material); 125 } 126 /** 127 128 */ 129 void setRadialSegments(in long radial_segments) 130 { 131 checkClassBinding!(typeof(this))(); 132 ptrcall!(void)(GDNativeClassBinding.setRadialSegments, _godot_object, radial_segments); 133 } 134 /** 135 136 */ 137 void setRadius(in double radius) 138 { 139 checkClassBinding!(typeof(this))(); 140 ptrcall!(void)(GDNativeClassBinding.setRadius, _godot_object, radius); 141 } 142 /** 143 144 */ 145 void setRings(in long rings) 146 { 147 checkClassBinding!(typeof(this))(); 148 ptrcall!(void)(GDNativeClassBinding.setRings, _godot_object, rings); 149 } 150 /** 151 152 */ 153 void setSmoothFaces(in bool smooth_faces) 154 { 155 checkClassBinding!(typeof(this))(); 156 ptrcall!(void)(GDNativeClassBinding.setSmoothFaces, _godot_object, smooth_faces); 157 } 158 /** 159 Number of vertical slices for the sphere. 160 */ 161 @property long radialSegments() 162 { 163 return getRadialSegments(); 164 } 165 /// ditto 166 @property void radialSegments(long v) 167 { 168 setRadialSegments(v); 169 } 170 /** 171 Radius of the sphere. 172 */ 173 @property double radius() 174 { 175 return getRadius(); 176 } 177 /// ditto 178 @property void radius(double v) 179 { 180 setRadius(v); 181 } 182 /** 183 Number of horizontal slices for the sphere. 184 */ 185 @property long rings() 186 { 187 return getRings(); 188 } 189 /// ditto 190 @property void rings(long v) 191 { 192 setRings(v); 193 } 194 /** 195 If `true` the normals of the sphere are set to give a smooth effect making the sphere seem rounded. If `false` the sphere will have a flat shaded look. 196 */ 197 @property bool smoothFaces() 198 { 199 return getSmoothFaces(); 200 } 201 /// ditto 202 @property void smoothFaces(bool v) 203 { 204 setSmoothFaces(v); 205 } 206 }