Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
/***************************************************************************
 * Mathlib
 *
 * Copyright (C) 2003-2004, Alexander Zaprjagaev <frustum@frustum.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 ***************************************************************************
 * Author: Scott Lee
*/

/* Copyright (c) 2017 DIVIDE-Studio
   Copyright (c) 2009 Ionut Cava

   This file is part of DIVIDE Framework.

   Permission is hereby granted, free of charge, to any person obtaining a copy
   of this software
   and associated documentation files (the "Software"), to deal in the Software
   without restriction,
   including without limitation the rights to use, copy, modify, merge, publish,
   distribute, sublicense,
   and/or sell copies of the Software, and to permit persons to whom the
   Software is furnished to do so,
   subject to the following conditions:

   The above copyright notice and this permission notice shall be included in
   all copies or substantial portions of the Software.

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   IMPLIED,
   INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
   PARTICULAR PURPOSE AND NONINFRINGEMENT.
   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
   DAMAGES OR OTHER LIABILITY,
   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
   IN CONNECTION WITH THE SOFTWARE
   OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 */

#ifndef _MATH_VECTORS_H_
#define _MATH_VECTORS_H_

#include "MathHelper.h"

namespace Divide {

template <U32 alignment = 16>
struct alligned_base {
    void *operator new (size_t size)
    {
        return _mm_malloc(size, alignment);
    }

        void *operator new[](size_t size)
    {
        return _mm_malloc(size, alignment);
    }

        void operator delete (void *mem)
    {
        _mm_free(mem);
    }

    void operator delete[](void *mem)
    {
        _mm_free(mem);
    }
};

struct non_aligned_base {
};

template<typename T, typename Enable = void>
class simd_vector;

template<typename T>
class simd_vector<T, std::enable_if_t<std::is_same<T, F32>::value>> {
public:
    simd_vector()  noexcept : simd_vector(0)
    {
    }

    simd_vector(__m128 reg)  noexcept : _reg(reg)
    {
    }

    __m128 _reg;
};

template<typename T>
class simd_vector<T, std::enable_if_t<!std::is_same<T, F32>::value>> {
    simd_vector()  noexcept : simd_vector(0)
    {
    }

    simd_vector(T reg[4])  noexcept : _reg(reg)
    {
    }

    T _reg[4];
};

/***********************************************************************
 * vec2 -  A 2-tuple used to represent things like a vector in 2D space,
 * a point in 2D space or just 2 values linked together
 ***********************************************************************/
template <typename T>
class vec2 {
    static_assert(std::is_arithmetic<T>::value &&
                  !std::is_same<T, bool>::value,
                  "non-arithmetic vector type");
   public:
    vec2() noexcept : vec2((T)0)
    {
    }
    vec2(T value) noexcept : vec2(value, value)
    {
    }

    template<typename U>
    vec2(U value) noexcept : vec2(value, value)
    {
    }

    vec2(T _x, T _y) noexcept : x(_x), y(_y)
    {
    }

    template <typename U>
    vec2(U _x, U _y) noexcept 
        : x(static_cast<T>(_x)),
          y(static_cast<T>(_y))
    {
    }
    template <typename U, typename V>
    vec2(U _x, V _y) noexcept 
        : x(static_cast<T>(_x)),
          y(static_cast<T>(_y))
    {
    }
    vec2(const T *_v) noexcept : vec2(_v[0], _v[1])
    {
    }

    vec2(const vec2 &_v) noexcept : vec2(_v._v)
    {
    }

    vec2(const vec3<T> &_v) noexcept : vec2(_v.xy())
    {
    }

    vec2(const vec4<T> &_v) noexcept : vec2(_v.xy())
    {
    }

    template<typename U>
    vec2(const vec2<U> &v) noexcept : vec2(v.x, v.y)
    {
    }

    template<typename U>
    vec2(const vec3<U> &v) noexcept : vec2(v.x, v.y)
    {
    }

    template<typename U>
    vec2(const vec4<U> &v) noexcept : vec2(v.x, v.y)
    {
    }

    bool operator>(const vec2 &v) const { return x > v.x && y > v.y; }
    bool operator<(const vec2 &v) const { return x < v.x && y < v.y; }
    bool operator<=(const vec2 &v) const { return *this < v || *this == v; }
    bool operator>=(const vec2 &v) const { return *this > v || *this == v; }

    bool operator==(const vec2 &v) const { return this->compare(v); }
    bool operator!=(const vec2 &v) const { return !this->compare(v); }

    template<typename U>
    bool operator!=(const vec2<U> &v) const { return !this->compare(v); }
    template<typename U>
    bool operator==(const vec2<U> &v) const { return this->compare(v); }

    vec2 &operator=(T _f) noexcept {
        this->set(_f);
        return (*this);
    }

    vec2 &operator=(const vec2& other) noexcept {
        this->set(other);
        return (*this);
    }

    const vec2 operator*(T _f) const {
        return vec2(this->x * _f, this->y * _f);
    }
    const vec2 operator/(T _i) const {
        return vec2(this->x / _i, this->y / _i);
    }
    const vec2 operator+(const vec2 &v) const {
        return vec2(this->x + v.x, this->y + v.y);
    }

    const vec2 operator+(T _f) const {
        return vec2(this->x + _f, this->y + _f);
    }

    const vec2 operator-(T _f) const {
        return vec2(this->x - _f, this->y - _f);
    }

    template<typename U>
    vec2 &operator=(U _f) noexcept {
        this->set(_f);
        return (*this);
    }

    template<typename U>
    vec2 &operator=(const vec2<U>& other) noexcept {
        this->set(other);
        return (*this);
    }

