From f6661b0243cb359fb4929aee06d1247944f3d2dd Mon Sep 17 00:00:00 2001 From: Keuin Date: Mon, 11 Apr 2022 21:32:45 +0800 Subject: Implement vec3::zero(). --- vec.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'vec.h') 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}; } -- cgit v1.2.3