# Changes
3ds Backend: - switch to shaderProgramUse Desktop Backend - Add Pre Alpha Text Input and Keyboard Support - Move Shader Attrib Setup into a function and callit every time we need a set up vbo - Move to Mat4 api Core: - Add fquat support - Add LoadFile2Str - Move Mat4 Lib from Project n73 to Palladium - Add full supprot for vec cross types - Add Normalize, Distance and Dot to all - Add Cross to vec3 Drivers: - Add a SetViewPort func to GFX - Add Keyboard keys and Flasg to Hid Image: - Add Vertical Flipping - Add Horizontal flipping UI7: - Fix Critical Bug in IO Viewport handler - Fix library list (error on MinGW for some reason) Lazyvec: - Split into multiple source files - Generate new functions (see core updates)
This commit is contained in:
		| @@ -23,7 +23,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
| SOFTWARE. | ||||
|  */ | ||||
|  | ||||
| // This file is generated by lazyvec | ||||
| // This file is generated by lazyvec 2.0.0 | ||||
|  | ||||
| #include <pd/core/common.hpp> | ||||
|  | ||||
| namespace PD { | ||||
| @@ -33,20 +34,24 @@ class vec2 { | ||||
|   T x; | ||||
|   T y; | ||||
|  | ||||
|   vec2() : x(0), y(0) {} | ||||
|   // Constructors | ||||
|  | ||||
|   constexpr vec2() : x(0), y(0) {} | ||||
|   template <typename T1> | ||||
|   vec2(T1 v) { | ||||
|   constexpr vec2(T1 v) { | ||||
|     x = (T)v; | ||||
|     y = (T)v; | ||||
|   } | ||||
|  | ||||
|   template <typename T1> | ||||
|   vec2(vec2<T1> v) { | ||||
|   constexpr vec2(const vec2<T1>& v) { | ||||
|     x = (T)v.x; | ||||
|     y = (T)v.y; | ||||
|   } | ||||
|  | ||||
|   vec2(T x, T y) : x(x), y(y) {} | ||||
|   constexpr explicit vec2(T x, T y) : x(x), y(y) {} | ||||
|  | ||||
|   // Operations | ||||
|  | ||||
|   template <typename T1> | ||||
|   vec2<T>& operator+=(T1 v) { | ||||
| @@ -144,14 +149,42 @@ class vec2 { | ||||
|     return vec2<T>(x / (T)v.x, y / (T)v.y); | ||||
|   } | ||||
|  | ||||
|   vec2 operator-() const { return vec2(-x, -y); } | ||||
|   // Generic Operations | ||||
|  | ||||
|   bool operator==(const vec2& v) const { return x == v.x && y == v.y; } | ||||
|   bool operator!=(const vec2& v) const { return !(*this == v); } | ||||
|   vec2 operator-() const { return vec2(-x, -y); } | ||||
|   template <typename T1> | ||||
|   bool operator==(const vec2<T1>& v) const { | ||||
|     return x == (T)v.x && y == (T)v.y; | ||||
|   } | ||||
|   template <typename T1> | ||||
|   bool operator!=(const vec2<T1>& v) const { | ||||
|     return !(*this == v); | ||||
|   } | ||||
|  | ||||
|   // Functions | ||||
|  | ||||
|   double Len() const { return std::sqrt(SqLen()); } | ||||
|   double SqLen() const { return x * x + y * y; } | ||||
|  | ||||
|   template <typename T1> | ||||
|   double Distance(const vec2<T1>& v) const { | ||||
|     return (*this - v).Len(); | ||||
|   } | ||||
|  | ||||
|   vec2<T> Normalize() const { | ||||
|     double l = Len(); | ||||
|     if (l == 0) { | ||||
|       return *this; | ||||
|     } | ||||
|     return *this / (T)l; | ||||
|   } | ||||
|  | ||||
|   template <typename T1> | ||||
|   T Dot(const vec2<T1>& v) const { | ||||
|     return x * (T)v.x + y * (T)v.y; | ||||
|   } | ||||
|  | ||||
|   // Swap Functions | ||||
|   void SwapXY() { | ||||
|     T t = x; | ||||
|     x = y; | ||||
| @@ -159,6 +192,6 @@ class vec2 { | ||||
|   } | ||||
| }; | ||||
| using fvec2 = vec2<float>; | ||||
| using dvec2 = vec2<double>; | ||||
| using ivec2 = vec2<int>; | ||||
| using dvec2 = vec2<double>; | ||||
| }  // namespace PD | ||||
|   | ||||
		Reference in New Issue
	
	Block a user