@@ -41,6 +41,14 @@ namespace ekg {
4141 }
4242
4343 // TODO: add non-useless vector 2 properties operators
44+
45+ template <typename t>
46+ operator ekg::vec2_t <t>() {
47+ return ekg::vec2_t <t>{
48+ static_cast <t>(this ->x ),
49+ static_cast <t>(this ->y )
50+ };
51+ }
4452 };
4553
4654 template <typename t>
@@ -62,6 +70,15 @@ namespace ekg {
6270 }
6371
6472 // TODO: add non-useless vector 3 properties operators
73+
74+ template <typename t>
75+ operator ekg::vec3_t <t>() {
76+ return ekg::vec3_t <t>{
77+ static_cast <t>(this ->x ),
78+ static_cast <t>(this ->y ),
79+ static_cast <t>(this ->z )
80+ };
81+ }
6582 };
6683
6784 template <typename t>
@@ -86,6 +103,16 @@ namespace ekg {
86103
87104 // TODO: add non-useless vector 4 properties operators
88105
106+ template <typename t>
107+ operator ekg::vec4_t <t>() {
108+ return ekg::vec4_t <t>{
109+ static_cast <t>(this ->x ),
110+ static_cast <t>(this ->y ),
111+ static_cast <t>(this ->z ),
112+ static_cast <t>(this ->w )
113+ };
114+ }
115+
89116 template <typename s>
90117 ekg::vec4_t <t> operator / (s div_by) {
91118 return ekg::vec4_t <t> {
@@ -129,6 +156,26 @@ namespace ekg {
129156 }
130157
131158 // TODO: add non-useless rect (aka vector 4 properties) operators
159+
160+ template <typename t>
161+ operator ekg::rect_t <t>() {
162+ return ekg::rect_t <t>{
163+ static_cast <t>(this ->x ),
164+ static_cast <t>(this ->y ),
165+ static_cast <t>(this ->w ),
166+ static_cast <t>(this ->h )
167+ };
168+ }
169+
170+ template <typename t>
171+ operator ekg::vec4_t <t>() {
172+ return ekg::vec4_t <t>{
173+ static_cast <t>(this ->x ),
174+ static_cast <t>(this ->y ),
175+ static_cast <t>(this ->w ),
176+ static_cast <t>(this ->h )
177+ };
178+ }
132179 };
133180
134181 struct rect_descriptor_t {
0 commit comments