3 #include <boost/archive/text_iarchive.hpp>
4 #include <boost/archive/text_oarchive.hpp>
7 #include <glm/gtx/hash.hpp>
18 friend class boost::serialization::access;
25 template <
typename Archive>
26 void serialize(Archive& ar,
const unsigned int version) {
43 glm::dvec3
normal = glm::dvec3(0, 0, 0);
66 Vertex(
double const x,
double const y,
double const z) :
pos(x, y, z) {};
82 static double*
matxvec(
double** mat,
double* vec);
98 inline double getX()
const {
132 this->pos.x == v.
pos.x &&
133 this->pos.y == v.
pos.y &&
134 this->pos.z == v.
pos.z;
137 friend std::ostream& operator << (std::ostream& out,
Vertex * v);
147 bool operator() (
Vertex *
const & a,
Vertex * & b)
const{
162 size_t operator() (
Vertex *
const &v)
const{
163 std::hash<double> doubleHasher;
164 const size_t prime = 31;
166 hash = prime * hash + doubleHasher(v->
getX());
167 hash = prime * hash + doubleHasher(v->
getY());
168 hash = prime * hash + doubleHasher(v->
getZ());
Class representing a color with 4 float components: RGBA.
Definition: Color4f.h:10
Class representing a vertex.
Definition: Vertex.h:14
glm::dvec2 texcoords
Vertex texture coordinates.
Definition: Vertex.h:47
Color4f color
Vertex color (RGBA)
Definition: Vertex.h:52
Vertex(double const x, double const y, double const z)
Build a vertex with given position coordinates.
Definition: Vertex.h:66
glm::dvec3 pos
Vertex 3D position.
Definition: Vertex.h:39
Vertex copy() const
Copy the vertex.
Definition: Vertex.h:75
double getX() const
Get the X coordinate of vertex position.
Definition: Vertex.h:98
double getZ() const
Get the Z coordinate of vertex position.
Definition: Vertex.h:116
glm::dvec3 normal
Vertex normal vector.
Definition: Vertex.h:43
static Vertex rotateVertex(Vertex v, double **rotationMatrix)
Build a vertes result of rotating another vertex (v)
Definition: Vertex.cpp:29
static double * matxvec(double **mat, double *vec)
Matrix x Vector multiplication.
Definition: Vertex.cpp:15
Vertex()=default
Default vertex constructor.
bool operator==(const Vertex &v) const
Compare if two vertex are equal.
Definition: Vertex.h:130
double getY() const
Get the Y coordinate of vertex position.
Definition: Vertex.h:107
void serialize(Archive &ar, const unsigned int version)
Serialize a Vertex to a stream of bytes.
Definition: Vertex.h:26
Struct to compare vertex when using unordered set.
Definition: Vertex.h:146
Struct to obtain vertex hash when using unordered set.
Definition: Vertex.h:161