    template<typename U>
    const vec2 operator*(U _f) const {
        return vec2(this->x * _f, this->y * _f);
    }

    template<typename U>
    const vec2 operator/(U _i) const {
        return vec2(this->x / _i, this->y / _i);
    }

    template<typename U>
    const vec2 operator+(const vec2<U> &v) const {
        return vec2(this->x + v.x, this->y + v.y);
    }

    template<typename U>
    const vec2 operator+(U _f) const {
        return vec2(this->x + _f, this->y + _f);
    }

    template<typename U>
    const vec2 operator-(U _f) const {
        return vec2(this->x - _f, this->y - _f);
    }

    const vec2 operator-() const { return vec2(-this->x, -this->y); }
    const vec2 operator-(const vec2 &v) const {
        return vec2(this->x - v.x, this->y - v.y);
    }
    vec2 &operator*=(T _f) {
        this->set(*this * _f);
        return *this;
    }
    vec2 &operator/=(T _f) {
        this->set(*this / _f);
        return *this;
    }
    vec2 &operator*=(const vec2 &v) {
        this->set(*this * v);
        return *this;
    }
    vec2 &operator/=(const vec2 &v) {
        this->set(*this / v);
        return *this;
    }
    vec2 &operator+=(const vec2 &v) {
        this->set(*this + v);
        return *this;
    }
    vec2 &operator-=(const vec2 &v) {
        this->set(*this - v);
        return *this;
    }
    vec2 operator*(const vec2 &v) const {
        return vec2(this->x * v.x, this->y * v.y);
    }
    T &operator[](I32 i) { return this->_v[i]; }
    const T &operator[](I32 i) const { return this->_v[i]; }
    const vec2 operator/(const vec2 &v) const {
        return vec2(IS_ZERO(v.x) ? this->x : this->x / v.x,
                    IS_ZERO(v.y) ? this->y : this->y / v.y);
    }
    operator T *() { return this->_v; }
    operator const T *() const { return this->_v; }
    /// swap the components  of this vector with that of the specified one
    inline void swap(vec2 *iv) {
        std::swap(this->x, iv->x);
        std::swap(this->x, iv->x);
    }
    /// swap the components  of this vector with that of the specified one
    inline void swap(vec2 &iv) {
        std::swap(this->x, iv.x);
        std::swap(this->x, iv.x);
    }
    /// set the 2 components of the vector manually using a source pointer to a (large enough) array
    inline void set(const T* v) { std::memcpy(&_v[0], &v[0], sizeof(T) * 2); }
    /// set the 2 components of the vector manually
    inline void set(T value) { this->set(value, value); }
    /// set the 2 components of the vector manually
    inline void set(T _x, T _y) {
        this->x = _x;
        this->y = _y;
    }
    template <typename U> 
    inline void set(U _x, U _y) {
        this->x = static_cast<T>(_x);
        this->y = static_cast<T>(_y);
    }
    /// set the 2 components of the vector using a source vector
    inline void set(const vec2 &v) { this->set(&v._v[0]); }
    /// set the 2 components of the vector using the first 2 components of the
    /// source vector
    inline void set(const vec3<T> &v) { this->set(v.x, v.y); }
    /// set the 2 components of the vector using the first 2 components of the
    /// source vector
    inline void set(const vec4<T> &v) { this->set(v.x, v.y); }
    /// set the 2 components of the vector back to 0
    inline void reset() { this->set((T)0); }
    /// return the vector's length
    inline T length() const { return Divide::Sqrt(lengthSquared()); }
    inline T lengthSquared() const;
    /// return the angle defined by the 2 components
    inline T angle() const { return (T)std::atan2(this->y, this->x); }
    /// return the angle defined by the 2 components
    inline T angle(const vec2 &v) const {
        return (T)std::atan2(v.y - this->y, v.x - this->x);
    }
    /// compute the vector's distance to another specified vector
    inline T distance(const vec2 &v, bool absolute = true) const;
    /// compute the vector's squared distance to another specified vector
    inline T distanceSquared(const vec2 &v) const;
    /// convert the vector to unit length
    inline void normalize();
    /// round both values
    inline void round();
    /// lerp between this and the specified vector by the specified amount
    inline void lerp(const vec2 &v, T factor);
    /// lerp between this and the specified vector by the specified amount for
    /// each component
    inline void lerp(const vec2 &v, const vec2 &factor);
    /// calculate the dot product between this vector and the specified one
    inline T dot(const vec2 &v) const;
    /// project this vector on the line defined by the 2 points(A, B)
    inline T projectionOnLine(const vec2 &vA, const vec2 &vB) const;
    /// return the closest point on the line defined by the 2 points (A, B) and this
    /// vector
    inline vec2 closestPointOnLine(const vec2 &vA, const vec2 &vB);
    /// return the closest point on the line segment defined between the 2 points
    /// (A, B) and this vector
    inline vec2 closestPointOnSegment(const vec2 &vA, const vec2 &vB);
    /// compare 2 vectors
    template<typename U>
    inline bool compare(const vec2<U> &_v) const;
    /// compare 2 vectors within the specified tolerance
    template<typename U>
    inline bool compare(const vec2<U> &_v, U epsi) const;
    /// export the vector's components in the first 2 positions of the specified array
    inline void get(T *v) const;

    union {
        struct {
            T x, y;
        };
        struct {
            T s, t;
        };
        struct {
            T width, height;
        };
        struct {
            T w, h;
        };
        struct {
            T min, max;
        };
        T _v[2];
    };
};

/// lerp between the 2 specified vectors by the specified amount
template <typename T, typename U>
inline vec2<T> Lerp(const vec2<T> &u, const vec2<T> &v, U factor);

/// lerp between the 2 specified vectors by the specified amount for each component
template <typename T>
inline vec2<T> Lerp(const vec2<T> &u, const vec2<T> &v, const vec2<T> &factor);
template <typename T>
inline vec2<T> Cross(const vec2<T> &v1, const vec2<T> &v2);
template <typename T>
inline vec2<T> Inverse(const vec2<T> &v);
template <typename T>
inline vec2<T> Normalize(vec2<T> &vector);
template <typename T>
inline vec2<T> Normalize(const vec2<T> &vector);
template <typename T>
inline T Dot(const vec2<T> &a, const vec2<T> &b);
template <typename T>
inline void OrthoNormalize(vec2<T> &v1, vec2<T> &v2);

/// multiply a vector by a value
template <typename T>
inline vec2<T> operator*(T fl, const vec2<T> &v);
/***********************************************************************
 * vec3 -  A 3-tuple used to represent things like a vector in 3D space,
 * a point in 3D space or just 3 values linked together
 ***********************************************************************/
template <typename T>
class vec3 {
    static_assert(std::is_arithmetic<T>::value &&
                  !std::is_same<T, bool>::value,
                  "non-arithmetic vector type");
   public:
    vec3() noexcept : vec3((T)0)
    {
    }
    vec3(T value) noexcept : vec3(value, value, value)
    {
    }
    template<typename U>
    vec3(U value) noexcept : vec3(value, value, value)
    {
    }

    vec3(T _x, T _y, T _z) noexcept : x(_x), y(_y), z(_z)
    {
    }

    template <typename U>
    vec3(U _x, U _y, U _z) : x(static_cast<T>(_x)),
                             y(static_cast<T>(_y)),
                             z(static_cast<T>(_z))
    {
    }
    template <typename U, typename V>
    vec3(U _x, U _y, V _z) noexcept
        : x(static_cast<T>(_x)),
          y(static_cast<T>(_y)),
          z(static_cast<T>(_z))
    {
    }
    template <typename U, typename V>
    vec3(U _x, V _y, V _z) noexcept
        : x(static_cast<T>(_x)),
          y(static_cast<T>(_y)),
          z(static_cast<T>(_z))
    {
    }
    template <typename U, typename V, typename W>
    vec3(U _x, V _y, W _z) noexcept
        : x(static_cast<T>(_x)),
          y(static_cast<T>(_y)),
          z(static_cast<T>(_z))
    {
    }
    vec3(const T *v) noexcept : vec3(v[0], v[1], v[2])
    {
    }
    vec3(const vec2<T> &v) noexcept : vec3(v, static_cast<T>(0))
    {
    }
    vec3(const vec2<T> &v, T _z) noexcept : vec3(v.x, v.y, _z)
    {
    }
    vec3(const vec3 &v) noexcept : vec3(v._v)
    {
    }
    vec3(const vec4<T> &v) noexcept : vec3(v.x, v.y, v.z)
    {
    }

    template<typename U>
    vec3(const vec2<U> &v) noexcept : vec3(v.x, v.y, static_cast<U>(0))
    {
    }

    template<typename U>
    vec3(const vec3<U> &v) noexcept : vec3(v.x, v.y, v.z)
    {
    }

    template<typename U>
    vec3(const vec4<U> &v) noexcept : vec3(v.x, v.y, v.z)
    {
    }

    bool operator>(const vec3 &v) const { return x > v.x && y > v.y && z > v.z; }
    bool operator<(const vec3 &v) const { return x < v.x && y < v.y && z < v.z; }
    bool operator<=(const vec3 &v) const { return *this < v || *this == v; }
    bool operator>=(const vec3 &v) const { return *this > v || *this == v; }
    
    bool operator!=(const vec3 &v) const { return !this->compare(v); }
    bool operator==(const vec3 &v) const { return this->compare(v); }

    template<typename U>
    bool operator!=(const vec3<U> &v) const { return !this->compare(v); }
    template<typename U>
    bool operator==(const vec3<U> &v) const { return this->compare(v); }

    vec3 &operator=(T _f) noexcept {
        this->set(_f);
        return (*this);
    }

    vec3 &operator=(const vec3& other) noexcept {
        this->set(other);
        return (*this);
    }

    const vec3 operator*(T _f) const {
        return vec3(this->x * _f, this->y * _f, this->z * _f);
    }
    const vec3 operator/(T _f) const {
        if (IS_ZERO(_f)) return *this;
        _f = 1.0f / _f;
        return (*this) * _f;
    }
    const vec3 operator+(const vec3 &v) const {
        return vec3(this->x + v.x, this->y + v.y, this->z + v.z);
    }
    const vec3 operator-(T _f) const {
        return vec3(this->x - _f, this->y - _f, this->z - _f);
    }

    template <typename U>
    vec3 &operator=(U _f) noexcept {
        this->set(_f);
        return (*this);
    }

    template <typename U>
    vec3 &operator=(const vec3<U>& other) noexcept {
        this->set(other);
        return (*this);
    }

    template <typename U>
    const vec3 operator*(U _f) const {
        return vec3(this->x * _f, this->y * _f, this->z * _f);
    }

    template <typename U>
    const vec3 operator/(U _f) const {
        if (IS_ZERO(_f)) {
            return *this;
        }

        return (*this) * (1.0f / _f);
    }

    template <typename U>
    const vec3 operator+(const vec3<U> &v) const {
        return vec3(this->x + v.x, this->y + v.y, this->z + v.z);
    }

