2
2
Copyright 2013 BlackBerry Inc.
3
3
Copyright (c) 2014-2017 Chukong Technologies
4
4
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
5
+ Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md).
5
6
6
7
Licensed under the Apache License, Version 2.0 (the "License");
7
8
you may not use this file except in compliance with the License.
@@ -45,6 +46,8 @@ class Vec4Base
45
46
46
47
Vec4Base () : x(0 .0f ), y(0 .0f ), z(0 .0f ), w(0 .0f ) {}
47
48
Vec4Base (float xx, float yy, float zz, float ww) : x(xx), y(yy), z(zz), w(ww) {}
49
+ explicit Vec4Base (const float * src) { this ->set (src); }
50
+
48
51
union
49
52
{
50
53
struct
@@ -108,6 +111,50 @@ class Vec4Base
108
111
return *static_cast <impl_type*>(this );
109
112
}
110
113
114
+ /* *
115
+ * Sets the elements of this vector to the specified values.
116
+ *
117
+ * @param xx The new x coordinate.
118
+ * @param yy The new y coordinate.
119
+ * @param zz The new z coordinate.
120
+ * @param ww The new w coordinate.
121
+ */
122
+ void set (float xx, float yy, float zz, float ww)
123
+ {
124
+ this ->x = xx;
125
+ this ->y = yy;
126
+ this ->z = zz;
127
+ this ->w = ww;
128
+ }
129
+
130
+ /* *
131
+ * Sets the elements of this vector from the values in the specified array.
132
+ *
133
+ * @param array An array containing the elements of the vector in the order x, y, z, w.
134
+ */
135
+ void set (const float * array)
136
+ {
137
+ GP_ASSERT (array);
138
+
139
+ this ->x = array[0 ];
140
+ this ->y = array[1 ];
141
+ this ->z = array[2 ];
142
+ this ->w = array[3 ];
143
+ }
144
+
145
+ /* *
146
+ * Sets the elements of this vector to those in the specified vector.
147
+ *
148
+ * @param v The vector to copy.
149
+ */
150
+ void set (const impl_type& v)
151
+ {
152
+ this ->x = v.x ;
153
+ this ->y = v.y ;
154
+ this ->z = v.z ;
155
+ this ->w = v.w ;
156
+ }
157
+
111
158
inline impl_type& operator -() { return impl_type{*static_cast <impl_type*>(this )}.negate (); }
112
159
113
160
/* *
@@ -246,7 +293,7 @@ class AX_DLL Vec4 : public Vec4Base<Vec4>
246
293
*
247
294
* @param array An array containing the elements of the vector in the order x, y, z, w.
248
295
*/
249
- Vec4 (const float * array);
296
+ explicit Vec4 (const float * array);
250
297
251
298
/* *
252
299
* Constructs a vector that describes the direction between the specified points.
@@ -256,15 +303,6 @@ class AX_DLL Vec4 : public Vec4Base<Vec4>
256
303
*/
257
304
Vec4 (const Vec4& p1, const Vec4& p2);
258
305
259
- /* *
260
- * Constructor.
261
- *
262
- * Creates a new vector that is a copy of the specified vector.
263
- *
264
- * @param copy The vector to copy.
265
- */
266
- Vec4 (const Vec4& copy);
267
-
268
306
/* *
269
307
* Creates a new vector from an integer interpreted as an RGBA value.
270
308
* E.g. 0xff0000ff represents opaque red or the vector (1, 0, 0, 1).
@@ -413,37 +451,13 @@ class AX_DLL Vec4 : public Vec4Base<Vec4>
413
451
*/
414
452
Vec4 getNormalized () const ;
415
453
416
- /* *
417
- * Sets the elements of this vector to the specified values.
418
- *
419
- * @param xx The new x coordinate.
420
- * @param yy The new y coordinate.
421
- * @param zz The new z coordinate.
422
- * @param ww The new w coordinate.
423
- */
424
- void set (float xx, float yy, float zz, float ww);
425
-
426
- /* *
427
- * Sets the elements of this vector from the values in the specified array.
428
- *
429
- * @param array An array containing the elements of the vector in the order x, y, z, w.
430
- */
431
- void set (const float * array);
432
-
433
- /* *
434
- * Sets the elements of this vector to those in the specified vector.
435
- *
436
- * @param v The vector to copy.
437
- */
438
- void set (const Vec4& v);
439
-
440
454
/* *
441
455
* Sets this vector to the directional vector between the specified points.
442
456
*
443
457
* @param p1 The first point.
444
458
* @param p2 The second point.
445
459
*/
446
- void set (const Vec4& p1, const Vec4& p2);
460
+ void setDirection (const Vec4& p1, const Vec4& p2);
447
461
448
462
/* *
449
463
* Subtracts the specified vectors and stores the result in dst.
0 commit comments