Skip to content

Commit ec174e0

Browse files
committed
vector add
also removes a dummy duplicate, nice catch Diamante
1 parent 100924b commit ec174e0

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/client/game/scripting/lua/context.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,6 @@ namespace scripting::lua
156156
return normalize_vector(a);
157157
};
158158

159-
vector_type["normalize"] = [](const vector& a)
160-
{
161-
return normalize_vector(a);
162-
};
163-
164159
vector_type["toangles"] = [](const vector& a)
165160
{
166161
return call("vectortoangles", {a}).as<vector>();

src/common/utils/vector.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ namespace utils::vector
4646
out[1] = veca[1] - vecb[1];
4747
out[2] = veca[2] - vecb[2];
4848
}
49+
50+
void add(const float* veca, const float* vecb, float* out)
51+
{
52+
out[0] = veca[0] + vecb[0];
53+
out[1] = veca[1] + vecb[1];
54+
out[2] = veca[2] + vecb[2];
55+
}
4956

5057
float length(float* v)
5158
{

src/common/utils/vector.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace utils::vector
77
void scale(const float* in, float scale, float* out);
88
void ma(const float* v1, float scale, const float* v2, float* out);
99
void subtract(const float* veca, const float* vecb, float* out);
10+
void add(const float* veca, const float* vecb, float* out);
1011
float length(float* v);
1112
float product(const float* v1, const float* v2);
1213
}

0 commit comments

Comments
 (0)