1 /**
2 
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.visualinstance;
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.spatial;
23 import godot.node;
24 /**
25 
26 */
27 @GodotBaseClass struct VisualInstance
28 {
29 	enum string _GODOT_internal_name = "VisualInstance";
30 public:
31 @nogc nothrow:
32 	union { godot_object _godot_object; Spatial _GODOT_base; }
33 	alias _GODOT_base this;
34 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
35 	package(godot) __gshared bool _classBindingInitialized = false;
36 	package(godot) static struct _classBinding
37 	{
38 		__gshared:
39 		@GodotName("_get_visual_instance_rid") GodotMethod!(RID) _getVisualInstanceRid;
40 		@GodotName("set_base") GodotMethod!(void, RID) setBase;
41 		@GodotName("set_layer_mask") GodotMethod!(void, long) setLayerMask;
42 		@GodotName("get_layer_mask") GodotMethod!(long) getLayerMask;
43 		@GodotName("set_layer_mask_bit") GodotMethod!(void, long, bool) setLayerMaskBit;
44 		@GodotName("get_layer_mask_bit") GodotMethod!(bool, long) getLayerMaskBit;
45 		@GodotName("get_transformed_aabb") GodotMethod!(AABB) getTransformedAabb;
46 		@GodotName("get_aabb") GodotMethod!(AABB) getAabb;
47 	}
48 	bool opEquals(in VisualInstance other) const { return _godot_object.ptr is other._godot_object.ptr; }
49 	VisualInstance opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
50 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
51 	mixin baseCasts;
52 	static VisualInstance _new()
53 	{
54 		static godot_class_constructor constructor;
55 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("VisualInstance");
56 		if(constructor is null) return typeof(this).init;
57 		return cast(VisualInstance)(constructor());
58 	}
59 	@disable new(size_t s);
60 	/**
61 	
62 	*/
63 	RID _getVisualInstanceRid() const
64 	{
65 		Array _GODOT_args = Array.empty_array;
66 		String _GODOT_method_name = String("_get_visual_instance_rid");
67 		return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!RID);
68 	}
69 	/**
70 	Sets the base of the VisualInstance, which changes how the engine handles the VisualInstance under the hood.
71 	It is recommended to only use set_base if you know what you're doing.
72 	*/
73 	void setBase(in RID base)
74 	{
75 		checkClassBinding!(typeof(this))();
76 		ptrcall!(void)(_classBinding.setBase, _godot_object, base);
77 	}
78 	/**
79 	
80 	*/
81 	void setLayerMask(in long mask)
82 	{
83 		checkClassBinding!(typeof(this))();
84 		ptrcall!(void)(_classBinding.setLayerMask, _godot_object, mask);
85 	}
86 	/**
87 	
88 	*/
89 	long getLayerMask() const
90 	{
91 		checkClassBinding!(typeof(this))();
92 		return ptrcall!(long)(_classBinding.getLayerMask, _godot_object);
93 	}
94 	/**
95 	
96 	*/
97 	void setLayerMaskBit(in long layer, in bool enabled)
98 	{
99 		checkClassBinding!(typeof(this))();
100 		ptrcall!(void)(_classBinding.setLayerMaskBit, _godot_object, layer, enabled);
101 	}
102 	/**
103 	
104 	*/
105 	bool getLayerMaskBit(in long layer) const
106 	{
107 		checkClassBinding!(typeof(this))();
108 		return ptrcall!(bool)(_classBinding.getLayerMaskBit, _godot_object, layer);
109 	}
110 	/**
111 	Returns the transformed $(D AABB) (also known as the bounding box) for this VisualInstance.
112 	Transformed in this case means the $(D AABB) plus the position, rotation, and scale of the $(D Spatial)s $(D Transform)
113 	*/
114 	AABB getTransformedAabb() const
115 	{
116 		checkClassBinding!(typeof(this))();
117 		return ptrcall!(AABB)(_classBinding.getTransformedAabb, _godot_object);
118 	}
119 	/**
120 	Returns the $(D AABB) (also known as the bounding box) for this VisualInstance.
121 	*/
122 	AABB getAabb() const
123 	{
124 		checkClassBinding!(typeof(this))();
125 		return ptrcall!(AABB)(_classBinding.getAabb, _godot_object);
126 	}
127 	/**
128 	The render layer(s) this VisualInstance is drawn on.
129 	This object will only be visible for $(D Camera)s whose cull mask includes the render object this VisualInstance is set to.
130 	*/
131 	@property long layers()
132 	{
133 		return getLayerMask();
134 	}
135 	/// ditto
136 	@property void layers(long v)
137 	{
138 		setLayerMask(v);
139 	}
140 }