    template <typename U>
    const vec3 operator-(U _f) const {
        return vec3(this->x - _f, this->y - _f, this->z - _f);
    }

    const vec3 operator-() const { return vec3(-this->x, -this->y, -this->z); }
    const vec3 operator-(const vec3 &v) const {
        return vec3(this->x - v.x, this->y - v.y, this->z - v.z);
    }
    const vec3 operator*(const vec3 &v) const {
        return vec3(this->x * v.x, this->y * v.y, this->z * v.z);
    }
    vec3 &operator*=(T _f) {
        this->set(*this * _f);
        return *this;
    }
    vec3 &operator/=(T _f) {
        this->set(*this / _f);
        return *this;
    }
    vec3 &operator*=(const vec3 &v) {
        this->set(*this * v);
        return *this;
    }
    vec3 &operator/=(const vec3 &v) {
        this->set(*this / v);
        return *this;
    }
    vec3 &operator+=(const vec3 &v) {
        this->set(*this + v);
        return *this;
    }
    vec3 &operator-=(const vec3 &v) {
        this->set(*this - v);
        return *this;
    }
    //    T     operator*(const vec3 &v)   const { return this->x * v.x +
    //    this->y * v.y + this->z * v.z; }
    T &operator[](const I32 i) { return this->_v[i]; }
    const vec3 operator/(const vec3 &v) const {
        return vec3(IS_ZERO(v.x) ? this->x : this->x / v.x,
                    IS_ZERO(v.y) ? this->y : this->y / v.y,
                    IS_ZERO(v.z) ? this->z : this->z / v.z);
    }
    operator T *() { return this->_v; }
    operator const T *() const { return this->_v; }

    /// GLSL like accessors (const to prevent erroneous usage like .xy() += n)
    inline const vec2<T> rg() const { return vec2<T>(this->r, this->g); }
    inline const vec2<T> xy() const { return this->rg(); }
    inline const vec2<T> rb() const { return vec2<T>(this->r, this->b); }
    inline const vec2<T> xz() const { return this->rb(); }
    inline const vec2<T> gb() const { return vec2<T>(this->g, this->b); }
    inline const vec2<T> yz() const { return this->gb(); }

    inline void rg(const vec2<T> &rg) { this->set(rg); }
    inline void xy(const vec2<T> &xy) { this->set(xy); }
    inline void rb(const vec2<T> &rb) {
        this->r = rb.x;
        this->b = rb.y;
    }
    inline void xz(const vec2<T> &xz) {
        this->x = xz.x;
        this->z = xz.y;
    }
    inline void gb(const vec2<T> &gb) {
        this->g = gb.x;
        this->b = gb.y;
    }
    inline void yz(const vec2<T> &yz) {
        this->y = yz.x;
        this->z = yz.y;
    }

    /// set the 3 components of the vector manually using a source pointer to a (large enough) array
    inline void set(const T* v) { std::memcpy(&_v[0], &v[0], sizeof(T) * 3); }
    /// set the 3 components of the vector manually
    inline void set(T value) { this->set(value, value, value); }
    /// set the 3 components of the vector manually
    inline void set(T _x, T _y, T _z) {
        this->x = _x;
        this->y = _y;
        this->z = _z;
    }
    template <typename U> 
    inline void set(U _x, U _y, U _z) {
        this->x = static_cast<T>(_x);
        this->y = static_cast<T>(_y);
        this->z = static_cast<T>(_z);
    }
    /// set the 3 components of the vector using a smaller source vector
    inline void set(const vec2<T> &v) { this->set(v.x, v.y, z); }
    /// set the 3 components of the vector using a source vector
    inline void set(const vec3 &v) { this->set(&v._v[0]); }
    /// set the 3 components of the vector using the first 3 components of the
    /// source vector
    inline void set(const vec4<T> &v) { this->set(v.x, v.y, v.z); }
    /// set all the components back to 0
    inline void reset() { this->set((T)0); }
    /// return the vector's length
    inline T length() const { return Divide::Sqrt(lengthSquared()); }
    /// return true if length is zero
    inline bool isZeroLength() const { return lengthSquared() < EPSILON_F32; }
    /// compare 2 vectors
    template<typename U>
    inline bool compare(const vec3<U> &v) const;
    /// compare 2 vectors within the specified tolerance
    template<typename U>
    inline bool compare(const vec3<U> &v, U epsi) const;
    /// uniform vector: x = y = z
    inline bool isUniform() const;
    /// return the squared distance of the vector
    inline T lengthSquared() const;
    /// calculate the dot product between this vector and the specified one
    inline T dot(const vec3 &v) const;
    /// returns the angle in radians between '*this' and 'v'
    inline T angle(vec3 &v) const;
    /// compute the vector's distance to another specified vector
    inline T distance(const vec3 &v, bool absolute = true) const;
    /// compute the vector's squared distance to another specified vector
    inline T distanceSquared(const vec3 &v) const;
    /// transform the vector to unit length
    inline void normalize();
    /// round all three values
    inline void round();
    /// project this vector on the line defined by the 2 points(A, B)
    inline T projectionOnLine(const vec3 &vA, const vec3 &vB) const;
    /// return the closest point on the line defined by the 2 points (A, B) and this
    /// vector
    inline vec3 closestPointOnLine(const vec3 &vA, const vec3 &vB);
    /// return the closest point on the line segment created between the 2 points
    /// (A, B) and this vector
    inline vec3 closestPointOnSegment(const vec3 &vA, const vec3 &vB);
    /// get the direction vector to the specified point
    inline vec3 direction(const vec3 &u) const;
    /// lerp between this and the specified vector by the specified amount
    inline void lerp(const vec3 &v, T factor);
    /// lerp between this and the specified vector by the specified amount for
    /// each component
    inline void lerp(const vec3 &v, const vec3 &factor);
    /// this calculates a vector between the two specified points and returns
    /// the result
    inline vec3 vector(const vec3 &vp1, const vec3 &vp2) const;
    /// set this vector to be equal to the cross of the 2 specified vectors
    inline void cross(const vec3 &v1, const vec3 &v2);
    /// set this vector to be equal to the cross between itself and the
    /// specified vector
    inline void cross(const vec3 &v2);
    /// rotate this vector on the X axis
    inline void rotateX(D64 radians);
    /// rotate this vector on the Y axis
    inline void rotateY(D64 radians);
    /// rotate this vector on the Z axis
    inline void rotateZ(D64 radians);
    /// swap the components  of this vector with that of the specified one
    inline void swap(vec3 &iv);
    /// swap the components  of this vector with that of the specified one
    inline void swap(vec3 *iv);
    /// export the vector's components in the first 3 positions of the specified
    /// array
    inline void get(T *v) const;

    union {
        struct {
            T x, y, z;
        };
        struct {
            T s, t, p;
        };
        struct {
            T r, g, b;
        };
        struct {
            T pitch, yaw, roll;
        };
        struct {
            T width, height, depth;
        };
        T _v[3];
    };
};

/// lerp between the 2 specified vectors by the specified amount
template <typename T, typename U>
inline vec3<T> Lerp(const vec3<T> &u, const vec3<T> &v, U factor);
/// lerp between the 2 specified vectors by the specified amount for each
/// component
template <typename T>
inline vec3<T> Lerp(const vec3<T> &u, const vec3<T> &v, const vec3<T> &factor);
template <typename T>
inline vec3<T> Normalize(vec3<T> &vector);
template <typename T>
inline vec3<T> Normalize(const vec3<T> &vector);
/// general vec3 dot product
template <typename T>
inline T Dot(const vec3<T> &a, const vec3<T> &b);
/// general vec3 cross function
template <typename T>
inline vec3<T> Cross(const vec3<T> &v1, const vec3<T> &v2);
template <typename T>
inline vec3<T> Inverse(const vec3<T> &v);
template <typename T>
inline vec3<T> operator*(T fl, const vec3<T> &v);
template <typename T>
inline void OrthoNormalize(vec3<T> &v1, vec3<T> &v2);

/*************************************************************************************
 * vec4 -  A 4-tuple used to represent things like a vector in 4D space
(w-component)
 * or just 4 values linked together
 ************************************************************************************/
//#pragma pack(push)
//#pragma pack(1)
//__declspec(align(alignment))
template <typename T>
class vec4 : public std::conditional<std::is_same<T, F32>::value, alligned_base<16>, non_aligned_base>::type {
    static_assert(std::is_arithmetic<T>::value &&
                  !std::is_same<T, bool>::value,
                  "non-arithmetic vector type");
   public:
    vec4() noexcept : x(0), y(0), z(0), w(1)
    {
    }

    vec4(T _x, T _y, T _z, T _w) noexcept 
        : x(_x), y(_y), z(_z), w(_w)
    {
    }
    template<typename U>
    vec4(U _x, U _y, U _z, U _w) noexcept 
        : x(static_cast<T>(_x)),
          y(static_cast<T>(_y)),
          z(static_cast<T>(_z)),
          w(static_cast<T>(_w))
    {
    }

    vec4(__m128 reg) noexcept: _reg(reg)
    {
    }

    vec4(const simd_vector<T>& reg) noexcept: _reg(reg)
    {
    }

    vec4(T value) noexcept : vec4(value, value, value, value)
    {
    }

    template<typename U>
    vec4(U value) noexcept : vec4(value, value, value, value)
    {
    }

    vec4(const T *v) noexcept : vec4(v[0], v[1], v[2], v[3])
    {
    }

    vec4(const vec2<T> &v) noexcept : vec4(v, static_cast<T>(0))
    {
    }

    vec4(const vec2<T> &v, T _z) noexcept : vec4(v, _z, static_cast<T>(1))
    {
    }

    vec4(const vec2<T> &v, T _z, T _w) noexcept : vec4(v.x, v.y, _z, _w)
    {
    }

    vec4(const vec3<T> &v) noexcept : vec4(v, static_cast<T>(1))
    {
    }

    vec4(const vec3<T> &v, T _w) noexcept : vec4(v.x, v.y, v.z, _w)
    {
    }

    vec4(const vec4 &v) noexcept : vec4(v._v)
    {
    }

    template<typename U>
    vec4(const vec2<U> &v) noexcept 
        : vec4(v.x, v.y, static_cast<U>(0), static_cast<U>(0))
    {
    }

    template<typename U>
    vec4(const vec3<U> &v) noexcept 
        : vec4(v.x, v.y, v.z, static_cast<U>(0))
    {
    }

    template<typename U>
    vec4(const vec4<U> &v) noexcept 
        : vec4(v.x, v.y, v.z, v.w)
    {
    }

    bool operator>(const vec4 &v) const { return x > v.x && y > v.y && z > v.z && w > v.w; }
    bool operator<(const vec4 &v) const { return x < v.x && y < v.y && z < v.z && w < v.w; }
    bool operator<=(const vec4 &v) const { return *this < v || *this == v; }
    bool operator>=(const vec4 &v) const { return *this > v || *this == v; }

