Rune Engine  Version 0.2.7-alpha
Documentation for how to make games using the Rune Engine.
vec3.h
1 #pragma once
2 
11 #include <core.h>
12 #include <iostream>
13 
14 #ifndef VEC3_H_DEFINED
15 #define VEC3_H_DEFINED
16 
17 namespace rune{
18 
19 class Vec2;
20 
21 class RUNE_ENGINE Vec3
22 {
23 
24 public:
26  double x;
28  double y;
30  double z;
32  Vec3(double newX = 0, double newY = 0, double newZ = 0);
36  Vec3 operator- (const Vec3& right);
38  Vec3 operator-();
40  Vec3 operator+ (const Vec3& right);
42  Vec3 operator* (const Vec3& right);
44  Vec3 operator/ (const Vec3& right);
46  Vec3 operator/ (double scalar);
48  Vec3& operator-=(const Vec3& right);
50  Vec3& operator+=(const Vec3& right);
52  Vec3& operator*=(const Vec3& right);
54  Vec3& operator*=(const double right);
56  Vec3 operator* (double scalar);
58  bool operator==(const Vec3& right);
60  bool operator!=(const Vec3& right);
62  double magnitude(void);
63 
64 };
66 RUNE_ENGINE std::ostream& operator<<(std::ostream& os, const Vec3& vector);
68 RUNE_ENGINE double dotProduct(const rune::Vec3& vector1, const rune::Vec3& vector2);
70 RUNE_ENGINE rune::Vec3 normalize(const rune::Vec3& vector);
72 RUNE_ENGINE rune::Vec3 crossProduct(const rune::Vec3&, const rune::Vec3&);
74 RUNE_ENGINE rune::Vec3 operator*(double scalar, const rune::Vec3& vec);
75 
76 }
77 #endif
rune::Vec3::y
double y
Y coordinate of the vector.
Definition: vec3.h:28
rune::Vec3
1 x 3 vector to be used for math.
Definition: vec3.h:22
rune::operator<<
RUNE_ENGINE std::ostream & operator<<(std::ostream &os, const rune::Vec2 &vector)
Stream operator overloading so that vectors can be printed to the console.
rune::Vec3::z
double z
Z coordinate of the vector.
Definition: vec3.h:30
rune::Vec3::x
double x
X coordinate of the vector.
Definition: vec3.h:26
rune::crossProduct
RUNE_ENGINE double crossProduct(rune::Vec2 const &vec1, rune::Vec2 const &vec2)
Cross product calculation of two vectors.
rune::Vec2
1 x 2 vector to be used for math.
Definition: vec2.h:20
rune::normalize
RUNE_ENGINE rune::Vec2 normalize(rune::Vec2 const &vec)
Divides each component of a vector by the vector magnitude to make the vector magnitude equal to 1.
rune::dotProduct
RUNE_ENGINE double dotProduct(rune::Vec2 const &vector1, rune::Vec2 const &vector2)
Dot product calculation of two vectors.
rune::operator/
RUNE_ENGINE Vec2 operator/(double scalar, Vec2 vec)
Overload of / operator for a scalar.
rune
The main namespace to be used for interfacing with the engine.
Definition: animator.h:21
rune::operator*
RUNE_ENGINE rune::Vec2 operator*(rune::Vec2 const &vec, rune::Mat2 &mat)
Overload of multiplication operator for a rune::Mat2.