feat(srcVector): Added operators
This commit is contained in:
parent
77847354c7
commit
f8784c3255
@ -32,6 +32,42 @@ namespace rage
|
|||||||
scrVector(float x, float y, float z) :
|
scrVector(float x, float y, float z) :
|
||||||
x(x), y(y), z(z)
|
x(x), y(y), z(z)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
scrVector operator+(const scrVector& other)
|
||||||
|
{
|
||||||
|
scrVector vec;
|
||||||
|
vec.x = this->x + other.x;
|
||||||
|
vec.y = this->y + other.y;
|
||||||
|
vec.z = this->z + other.z;
|
||||||
|
return vec;
|
||||||
|
}
|
||||||
|
|
||||||
|
scrVector operator-(const scrVector& other)
|
||||||
|
{
|
||||||
|
scrVector vec;
|
||||||
|
vec.x = this->x - other.x;
|
||||||
|
vec.y = this->y - other.y;
|
||||||
|
vec.z = this->z - other.z;
|
||||||
|
return vec;
|
||||||
|
}
|
||||||
|
|
||||||
|
scrVector operator*(const scrVector& other)
|
||||||
|
{
|
||||||
|
scrVector vec;
|
||||||
|
vec.x = this->x * other.x;
|
||||||
|
vec.y = this->y * other.y;
|
||||||
|
vec.z = this->z * other.z;
|
||||||
|
return vec;
|
||||||
|
}
|
||||||
|
|
||||||
|
scrVector operator*(const float& other)
|
||||||
|
{
|
||||||
|
scrVector vec;
|
||||||
|
vec.x = this->x * other;
|
||||||
|
vec.y = this->y * other;
|
||||||
|
vec.z = this->z * other;
|
||||||
|
return vec;
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
float x{};
|
float x{};
|
||||||
private:
|
private:
|
||||||
|
Reference in New Issue
Block a user