1 /**
2 Texture provided by a $(D CameraFeed).
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.cameratexture;
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.texture;
25 import godot.cameraserver;
26 /**
27 Texture provided by a $(D CameraFeed).
28 
29 This texture gives access to the camera texture provided by a $(D CameraFeed).
30 $(B Note:) Many cameras supply YCbCr images which need to be converted in a shader.
31 */
32 @GodotBaseClass struct CameraTexture
33 {
34 	package(godot) enum string _GODOT_internal_name = "CameraTexture";
35 public:
36 @nogc nothrow:
37 	union { /** */ godot_object _godot_object; /** */ Texture _GODOT_base; }
38 	alias _GODOT_base this;
39 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
40 	package(godot) __gshared bool _classBindingInitialized = false;
41 	package(godot) static struct GDNativeClassBinding
42 	{
43 		__gshared:
44 		@GodotName("get_camera_active") GodotMethod!(bool) getCameraActive;
45 		@GodotName("get_camera_feed_id") GodotMethod!(long) getCameraFeedId;
46 		@GodotName("get_which_feed") GodotMethod!(CameraServer.FeedImage) getWhichFeed;
47 		@GodotName("set_camera_active") GodotMethod!(void, bool) setCameraActive;
48 		@GodotName("set_camera_feed_id") GodotMethod!(void, long) setCameraFeedId;
49 		@GodotName("set_which_feed") GodotMethod!(void, long) setWhichFeed;
50 	}
51 	/// 
52 	pragma(inline, true) bool opEquals(in CameraTexture other) const
53 	{ return _godot_object.ptr is other._godot_object.ptr; }
54 	/// 
55 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
56 	{ _godot_object.ptr = n; return null; }
57 	/// 
58 	pragma(inline, true) bool opEquals(typeof(null) n) const
59 	{ return _godot_object.ptr is n; }
60 	/// 
61 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
62 	mixin baseCasts;
63 	/// Construct a new instance of CameraTexture.
64 	/// Note: use `memnew!CameraTexture` instead.
65 	static CameraTexture _new()
66 	{
67 		static godot_class_constructor constructor;
68 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("CameraTexture");
69 		if(constructor is null) return typeof(this).init;
70 		return cast(CameraTexture)(constructor());
71 	}
72 	@disable new(size_t s);
73 	/**
74 	
75 	*/
76 	bool getCameraActive() const
77 	{
78 		checkClassBinding!(typeof(this))();
79 		return ptrcall!(bool)(GDNativeClassBinding.getCameraActive, _godot_object);
80 	}
81 	/**
82 	
83 	*/
84 	long getCameraFeedId() const
85 	{
86 		checkClassBinding!(typeof(this))();
87 		return ptrcall!(long)(GDNativeClassBinding.getCameraFeedId, _godot_object);
88 	}
89 	/**
90 	
91 	*/
92 	CameraServer.FeedImage getWhichFeed() const
93 	{
94 		checkClassBinding!(typeof(this))();
95 		return ptrcall!(CameraServer.FeedImage)(GDNativeClassBinding.getWhichFeed, _godot_object);
96 	}
97 	/**
98 	
99 	*/
100 	void setCameraActive(in bool active)
101 	{
102 		checkClassBinding!(typeof(this))();
103 		ptrcall!(void)(GDNativeClassBinding.setCameraActive, _godot_object, active);
104 	}
105 	/**
106 	
107 	*/
108 	void setCameraFeedId(in long feed_id)
109 	{
110 		checkClassBinding!(typeof(this))();
111 		ptrcall!(void)(GDNativeClassBinding.setCameraFeedId, _godot_object, feed_id);
112 	}
113 	/**
114 	
115 	*/
116 	void setWhichFeed(in long which_feed)
117 	{
118 		checkClassBinding!(typeof(this))();
119 		ptrcall!(void)(GDNativeClassBinding.setWhichFeed, _godot_object, which_feed);
120 	}
121 	/**
122 	The ID of the $(D CameraFeed) for which we want to display the image.
123 	*/
124 	@property long cameraFeedId()
125 	{
126 		return getCameraFeedId();
127 	}
128 	/// ditto
129 	@property void cameraFeedId(long v)
130 	{
131 		setCameraFeedId(v);
132 	}
133 	/**
134 	Convenience property that gives access to the active property of the $(D CameraFeed).
135 	*/
136 	@property bool cameraIsActive()
137 	{
138 		return getCameraActive();
139 	}
140 	/// ditto
141 	@property void cameraIsActive(bool v)
142 	{
143 		setCameraActive(v);
144 	}
145 	/**
146 	Which image within the $(D CameraFeed) we want access to, important if the camera image is split in a Y and CbCr component.
147 	*/
148 	@property CameraServer.FeedImage whichFeed()
149 	{
150 		return getWhichFeed();
151 	}
152 	/// ditto
153 	@property void whichFeed(long v)
154 	{
155 		setWhichFeed(v);
156 	}
157 }