aboutsummaryrefslogtreecommitdiff
path: root/vec3.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'vec3.cpp')
-rw-r--r--vec3.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/vec3.cpp b/vec3.cpp
index 51d4870..e894a01 100644
--- a/vec3.cpp
+++ b/vec3.cpp
@@ -88,6 +88,13 @@ std::ostream &operator<<(std::ostream &output, const vec3 &v) {
return output << v[0] << " " << v[1] << " " << v[2];
}
+std::istream &operator>>(std::istream &input, vec3 &v)
+{
+ if(!(input >> v[0] >> v[1] >> v[2]))
+ throw "error parsing vector";
+ return input;
+}
+
vec3 operator*(scalar scale, const vec3 &v)
{
return v * scale;