#pragma once //4 Dimensional Vector structure template struct vec4 { T x,y,z,w; vec4() : x(0), y(0), z(0), w(0) {} vec4(T def) : x(def), y(def), z(def), w(def) {} vec4(T X, T Y, T Z, T W) : x(X), y(Y), z(Z), w(W) {} template explicit vec4(const vec4& other) : x((T)other.x), y((T)other.y), z((T)other.z), w((T)other.w) {} vec4& operator=(const vec4& other) { x = other.x; y = other.y; z = other.z; w = other.w; return *this; } bool operator==(const vec4& other) { return x == other.x && y == other.y && z == other.z && w == other.w; } vec4 operator*(T scalar) const { return vec4(x * scalar, y * scalar, z * scalar, w * scalar); } vec4& operator+=(const vec4& other) { x += other.x; y += other.y; z += other.z; w += other.w; return *this; } bool zero() { return x == 0.0 && y == 0.0 && z == 0.0 && w == 0.0; } }; typedef vec4 vec4f; typedef vec4 vec4d; typedef vec4 vec4i;