    bool operator==(const vec4 &v) const { return this->compare(v); }
    bool operator!=(const vec4 &v) const { return !this->compare(v); }

    template<typename U>
    bool operator!=(const vec4<U> &v) const { return !this->compare(v); }
    template<typename U>
    bool operator==(const vec4<U> &v) const { return this->compare(v); }

    vec4 &operator=(T _f) noexcept { this->set(_f); return *this; }

    vec4 &operator=(const vec4& other) noexcept { this->set(other); return *this; }

    const vec4 operator-(T _f) const {
        return vec4(this->x - _f, this->y - _f, this->z - _f, this->w - _f);
    }

    const vec4 operator+(T _f) const {
        return vec4(this->x + _f, this->y + _f, this->z + _f, this->w + _f);
    }

    const vec4 operator*(T _f) const {
        return vec4(this->x * _f, this->y * _f, this->z * _f, this->w * _f);
    }

    const vec4 operator/(T _f) const {
        if (IS_ZERO(_f)) {
            return *this;
        }

        return vec4(static_cast<T>(this->x * (1.0f / _f)),
                    static_cast<T>(this->y * (1.0f / _f)),
                    static_cast<T>(this->z * (1.0f / _f)),
                    static_cast<T>(this->w * (1.0f / _f)));
    }


    template<typename U>
    vec4 &operator=(U _f) noexcept { this->set(_f); return *this; }

    template<typename U>
    vec4 &operator=(const vec4& other) noexcept { this->set(other); return *this; }

    template<typename U>
    const vec4 operator-(U _f) const {
        return vec4(this->x - _f, this->y - _f, this->z - _f, this->w - _f);
    }

    template<typename U>
    const vec4 operator+(U _f) const {
        return vec4(this->x + _f, this->y + _f, this->z + _f, this->w + _f);
    }

    template<typename U>
    const vec4 operator*(U _f) const {
        return vec4(this->x * _f, this->y * _f, this->z * _f, this->w * _f);
    }

    template<typename U>
    const vec4 operator/(U _f) const {
        if (IS_ZERO(_f)) {
            return *this;
        }

        return vec4(static_cast<T>(this->x * (1.0f / _f)),
            static_cast<T>(this->y * (1.0f / _f)),
            static_cast<T>(this->z * (1.0f / _f)),
            static_cast<T>(this->w * (1.0f / _f)));
    }

    const vec4 operator-() const { return vec4(-x, -y, -z, -w); }

    const vec4 operator+(const vec4 &v) const {
        return vec4(this->x + v.x, this->y + v.y, this->z + v.z, this->w + v.w);
    }

    const vec4 operator-(const vec4 &v) const {
        return vec4(this->x - v.x, this->y - v.y, this->z - v.z, this->w - v.w);
    }

    const vec4 operator/(const vec4 &v) const {
        return vec4(IS_ZERO(v.x) ? this->x : this->x / v.x,
            IS_ZERO(v.y) ? this->y : this->y / v.y,
            IS_ZERO(v.z) ? this->z : this->z / v.z,
            IS_ZERO(v.w) ? this->w : this->w / v.w);
    }

    const vec4 operator*(const vec4& v) const {
        return vec4(this->x * v.x,
                    this->y * v.y,
                    this->z * v.z,
                    this->w * v.w);
    }

    vec4 &operator*=(T _f) {
        this->set(*this * _f);
        return *this;
    }

    vec4 &operator/=(T _f) {
        this->set(*this / _f);
        return *this;
    }

    vec4 &operator*=(const vec4 &v) {
        this->set(*this * v);
        return *this;
    }

    vec4 &operator/=(const vec4 &v) {
        this->set(*this / v);
        return *this;
    }

    vec4 &operator+=(const vec4 &v) {
        this->set(*this + v);
        return *this;
    }

    vec4 &operator-=(const vec4 &v) {
        this->set(*this - v);
        return *this;
    }

    operator T *() { return this->_v; }
    operator const T *() const { return this->_v; }

    T &operator[](I32 i) { return this->_v[i]; }
    const T &operator[](I32 _i) const { return this->_v[_i]; }

    /// GLSL like accessors (const to prevent erroneous usage like .xyz() += n)
    inline const vec2<T> rg() const { return vec2<T>(this->r, this->g); }
    inline const vec2<T> xy() const { return this->rg(); }
    inline const vec2<T> rb() const { return vec2<T>(this->r, this->b); }
    inline const vec2<T> xz() const { return this->rb(); }
    inline const vec2<T> gb() const { return vec2<T>(this->g, this->b); }
    inline const vec2<T> yz() const { return this->gb(); }
    inline const vec2<T> ra() const { return vec2<T>(this->r, this->a); }
    inline const vec2<T> xw() const { return this->ra(); }
    inline const vec2<T> ga() const { return vec2<T>(this->g, this->a); }
    inline const vec2<T> yw() const { return this->ga(); }
    inline const vec2<T> ba() const { return vec2<T>(this->b, this->a); }
    inline const vec2<T> zw() const { return this->ba(); }
    inline const vec3<T> rgb() const { return vec3<T>(this->r, this->g, this->b); }
    inline const vec3<T> xyz() const { return this->rgb(); }
    inline const vec3<T> bgr() const { return vec3<T>(this->b, this->g, this->r); }
    inline const vec3<T> zyx() const { return this->bgr(); }
    inline const vec3<T> rga() const { return vec3<T>(this->r, this->g, this->a); }
    inline const vec3<T> xyw() const { return this->rga(); }
    inline const vec3<T> gba() const { return vec3<T>(this->g, this->b, this->a); }
    inline const vec3<T> yzw() const { return this->gba(); }

