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