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