Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
Unterteilungsalgorithmen
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kai Westerkamp
Unterteilungsalgorithmen
Commits
393092be
Commit
393092be
authored
Aug 29, 2016
by
Kai Westerkamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FIXED DRAWING CONVEX HULL
parent
72000d21
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
23 deletions
+28
-23
main.cpp
QTProject/main.cpp
+1
-1
mainwidget.cpp
QTProject/mainwidget.cpp
+20
-14
mesh.cpp
QTProject/mesh.cpp
+2
-1
subdivide.tcs
QTProject/subdivide.tcs
+0
-1
subdivide.tes
QTProject/subdivide.tes
+0
-1
subdivideRegular.tcs
QTProject/subdivideRegular.tcs
+5
-5
No files found.
QTProject/main.cpp
View file @
393092be
...
...
@@ -5,7 +5,7 @@
int
main
(
int
argc
,
char
*
argv
[])
{
QApplication
a
(
argc
,
argv
);
QLoggingCategory
::
setFilterRules
(
"*.debug=false
\n
"
);
//
QLoggingCategory::setFilterRules("*.debug=false\n");
// If you want to enable debug output for some categories use something like this:
//QLoggingCategory::setFilterRules("*.debug=false\n"
...
...
QTProject/mainwidget.cpp
View file @
393092be
...
...
@@ -215,44 +215,50 @@ void MainWidget::paintGL(){
//TODO schön machen
rot
.
rotate
(
time
/
100.0
*
36
/
5
,
QVector3D
(
0
,
1
,
0
));
}
QMatrix4x4
view
=
cam
->
getMatrix
()
*
rot
;
QVector3D
light
=
QVector3D
(
0
,
100
,
100
);
//============= Regular Patches====================
regularShader
->
bind
();
regularShader
->
setUniformValue
(
"wireframe"
,
wireframe
);
regularShader
->
setUniformValue
(
"colorTexture"
,
0
);
regularShader
->
setUniformValue
(
"LightPos"
,
QVector3D
(
0
,
100
,
100
)
);
regularShader
->
setUniformValue
(
"LightPos"
,
light
);
regularShader
->
setUniformValue
(
"subdiv"
,
subdivLevel
);
mesh
->
render
(
regularShader
,
cam
->
getMatrix
()
*
rot
,
m_projection
,
subdivLevel
,
true
);
mesh
->
render
(
regularShader
,
view
,
m_projection
,
subdivLevel
,
true
);
if
(
subdivLevel
>
0
){
glEnable
(
GL_BLEND
);
glDepthMask
(
GL_FALSE
);
glBlendFunc
(
GL_SRC_ALPHA
,
GL_ONE_MINUS_SRC_ALPHA
);
regularShader
->
setUniformValue
(
"wireframe"
,
false
);
regularShader
->
setUniformValue
(
"subdiv"
,
0
);
mesh
->
render
(
regularShader
,
view
,
m_projection
,
0
,
true
);
glDisable
(
GL_BLEND
);
glDepthMask
(
GL_TRUE
);
}
regularShader
->
release
();
//============= Irregular Patches====================
subdivisionShader
->
bind
();
subdivisionShader
->
setUniformValue
(
"wireframe"
,
wireframe
);
subdivisionShader
->
setUniformValue
(
"colorTexture"
,
0
);
subdivisionShader
->
setUniformValue
(
"LightPos"
,
QVector3D
(
0
,
100
,
100
));
subdivisionShader
->
setUniformValue
(
"subdiv"
,
1
);
subdivisionShader
->
setUniformValue
(
"LightPos"
,
light
);
mesh
->
render
(
subdivisionShader
,
cam
->
getMatrix
()
*
rot
,
m_projection
,
subdivLevel
,
false
);
mesh
->
render
(
subdivisionShader
,
view
,
m_projection
,
subdivLevel
,
false
);
if
(
subdivLevel
>
0
){
glEnable
(
GL_BLEND
);
glDepthMask
(
GL_FALSE
);
glBlendFunc
(
GL_SRC_ALPHA
,
GL_ONE_MINUS_SRC_ALPHA
);
subdivisionShader
->
setUniformValue
(
"wireframe"
,
false
);
mesh
->
render
(
subdivisionShader
,
cam
->
getMatrix
()
*
rot
,
m_projection
,
0
,
false
);
mesh
->
render
(
subdivisionShader
,
view
,
m_projection
,
0
,
false
);
//mesh->render(subdivisionShader,view, m_projection,0,true);
glDisable
(
GL_BLEND
);
glDepthMask
(
GL_TRUE
);
}
subdivisionShader
->
release
();
update
();
}
...
...
QTProject/mesh.cpp
View file @
393092be
...
...
@@ -437,7 +437,7 @@ void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision,
// qCDebug(log_mesh) << materials[MaterialIndex].Diffuse << materials[MaterialIndex].Specular << materials[MaterialIndex].Shininess << materials[MaterialIndex].hasTexture;
if
(
regular
)
{
shader
->
setUniformValue
(
"materialInfo.Diffuse"
,
QVector3D
(
0.0
f
,
0.0
f
,
1.0
f
));
//
shader->setUniformValue("materialInfo.Diffuse", QVector3D(0.0f, 0.0f, 1.0f));
shader
->
setUniformValue
(
"materialInfo.Diffuse"
,
QVector3D
(
243.0
,
156.0
,
18.0
)
/
255.0
);
// shader->setUniformValue("materialInfo.Diffuse", QVector/3D(1.0f, 1.0f, 1.0f));
}
else
{
...
...
@@ -466,6 +466,7 @@ void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision,
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
entry
->
IB_regular_handle
);
f
->
glPatchParameteri
(
GL_PATCH_VERTICES
,
12
);
f
->
glDrawElements
(
GL_PATCHES
,
entry
->
indices_regular
.
size
(),
GL_UNSIGNED_INT
,
0
);
//qCDebug(log_mesh)<<"Patches "<<entry->indices_regular.size()/12<<" Subdivision Level: "<< subdivision;
}
}
else
{
if
(
!
entry
->
indices_irregular
.
isEmpty
())
{
...
...
QTProject/subdivide.tcs
View file @
393092be
...
...
@@ -11,7 +11,6 @@ void main()
{
tcPosition[gl_InvocationID] = vPosition[gl_InvocationID];
float tesselation = 1.0;
gl_TessLevelOuter[0] = tesselation;
...
...
QTProject/subdivide.tes
View file @
393092be
...
...
@@ -10,7 +10,6 @@ uniform mat4x4 MV;
uniform mat4x4 MVP;
void main()
{
...
...
QTProject/subdivideRegular.tcs
View file @
393092be
...
...
@@ -11,12 +11,12 @@ void main()
{
tcPosition[gl_InvocationID] = vPosition[gl_InvocationID];
float tesselation = subdiv
+1
;
float tesselation = subdiv;
gl_TessLevelOuter[0] =
3 * tesselation
;
gl_TessLevelOuter[1] =
3 * tesselation
;
gl_TessLevelOuter[2] =
3 * tesselation
;
gl_TessLevelOuter[0] =
exp2(tesselation)
;
gl_TessLevelOuter[1] =
exp2(tesselation)
;
gl_TessLevelOuter[2] =
exp2(tesselation)
;
gl_TessLevelInner[0] =
5 * tesselation
;
gl_TessLevelInner[0] =
exp2(tesselation+1)
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment