Commit 3ac32607 by Philipp Adolf

Move Vertex into its own files

parent a67450d5
...@@ -20,14 +20,16 @@ SOURCES += main.cpp\ ...@@ -20,14 +20,16 @@ SOURCES += main.cpp\
mesh.cpp \ mesh.cpp \
texture.cpp \ texture.cpp \
camera.cpp \ camera.cpp \
subdivision.cpp subdivision.cpp \
vertex.cpp
HEADERS += mainwindow.h \ HEADERS += mainwindow.h \
mainwidget.h \ mainwidget.h \
mesh.h \ mesh.h \
texture.h \ texture.h \
camera.h \ camera.h \
subdivision.h subdivision.h \
vertex.h
FORMS += FORMS +=
......
#include "mesh.h" #include "mesh.h"
QDebug operator<< (QDebug d, const Vertex &v) {
d.nospace() << "Vertex(" << v.pos << ", " << v.normal << ", " << v.tex << ")";
d.space();
return d;
}
Mesh::SubdivEntry::SubdivEntry() Mesh::SubdivEntry::SubdivEntry()
{ {
VB_handle = 0xFFFFFFFF; VB_handle = 0xFFFFFFFF;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <assimp/scene.h> #include <assimp/scene.h>
#include <postprocess.h> #include <postprocess.h>
#include "texture.h" #include "texture.h"
#include "vertex.h"
#define positionIndex 0 #define positionIndex 0
#define normalIndex 1 #define normalIndex 1
...@@ -16,34 +17,6 @@ ...@@ -16,34 +17,6 @@
#define EPSILON 0.00001 #define EPSILON 0.00001
struct Vertex
{
QVector3D pos;
float padding0;
QVector3D normal;
float padding1;
QVector2D tex;
QVector2D padding2;
Vertex(){}
Vertex(const QVector3D& pos, const QVector3D& normal, const QVector2D& tex)
{
this->pos = pos;
this->tex = tex;
this->normal = normal;
}
bool samePos(const Vertex& other) const{
return pos == other.pos;
}
};
QDebug operator<< (QDebug d, const Vertex &v);
class Mesh class Mesh
{ {
public: public:
......
#include "vertex.h"
Vertex::Vertex() {}
Vertex::Vertex(const QVector3D& pos, const QVector3D& normal, const QVector2D& tex) {
this->pos = pos;
this->tex = tex;
this->normal = normal;
}
bool Vertex::samePos(const Vertex& other) const {
return pos == other.pos;
}
QDebug operator<< (QDebug d, const Vertex &v) {
d.nospace() << "Vertex(" << v.pos << ", " << v.normal << ", " << v.tex << ")";
d.space();
return d;
}
#pragma once
#ifndef VERTEX_H
#include <QDebug>
#include <QVector2D>
#include <QVector3D>
#pragma pack(push, 1)
struct Vertex
{
QVector3D pos;
float padding0;
QVector3D normal;
float padding1;
QVector2D tex;
float padding2[2];
Vertex();
Vertex(const QVector3D& pos, const QVector3D& normal, const QVector2D& tex);
bool samePos(const Vertex& other) const;
};
#pragma pack(pop)
QDebug operator<< (QDebug d, const Vertex &v);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment