vector add

also removes a dummy duplicate, nice catch Diamante
This commit is contained in:
Skull 2022-06-26 02:07:55 +03:00
parent 1d56b0f622
commit fa410358ef
3 changed files with 8 additions and 5 deletions

View File

@ -156,11 +156,6 @@ namespace scripting::lua
return normalize_vector(a);
};
vector_type["normalize"] = [](const vector& a)
{
return normalize_vector(a);
};
vector_type["toangles"] = [](const vector& a)
{
return call("vectortoangles", {a}).as<vector>();

View File

@ -47,6 +47,13 @@ namespace utils::vector
out[2] = veca[2] - vecb[2];
}
void add(const float* veca, const float* vecb, float* out)
{
out[0] = veca[0] + vecb[0];
out[1] = veca[1] + vecb[1];
out[2] = veca[2] + vecb[2];
}
float length(float* v)
{
return sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);

View File

@ -7,6 +7,7 @@ namespace utils::vector
void scale(const float* in, float scale, float* out);
void ma(const float* v1, float scale, const float* v2, float* out);
void subtract(const float* veca, const float* vecb, float* out);
void add(const float* veca, const float* vecb, float* out);
float length(float* v);
float product(const float* v1, const float* v2);
}