# 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:
2025-07-23 23:21:34 +02:00
parent 31a0c3656f
commit 87910b57de
31 changed files with 1085 additions and 276 deletions

View File

@ -23,9 +23,12 @@ 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>
#include <pd/core/vec2.hpp> // Extended
// Extended includes (rename if you use other filenames/paths)
#include <pd/core/vec2.hpp>
#include <pd/core/vec3.hpp>
namespace PD {
template <typename T>
@ -36,9 +39,11 @@ class vec4 {
T z;
T w;
vec4() : x(0), y(0), z(0), w(0) {}
// Constructors
constexpr vec4() : x(0), y(0), z(0), w(0) {}
template <typename T1>
explicit vec4(T1 v) {
constexpr vec4(T1 v) {
x = (T)v;
y = (T)v;
z = (T)v;
@ -46,23 +51,37 @@ class vec4 {
}
template <typename T1>
explicit vec4(vec4<T1> v) {
constexpr vec4(const vec4<T1>& v) {
x = (T)v.x;
y = (T)v.y;
z = (T)v.z;
w = (T)v.w;
}
/** Extended Constructor */
constexpr explicit vec4(T x, T y, T z, T w) : x(x), y(y), z(z), w(w) {}
// Extended Constructors
template <typename T1>
explicit vec4(vec2<T1> a, vec2<T1> b) {
x = (T)a.x;
y = (T)a.y;
z = (T)b.x;
w = (T)b.y;
constexpr explicit vec4(const vec2<T1>& xy, const vec2<T1>& zw) {
{
x = (T)xy.x;
y = (T)xy.y;
z = (T)zw.x;
w = (T)zw.y;
}
}
vec4(T x, T y, T z, T w) : x(x), y(y), z(z), w(w) {}
template <typename T1>
constexpr explicit vec4(const vec3<T1>& xyz, T1 w) {
{
x = (T)xyz.x;
y = (T)xyz.y;
z = (T)xyz.z;
this->w = (T)w;
}
}
// Operations
template <typename T1>
vec4<T>& operator+=(T1 v) {
@ -176,16 +195,42 @@ class vec4 {
return vec4<T>(x / (T)v.x, y / (T)v.y, z / (T)v.z, w / (T)v.w);
}
vec4 operator-() const { return vec4(-x, -y, -z, -w); }
// Generic Operations
bool operator==(const vec4& v) const {
return x == v.x && y == v.y && z == v.z && w == v.w;
vec4 operator-() const { return vec4(-x, -y, -z, -w); }
template <typename T1>
bool operator==(const vec4<T1>& v) const {
return x == (T)v.x && y == (T)v.y && z == (T)v.z && w == (T)v.w;
}
bool operator!=(const vec4& v) const { return !(*this == v); }
template <typename T1>
bool operator!=(const vec4<T1>& v) const {
return !(*this == v);
}
// Functions
double Len() const { return std::sqrt(SqLen()); }
double SqLen() const { return x * x + y * y + z * z + w * w; }
template <typename T1>
double Distance(const vec4<T1>& v) const {
return (*this - v).Len();
}
vec4<T> Normalize() const {
double l = Len();
if (l == 0) {
return *this;
}
return *this / (T)l;
}
template <typename T1>
T Dot(const vec4<T1>& v) const {
return x * (T)v.x + y * (T)v.y + z * (T)v.z + w * (T)v.w;
}
// Swap Functions
void SwapXY() {
T t = x;
x = y;
@ -218,6 +263,6 @@ class vec4 {
}
};
using fvec4 = vec4<float>;
using dvec4 = vec4<double>;
using ivec4 = vec4<int>;
using dvec4 = vec4<double>;
} // namespace PD