summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-04-11 21:32:45 +0800
committerKeuin <[email protected]>2022-04-11 21:32:45 +0800
commitf6661b0243cb359fb4929aee06d1247944f3d2dd (patch)
treef3bf29543bdfb89cb563bbb93337c404f46f7a70
parentd10ff99fc9bee538ebc7da23ba2f8b476ef151e1 (diff)
Implement vec3::zero().
-rw-r--r--vec.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/vec.h b/vec.h
index da7abeb..0e0b62d 100644
--- a/vec.h
+++ b/vec.h
@@ -30,6 +30,10 @@ struct vec3 {
T y;
T z;
+ static vec3 zero() {
+ return vec3{0, 0, 0};
+ }
+
vec3 operator+(const vec3 &b) const {
return vec3{.x=x + b.x, .y=y + b.y, .z=z + b.z};
}