Commit 77ce866a by Kai Westerkamp

update ui

parent bf238c0c
...@@ -48,10 +48,6 @@ void Mesh::MeshEntry::init(QOpenGLFunctions_4_3_Core *f,QVector<Vertex>& Vertice ...@@ -48,10 +48,6 @@ void Mesh::MeshEntry::init(QOpenGLFunctions_4_3_Core *f,QVector<Vertex>& Vertice
} }
void Mesh::MeshEntry::update(GLuint VB, QVector<Vertex>& Vertices, QVector<unsigned int>& Indices){ void Mesh::MeshEntry::update(GLuint VB, QVector<Vertex>& Vertices, QVector<unsigned int>& Indices){
numIndex = Indices.size(); numIndex = Indices.size();
indices = Indices; indices = Indices;
vertices = Vertices; vertices = Vertices;
...@@ -370,7 +366,7 @@ void Mesh::initMeshEntry(int index, aiMesh * entry){ ...@@ -370,7 +366,7 @@ void Mesh::initMeshEntry(int index, aiMesh * entry){
} }
void Mesh::render(QOpenGLShaderProgram *shader, QMatrix4x4 V,QMatrix4x4 P){ void Mesh::render(QOpenGLShaderProgram *shader, QMatrix4x4 V,QMatrix4x4 P, int subdivision){
if(!loaded) if(!loaded)
return; return;
if(f == NULL){ if(f == NULL){
...@@ -382,7 +378,7 @@ void Mesh::render(QOpenGLShaderProgram *shader, QMatrix4x4 V,QMatrix4x4 P){ ...@@ -382,7 +378,7 @@ void Mesh::render(QOpenGLShaderProgram *shader, QMatrix4x4 V,QMatrix4x4 P){
f->glEnableVertexAttribArray(normalIndex); f->glEnableVertexAttribArray(normalIndex);
f->glEnableVertexAttribArray(uvIndex); f->glEnableVertexAttribArray(uvIndex);
renderNode(shader,rootNode,V*screenTransform,P,QMatrix4x4()); renderNode(shader,rootNode,V*screenTransform,P,QMatrix4x4(),subdivision);
f->glDisableVertexAttribArray(positionIndex); f->glDisableVertexAttribArray(positionIndex);
f->glDisableVertexAttribArray(normalIndex); f->glDisableVertexAttribArray(normalIndex);
...@@ -392,7 +388,7 @@ void Mesh::render(QOpenGLShaderProgram *shader, QMatrix4x4 V,QMatrix4x4 P){ ...@@ -392,7 +388,7 @@ void Mesh::render(QOpenGLShaderProgram *shader, QMatrix4x4 V,QMatrix4x4 P){
} }
void Mesh::renderNode(QOpenGLShaderProgram *shader, Node &node, QMatrix4x4 V,QMatrix4x4 P,QMatrix4x4 M){ void Mesh::renderNode(QOpenGLShaderProgram *shader, Node &node, QMatrix4x4 V,QMatrix4x4 P,QMatrix4x4 M, int subdivision){
M *= node.transformation; M *= node.transformation;
QMatrix4x4 MV = V*M; QMatrix4x4 MV = V*M;
...@@ -406,15 +402,15 @@ void Mesh::renderNode(QOpenGLShaderProgram *shader, Node &node, QMatrix4x4 V,QMa ...@@ -406,15 +402,15 @@ void Mesh::renderNode(QOpenGLShaderProgram *shader, Node &node, QMatrix4x4 V,QMa
for (int i = 0 ; i < node.meshes.size() ; i++) { for (int i = 0 ; i < node.meshes.size() ; i++) {
int index = node.meshes[i]; int index = node.meshes[i];
//load Material //load Material
renderMesh(shader, index); renderMesh(shader, index,subdivision);
} }
for (int i = 0 ; i < node.children.size() ; i++) { for (int i = 0 ; i < node.children.size() ; i++) {
renderNode(shader,node.children[i],V,P,M); renderNode(shader,node.children[i],V,P,M, subdivision);
} }
} }
void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index) void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision)
{ {
int MaterialIndex = entries[index].materialIndex; int MaterialIndex = entries[index].materialIndex;
if (MaterialIndex < materials.size()) { if (MaterialIndex < materials.size()) {
......
...@@ -51,7 +51,7 @@ public: ...@@ -51,7 +51,7 @@ public:
Mesh(QOpenGLFunctions_4_3_Core *f, Mesh *mesh, QVector<Vertex> &vertex_buffer, QVector<GLuint> &index_buffer); Mesh(QOpenGLFunctions_4_3_Core *f, Mesh *mesh, QVector<Vertex> &vertex_buffer, QVector<GLuint> &index_buffer);
~Mesh(); ~Mesh();
void render(QOpenGLShaderProgram *shader, QMatrix4x4 V,QMatrix4x4 P); void render(QOpenGLShaderProgram *shader, QMatrix4x4 V,QMatrix4x4 P, int subdivision);
const aiScene *scene; const aiScene *scene;
bool debug = true; bool debug = true;
...@@ -127,8 +127,8 @@ private: ...@@ -127,8 +127,8 @@ private:
void initNode(const aiScene *scene, aiNode *node, Node &newNode, QString debugoffset); void initNode(const aiScene *scene, aiNode *node, Node &newNode, QString debugoffset);
void renderNode(QOpenGLShaderProgram *shader, Node &node, QMatrix4x4 V,QMatrix4x4 P,QMatrix4x4 M); void renderNode(QOpenGLShaderProgram *shader, Node &node, QMatrix4x4 V,QMatrix4x4 P,QMatrix4x4 M, int subdivision);
void renderMesh(QOpenGLShaderProgram *shader, int index); void renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision);
void findObjectDimension(Node node, QMatrix4x4 transform, QVector3D &min, QVector3D &max); void findObjectDimension(Node node, QMatrix4x4 transform, QVector3D &min, QVector3D &max);
......
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