1 /**
2 Generate an axis-aligned cuboid $(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.cubemesh;
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 Generate an axis-aligned cuboid $(D PrimitiveMesh).
27 
28 The cube's UV layout is arranged in a 3×2 layout that allows texturing each face individually. To apply the same texture on all faces, change the material's UV property to `Vector3(3, 2, 1)`.
29 $(B Note:) When using a large textured $(D CubeMesh) (e.g. as a floor), you may stumble upon UV jittering issues depending on the camera angle. To solve this, increase $(D subdivideDepth), $(D subdivideHeight) and $(D subdivideWidth) until you no longer notice UV jittering.
30 */
31 @GodotBaseClass struct CubeMesh
32 {
33 	package(godot) enum string _GODOT_internal_name = "CubeMesh";
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!(Vector3) getSize;
44 		@GodotName("get_subdivide_depth") GodotMethod!(long) getSubdivideDepth;
45 		@GodotName("get_subdivide_height") GodotMethod!(long) getSubdivideHeight;
46 		@GodotName("get_subdivide_width") GodotMethod!(long) getSubdivideWidth;
47 		@GodotName("set_size") GodotMethod!(void, Vector3) setSize;
48 		@GodotName("set_subdivide_depth") GodotMethod!(void, long) setSubdivideDepth;
49 		@GodotName("set_subdivide_height") GodotMethod!(void, long) setSubdivideHeight;
50 		@GodotName("set_subdivide_width") GodotMethod!(void, long) setSubdivideWidth;
51 	}
52 	/// 
53 	pragma(inline, true) bool opEquals(in CubeMesh other) const
54 	{ return _godot_object.ptr is other._godot_object.ptr; }
55 	/// 
56 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
57 	{ _godot_object.ptr = n; return null; }
58 	/// 
59 	pragma(inline, true) bool opEquals(typeof(null) n) const
60 	{ return _godot_object.ptr is n; }
61 	/// 
62 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
63 	mixin baseCasts;
64 	/// Construct a new instance of CubeMesh.
65 	/// Note: use `memnew!CubeMesh` instead.
66 	static CubeMesh _new()
67 	{
68 		static godot_class_constructor constructor;
69 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("CubeMesh");
70 		if(constructor is null) return typeof(this).init;
71 		return cast(CubeMesh)(constructor());
72 	}
73 	@disable new(size_t s);
74 	/**
75 	
76 	*/
77 	Vector3 getSize() const
78 	{
79 		checkClassBinding!(typeof(this))();
80 		return ptrcall!(Vector3)(GDNativeClassBinding.getSize, _godot_object);
81 	}
82 	/**
83 	
84 	*/
85 	long getSubdivideDepth() const
86 	{
87 		checkClassBinding!(typeof(this))();
88 		return ptrcall!(long)(GDNativeClassBinding.getSubdivideDepth, _godot_object);
89 	}
90 	/**
91 	
92 	*/
93 	long getSubdivideHeight() const
94 	{
95 		checkClassBinding!(typeof(this))();
96 		return ptrcall!(long)(GDNativeClassBinding.getSubdivideHeight, _godot_object);
97 	}
98 	/**
99 	
100 	*/
101 	long getSubdivideWidth() const
102 	{
103 		checkClassBinding!(typeof(this))();
104 		return ptrcall!(long)(GDNativeClassBinding.getSubdivideWidth, _godot_object);
105 	}
106 	/**
107 	
108 	*/
109 	void setSize(in Vector3 size)
110 	{
111 		checkClassBinding!(typeof(this))();
112 		ptrcall!(void)(GDNativeClassBinding.setSize, _godot_object, size);
113 	}
114 	/**
115 	
116 	*/
117 	void setSubdivideDepth(in long divisions)
118 	{
119 		checkClassBinding!(typeof(this))();
120 		ptrcall!(void)(GDNativeClassBinding.setSubdivideDepth, _godot_object, divisions);
121 	}
122 	/**
123 	
124 	*/
125 	void setSubdivideHeight(in long divisions)
126 	{
127 		checkClassBinding!(typeof(this))();
128 		ptrcall!(void)(GDNativeClassBinding.setSubdivideHeight, _godot_object, divisions);
129 	}
130 	/**
131 	
132 	*/
133 	void setSubdivideWidth(in long subdivide)
134 	{
135 		checkClassBinding!(typeof(this))();
136 		ptrcall!(void)(GDNativeClassBinding.setSubdivideWidth, _godot_object, subdivide);
137 	}
138 	/**
139 	Size of the cuboid mesh.
140 	*/
141 	@property Vector3 size()
142 	{
143 		return getSize();
144 	}
145 	/// ditto
146 	@property void size(Vector3 v)
147 	{
148 		setSize(v);
149 	}
150 	/**
151 	Number of extra edge loops inserted along the Z axis.
152 	*/
153 	@property long subdivideDepth()
154 	{
155 		return getSubdivideDepth();
156 	}
157 	/// ditto
158 	@property void subdivideDepth(long v)
159 	{
160 		setSubdivideDepth(v);
161 	}
162 	/**
163 	Number of extra edge loops inserted along the Y axis.
164 	*/
165 	@property long subdivideHeight()
166 	{
167 		return getSubdivideHeight();
168 	}
169 	/// ditto
170 	@property void subdivideHeight(long v)
171 	{
172 		setSubdivideHeight(v);
173 	}
174 	/**
175 	Number of extra edge loops inserted along the X axis.
176 	*/
177 	@property long subdivideWidth()
178 	{
179 		return getSubdivideWidth();
180 	}
181 	/// ditto
182 	@property void subdivideWidth(long v)
183 	{
184 		setSubdivideWidth(v);
185 	}
186 }