97 friend Vector3 operator*(const Vector3 &v, const float &f) |
97 friend Vector3 operator*(const Vector3 &v, const float &f) |
98 { |
98 { |
99 return Vector3(f * v.x, f * v.y, f * v.z); |
99 return Vector3(f * v.x, f * v.y, f * v.z); |
100 } |
100 } |
101 |
101 |
102 friend Vector3 operator*(const float &f, Vector3 &v) |
102 friend Vector3 operator*(const float &f, const Vector3 &v) |
103 { |
103 { |
104 return v * f; |
104 return v * f; |
105 }; |
105 }; |
|
106 |
|
107 // vector plus scalar |
|
108 friend Vector3 operator+(const Vector3 &v, const float &f) |
|
109 { |
|
110 return Vector3(v.x + f, v.y + f, v.z + f); |
|
111 } |
|
112 |
|
113 // vector minus scalar |
|
114 friend Vector3 operator-(const Vector3 &v, const float &f) |
|
115 { |
|
116 return Vector3(v.x - f, v.y - f, v.z - f); |
|
117 } |
106 |
118 |
107 // cell by cell product (only usable for colours) |
119 // cell by cell product (only usable for colours) |
108 friend Vector3 operator*(const Vector3 &a, const Vector3 &b) |
120 friend Vector3 operator*(const Vector3 &a, const Vector3 &b) |
109 { |
121 { |
110 return Vector3(a.x * b.x, a.y * b.y, a.z * b.z); |
122 return Vector3(a.x * b.x, a.y * b.y, a.z * b.z); |