further sse simd additions

avx2 float3 added
added normalize_magnitude
added divide fast to float3 may copy to float4

move static spheremesh to drawSphere (initialize on first use) so platform has a chance to load the math backend
This commit is contained in:
marauder2k7 2026-02-26 21:11:31 +00:00
parent 2559145c06
commit 18d0aa0418
16 changed files with 337 additions and 77 deletions

View file

@ -1,6 +1,6 @@
#include "math/public/float4_dispatch.h"
#include "math/mConstants.h"
#include <math.h>
#include <cmath> // for sqrtf, etc.
namespace math_backend::float4::dispatch
{
@ -27,7 +27,8 @@ namespace math_backend::float4::dispatch
};
gFloat4.div_scalar = [](const float* a, float s, float* r) {
for (int i = 0; i < 4; i++) r[i] = a[i] / s;
float denom = 1.0f / s;
for (int i = 0; i < 4; i++) r[i] = a[i] * denom;
};
gFloat4.dot = [](const float* a, const float* b) {
@ -39,7 +40,7 @@ namespace math_backend::float4::dispatch
gFloat4.length = [](const float* a) {
float sum = 0.f;
for (int i = 0; i < 4; i++) sum += a[i] * a[i];
return sqrtf(sum);
return std::sqrt(sum);
};
gFloat4.lengthSquared = [](const float* a) {