    inline void rg(const vec2<T> &rg) { this->set(rg); }
    inline void xy(const vec2<T> &xy) { this->set(xy); }
    inline void rb(const vec2<T> &rb) {
        this->xz(rb);
    }
    inline void xz(const vec2<T> &xz) {
        this->xz(xz.x, xz.y);
    }
    inline void gb(const vec2<T> &gb) {
        this->yz(gb);
    }
    inline void yz(const vec2<T> &yz) {
        this->yz(yz.x, yz.y);
    }
    inline void ra(const vec2<T> &ra) {
        this->xw(ra);
    }
    inline void xw(const vec2<T> &xw) {
        this->xw(xw.x, xw.y);
    }
    inline void ga(const vec2<T> &ga) {
        this->yw(ga);
    }
    inline void yw(const vec2<T> &yw) {
        this->yw(yw.x, yw.y);
    }
    inline void ba(const vec2<T> &ba) {
        this->zw(ba);
    }
    inline void zw(const vec2<T> &zw) {
        this->zw(zw.x, zw.y);
    }
    inline void rgb(const vec3<T> &rgb) {
        this->xyz(rgb);
    }
    inline void xyz(const vec3<T> &xyz) {
        this->xyz(xyz.x, xyz.y, xyz.z);
    }
    inline void bgr(const vec3<T> &bgr) {
        this->zyx(bgr);
    }
    inline void zyx(const vec3<T> &zyx) {
        this->z = zyx.x;
        this->y = zyx.y;
        this->x = zyx.z;
    }
    inline void rga(const vec3<T> &rga) {
        this->xyw(rga);
    }
    inline void xyw(const vec3<T> &xyw) {
        this->xyw(xyw.x, xyw.y, xyw.z);
    }
    inline void gba(const vec3<T> &gba) {
        this->yzw(gba);
    }
    inline void yzw(const vec3<T> &yzw) {
        this->yzw(yzw.x, yzw.y, yzw.z);
    }

    inline void xy(T _x, T _y) {
        this->x = _x;
        this->y = _y;
    }

    inline void xz(T _x, T _z) {
        this->x = _x;
        this->z = _z;
    }

    inline void xw(T _x, T _w) {
        this->x = _x;
        this->w = _w;
    }

    inline void yz(T _y, T _z) {
        this->y = _y;
        this->z = _z;
    }

    inline void yw(T _y, T _w) {
        this->y = _y;
        this->w = _w;
    }

    inline void zw(T _z, T _w) {
        this->z = _z;
        this->w = _w;
    }

    inline void xyz(T _x, T _y, T _z) {
        xy(_x, _y);
        this->z = _z;
    }

    inline void xyw(T _x, T _y, T _w) {
        xy(_x, _y);
        this->w = _w;
    }

    inline void xzw(T _x, T _z, T _w) {
        xz(_x, _z);
        this->w = _w;
    }

    inline void yzw(T _y, T _z, T _w) {
        yz(_y, _z);
        this->w = _w;
    }

    // special common case
    inline void xyz(const vec4<T> &xyzw) {
        this->xyz(xyzw.x, xyzw.y, xyzw.z);
    }
    /// set the 4 components of the vector manually using a source pointer to a (large enough) array
    inline void set(const T* v) { std::memcpy(&_v[0], &v[0], sizeof(T) * 4); }
    /// set the 4 components of the vector manually
    inline void set(T value) { this->set(value, value, value, value); }
    /// set the 4 components of the vector manually
    inline void set(T _x, T _y, T _z, T _w) {
        this->x = _x;
        this->y = _y;
        this->z = _z;
        this->w = _w;
    }

    template <typename U>
    inline void set(U _x, U _y, U _z, U _w) {
        set(static_cast<T>(_x), static_cast<T>(_y), static_cast<T>(_z), static_cast<T>(_w));
    }

