Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 853 vs 864 for /trunk/Source Code/Core/Math/Headers/MathVectors.h

Diff revisions: vs.
  @@ -264,9 +264,8 @@
264 264 std::swap(this->x, iv.x);
265 265 std::swap(this->x, iv.x);
266 266 }
267 - /// set the 2 components of the vector manually using a source pointer to a
268 - /// (large enough) array
269 - inline void setV(const T *v) { this->set(v[0], v[1]); }
267 + /// set the 2 components of the vector manually using a source pointer to a (large enough) array
268 + inline void set(const T* v) { std::memcpy(&_v[0], &v[0], sizeof(T) * 2); }
270 269 /// set the 2 components of the vector manually
271 270 inline void set(T value) { this->set(value, value); }
272 271 /// set the 2 components of the vector manually
  @@ -280,7 +279,7 @@
280 279 this->y = static_cast<T>(_y);
281 280 }
282 281 /// set the 2 components of the vector using a source vector
283 - inline void set(const vec2<T> &v) { this->set(v.x, v.y); }
282 + inline void set(const vec2 &v) { this->set(&v._v[0]); }
284 283 /// set the 2 components of the vector using the first 2 components of the
285 284 /// source vector
286 285 inline void set(const vec3<T> &v) { this->set(v.x, v.y); }
  @@ -288,7 +287,7 @@
288 287 /// source vector
289 288 inline void set(const vec4<T> &v) { this->set(v.x, v.y); }
290 289 /// set the 2 components of the vector back to 0
291 - inline void reset() { this->set(0); }
290 + inline void reset() { this->set((T)0); }
292 291 /// return the vector's length
293 292 inline T length() const {
294 293 return std::sqrt(this->x * this->x + this->y * this->y);
  @@ -558,9 +557,8 @@
558 557 this->z = yz.y;
559 558 }
560 559
561 - /// set the 3 components of the vector manually using a source pointer to a
562 - /// (large enough) array
563 - inline void setV(const T *v) { this->set(v[0], v[1], v[2]); }
560 + /// set the 3 components of the vector manually using a source pointer to a (large enough) array
561 + inline void set(const T* v) { std::memcpy(&_v[0], &v[0], sizeof(T) * 3); }
564 562 /// set the 3 components of the vector manually
565 563 inline void set(T value) { this->set(value, value, value); }
566 564 /// set the 3 components of the vector manually
  @@ -578,12 +576,12 @@
578 576 /// set the 3 components of the vector using a smaller source vector
579 577 inline void set(const vec2<T> &v) { this->set(v.x, v.y, z); }
580 578 /// set the 3 components of the vector using a source vector
581 - inline void set(const vec3<T> &v) { this->set(v.x, v.y, v.z); }
579 + inline void set(const vec3 &v) { this->set(&v._v[0]); }
582 580 /// set the 3 components of the vector using the first 3 components of the
583 581 /// source vector
584 582 inline void set(const vec4<T> &v) { this->set(v.x, v.y, v.z); }
585 583 /// set all the components back to 0
586 - inline void reset() { this->set(0); }
584 + inline void reset() { this->set((T)0); }
587 585 /// return the vector's length
588 586 inline T length() const { return std::sqrt(lengthSquared()); }
589 587 /// return true if length is zero
  @@ -1015,9 +1013,8 @@
1015 1013 inline void xyz(const vec4<T> &xyzw) {
1016 1014 this->xyz(xyzw.x, xyzw.y, xyzw.z);
1017 1015 }
1018 - /// set the 4 components of the vector manually using a source pointer to a
1019 - /// (large enough) array
1020 - inline void setV(const T *v) { this->set(v[0], v[1], v[2], v[3]); }
1016 + /// set the 4 components of the vector manually using a source pointer to a (large enough) array
1017 + inline void set(const T* v) { std::memcpy(&_v[0], &v[0], sizeof(T) * 4); }
1021 1018 /// set the 4 components of the vector manually
1022 1019 inline void set(T value) { this->set(value, value, value, value); }
1023 1020 /// set the 4 components of the vector manually
  @@ -1034,7 +1031,7 @@
1034 1031 }
1035 1032
1036 1033 /// set the 4 components of the vector using a source vector
1037 - inline void set(const vec4 &v) { this->setV(v._v); }
1034 + inline void set(const vec4 &v) { this->set(&v._v[0]); }
1038 1035 /// set the 4 components of the vector using a smaller source vector
1039 1036 inline void set(const vec3<T> &v) { this->set(v, w); }
1040 1037 /// set the 4 components of the vector using a smaller source vector
  @@ -1046,7 +1043,7 @@
1046 1043 this->set(v1.x, v1.y, v2.x, v2.y);
1047 1044 }
1048 1045 /// set all the components back to 0
1049 - inline void reset() { this->set(0); }
1046 + inline void reset() { this->set((T)0); }
1050 1047 /// compare 2 vectors
1051 1048 template<typename U>
1052 1049 inline bool compare(const vec4<U> &v) const;