Euphoria
vec4.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "base/vec3.h"
4 
5 #include "assert/assert.h"
6 #include "base/numeric.h"
7 
8 
9 
10 namespace eu
11 {
12  // represents a homogeneous coordinate
13  struct vec4f
14  {
15  float x;
16  float y;
17  float z;
18  float w;
19 
20  explicit vec4f(float a);
21  vec4f(float ax, float ay, float az, float aw);
22 
24  vec4f(const vec3f& a, float aw);
25 
26  // todo(Gustav): make explicit?
27  vec4f(const Scale3f& a);
28 
29  explicit vec4f(const float* a);
30 
31  float* get_data_ptr();
32 
34  [[nodiscard]] vec3f to_vec3(float ww) const;
35 
36  // todo(Gustav): replace this and instead always call the assert version (above)
37  [[nodiscard]] vec3f to_vec3() const;
38 
39  [[nodiscard]] const float* get_data_ptr() const;
40 
41  bool operator==(const vec4f& rhs) = delete;
42  };
43 
44  std::string to_string(const vec4f& v);
45 }
46 
Definition: assert.h:90
std::string to_string(const Aabb &a)
Definition: aabb.cc:110
Definition: vec3.h:48
Definition: vec4.h:14
float * get_data_ptr()
Definition: vec4.cc:67
float w
Definition: vec4.h:18
float x
Definition: vec4.h:15
float y
Definition: vec4.h:16
float z
Definition: vec4.h:17
bool operator==(const vec4f &rhs)=delete
vec3f to_vec3() const
Definition: vec4.cc:60
vec4f(float a)
Definition: vec4.cc:6
ADD_DEFAULT_FORMATTER(eu::vec4f, std::string, eu::to_string)