    /// set the 4 components of the vector using a source vector
    inline void set(const vec4 &v) { this->set(&v._v[0]); }
    /// set the 4 components of the vector using a smaller source vector
    inline void set(const vec3<T> &v) { this->set(v, w); }
    /// set the 4 components of the vector using a smaller source vector
    inline void set(const vec3<T> &v, T w_) { this->set(v.x, v.y, v.z, w_); }
    /// set the 4 components of the vector using a smaller source vector
    inline void set(const vec2<T> &v) { this->set(v.x, v.y, z, w); }
    /// set the 4 components of the vector using smallers source vectors
    inline void set(const vec2<T> &v1, const vec2<T> &v2) {
        this->set(v1.x, v1.y, v2.x, v2.y);
    }
    /// set all the components back to 0
    inline void reset() { this->set((T)0); }
    /// compare 2 vectors
    template<typename U>
    inline bool compare(const vec4<U> &v) const;
    /// compare 2 vectors within the specified tolerance
    template<typename U>
    inline bool compare(const vec4<U> &v, U epsi) const;
    /// swap the components  of this vector with that of the specified one
    inline void swap(vec4 *iv);
    /// swap the components  of this vector with that of the specified one
    inline void swap(vec4 &iv);
    /// transform the vector to unit length
    inline void normalize();
    /// calculate the dot product between this vector and the specified one
    inline T dot(const vec4 &v) const;
    /// return the vector's length
    inline T length() const { return Divide::Sqrt(lengthSquared()); }
    /// return the squared distance of the vector
    inline T lengthSquared() const;
    /// round all four values
    inline void round();
    /// lerp between this and the specified vector by the specified amount
    inline void lerp(const vec4 &v, T factor);
    /// lerp between this and the specified vector by the specified amount for
    /// each component
    inline void lerp(const vec4 &v, const vec4 &factor);
    union {
        struct {
            T x, y, z, w;
        };
        struct {
            T s, t, p, q;
        };
        struct {
            T r, g, b, a;
        };
        struct {
            T fov, ratio, znear, zfar;
        };
        struct {
            T width, height, depth, key;
        };
        T _v[4];
        simd_vector<T> _reg;
    };
};
//#pragma pack(pop)

/// lerp between the 2 specified vectors by the specified amount
template <typename T>
inline vec4<T> Lerp(const vec4<T> &u, const vec4<T> &v, T factor);
/// lerp between the 2 specified vectors by the specified amount for each
/// component
template <typename T>
inline vec4<T> Lerp(const vec4<T> &u, const vec4<T> &v, const vec4<T> &factor);
/// min/max functions
template <typename T>
inline vec4<T> Min(const vec4<T> &v1, const vec4<T> &v2);
template <typename T>
inline vec4<T> Max(const vec4<T> &v1, const vec4<T> &v2);
template <typename T>
inline vec4<T> Normalize(vec4<T> &vector);
template <typename T>
inline vec4<T> Normalize(const vec4<T> &vector);
/// multiply a vector by a value
template <typename T>
inline vec4<T> operator*(T fl, const vec4<T> &v);

/// Quaternion multiplications require these to be floats
extern vec2<F32> VECTOR2_ZERO;
extern vec3<F32> VECTOR3_ZERO;
extern vec4<F32> VECTOR4_ZERO;
extern vec2<F32> VECTOR2_UNIT;
extern vec3<F32> VECTOR3_UNIT;
extern vec4<F32> VECTOR4_UNIT;
extern vec3<F32> WORLD_X_AXIS;
extern vec3<F32> WORLD_Y_AXIS;
extern vec3<F32> WORLD_Z_AXIS;
extern vec3<F32> WORLD_X_NEG_AXIS;
extern vec3<F32> WORLD_Y_NEG_AXIS;
extern vec3<F32> WORLD_Z_NEG_AXIS;
extern vec3<F32> DEFAULT_GRAVITY;
extern vec4<F32> UNIT_RECT;

extern vec2<I32> iVECTOR2_ZERO;
extern vec3<I32> iVECTOR3_ZERO;
extern vec4<I32> iVECTOR4_ZERO;
extern vec3<I32> iWORLD_X_AXIS;
extern vec3<I32> iWORLD_Y_AXIS;
extern vec3<I32> iWORLD_Z_AXIS;
extern vec3<I32> iWORLD_X_NEG_AXIS;
extern vec3<I32> iWORLD_Y_NEG_AXIS;
extern vec3<I32> iWORLD_Z_NEG_AXIS;

};  // namespace Divide

// Inline definitions
#include "MathVectors.inl"

#endif

Commits for Divide-Framework/trunk/Source Code/Core/Math/Headers/MathVectors.h

Diff revisions: vs.
Revision Author Commited Message
893 Diff Diff IonutCava picture IonutCava Sun 18 Jun, 2017 17:33:07 +0000

[Ionut]
- Initial implementation of a PipelineStateObject (holds shader program, rasterizer state, etc)
- Rework PCH implementation a bit because VS2017 no longer has a /ZM option

882 Diff Diff IonutCava picture IonutCava Thu 23 Mar, 2017 16:49:48 +0000

[IonutCava]
- More work on tessellated terrain rendering: got the mesh to render properly and match the collision mesh’s layout.
- Fixed a bug with GenericDrawCommand RenderOptions
- Added a “query number of generated primitives” option to GenericDrawCommand

867 Diff Diff IonutCava picture IonutCava Mon 20 Feb, 2017 17:01:12 +0000

[IonutCava]
- Rename to_XNN and to_const_XNN functions to reflect the target data type they are converting to.
- Cleanup Angle namespace and remove all “inDegrees” parameters from rotation functions. Use aliases to differentiate between Degree and Radian parameters.
- Profile guided optimizations.

865 Diff Diff IonutCava picture IonutCava Sun 19 Feb, 2017 21:08:03 +0000

[IonutCava]
- SSE2 optimizations for float variants of mat4 and vec4
- Small bug fixed in refraction and reflection texture debug views

864 Diff Diff IonutCava picture IonutCava Thu 16 Feb, 2017 17:29:19 +0000

[IonutCava]
- Profile guided optimizations

853 Diff Diff IonutCava picture IonutCava Tue 07 Feb, 2017 21:43:58 +0000

[IonutCava]
- More work on water rendering.

836 Diff Diff IonutCava picture IonutCava Fri 27 Jan, 2017 14:59:56 +0000

[IonutCava]
- Update copyright notice

828 Diff Diff IonutCava picture IonutCava Mon 23 Jan, 2017 17:19:22 +0000

[Ionut]
- XML loading/saving cleanup PART I

790 Diff Diff IonutCava picture IonutCava Wed 02 Nov, 2016 17:06:20 +0000

[IonutCava]
- Fix a few crashes:
— Missing language file during startup causes crash instead of log + exit
— Closing application causes crash due to RenderTarget cleanup of the GPU Object arena
-— Still not fully fixed: leaking graphics resources on shutdown
- Make mat and vec constructors and assignment operators “noexcept” (helps with usage in containers)
- Add a “NonMovable” class, similar to the “NonCopyable” class to help with readability in certain situations

750 IonutCava picture IonutCava Thu 07 Jul, 2016 16:02:03 +0000

[IonutCava]
- Static analysis based fixes and improvements