HatchitMath
ht_vector3.h
1 
25 #pragma once
26 
27 #include <ht_platform.h>
28 #include <iostream>
29 #include <ostream>
30 #include <ht_scalar.h>
31 
32 namespace Hatchit
33 {
34  namespace Math
35  {
36  class Vector2;
37  class Vector4;
38 
39  class HT_API Vector3
40  {
41  friend class Matrix4;
42  public:
43  //Constructors
45  Vector3();
47  Vector3(float x, float y, float z);
49  Vector3(const Vector3& other);
51  Vector3(Vector4& v4);
52 
53  //Custom allocation/deallocation
55  void* operator new(size_t _size);
57  void operator delete(void* p);
59  operator const __m128(void) const;
60 
61  //Accessors & Mutators
63  float getX();
65  float getY();
67  float getZ();
68 
72  float getMagnitude();
76  float* getAsArray();
77 
81  void setX(float x);
85  void setY(float y);
89  void setZ(float z);
90 
91  //Static functions
92 
98  static Vector3 Cross(Vector3 v, Vector3 u);
104  static float Dot(Vector3 v, Vector3 u);
109  static Vector3 Normalize(Vector3 v);
110 
111  //Operators
112 
118  Vector3 operator* (float s);
124  Vector3 operator/ (float s);
130  Vector3 operator- (float s);
136  Vector3 operator+ (float s);
137 
143  Vector3 operator*= (float s);
149  Vector3 operator/= (float s);
155  Vector3 operator-= (float s);
161  Vector3 operator+= (float s);
162 
167  bool operator>(Vector3 u);
172  bool operator<(Vector3 u);
177  bool operator==(Vector3 u);
182  bool operator!=(Vector3 u);
183 
188  float operator* (Vector3 u);
189 
194  Vector3 operator+ (Vector3 u);
199  Vector3 operator- (Vector3 u);
204  Vector3 operator+= (Vector3 u);
209  Vector3 operator-= (Vector3 u);
210 
216  float& operator[] (int i);
217 
219  operator Vector4();
221  operator Vector2();
222 
223  private:
224  __m128 m_vector;
225  };
226 
231  HT_API std::ostream& operator<< (std::ostream& output, Vector3& h);
236  HT_API std::istream& operator>> (std::istream& input, Vector3& h);
237  }
238 }
Hatchit Engine Copyright(c) 2015-2016 Third-Degree.
Definition: ht_intrin.h:33
Hatchit Engine Copyright(c) 2015 Third-Degree.
Hatchit Engine Copyright(c) 2015 Third-Degree.
Hatchit Engine Copyright(c) 2015 Third-Degree.
Hatchit Engine Copyright(c) 2015 Third-Degree.