Fireworks Engine  v2.0
Lightweight Sandbox Game Engine using OpenGL for additional Customisation and Quick Prototyping
vec4.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <iostream>
4 
5 namespace fireworks { namespace maths {
6 
7  struct vec4
8  {
9  float x, y, z, w;
10 
11  vec4() = default;
12  vec4(const float& x, const float& y, const float& z, const float& w);
13 
14  vec4& add(const vec4& other);
15  vec4& subtract(const vec4& other);
16  vec4& mutiply(const vec4& other);
17  vec4& divide(const vec4& other);
18 
19  /*
20  * friend because we are passing the left and right explicitly and not using
21  * this pointer we dont want to pass in the this pointer to the function hence
22  * we mark them as non-member friend and still give it access to the private members
23  */
24  friend vec4 operator+(vec4 left, const vec4& right);
25  friend vec4 operator-(vec4 left, const vec4& right);
26  friend vec4 operator*(vec4 left, const vec4& right);
27  friend vec4 operator/(vec4 left, const vec4& right);
28 
29  bool operator==(const vec4& other);
30  bool operator!=(const vec4& other);
31 
32  vec4& operator+=(const vec4& other);
33  vec4& operator-=(const vec4& other);
34  vec4& operator*=(const vec4& other);
35  vec4& operator/=(const vec4& other);
36 
37  friend std::ostream& operator<<(std::ostream& stream, const vec4& vector);
38  };
39 
40 } }
vec4 & operator+=(const vec4 &other)
Definition: vec4.cpp:90
friend vec4 operator/(vec4 left, const vec4 &right)
Definition: vec4.cpp:75
vec4 & divide(const vec4 &other)
Definition: vec4.cpp:50
float y
Definition: vec4.h:9
vec4 & operator/=(const vec4 &other)
Definition: vec4.cpp:105
bool operator==(const vec4 &other)
Definition: vec4.cpp:80
vec4 & mutiply(const vec4 &other)
Definition: vec4.cpp:41
friend vec4 operator-(vec4 left, const vec4 &right)
Definition: vec4.cpp:65
Definition: audioclip.cpp:3
friend vec4 operator+(vec4 left, const vec4 &right)
Definition: vec4.cpp:60
vec4 & operator-=(const vec4 &other)
Definition: vec4.cpp:95
float z
Definition: vec4.h:9
vec4 & subtract(const vec4 &other)
Definition: vec4.cpp:32
float x
Definition: vec4.h:9
bool operator!=(const vec4 &other)
Definition: vec4.cpp:85
Definition: vec4.h:7
vec4 & add(const vec4 &other)
Definition: vec4.cpp:22
vec4 & operator*=(const vec4 &other)
Definition: vec4.cpp:100
friend vec4 operator*(vec4 left, const vec4 &right)
Definition: vec4.cpp:70
friend std::ostream & operator<<(std::ostream &stream, const vec4 &vector)
Definition: vec4.cpp:110
float w
Definition: vec4.h:9