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
1de39cde
Commit
1de39cde
authored
Sep 01, 2016
by
Kai Westerkamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rendering all patches from all Levels
parent
87d5c28e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
14 deletions
+28
-14
logcategories.cpp
QTProject/logcategories.cpp
+1
-0
logcategories.h
QTProject/logcategories.h
+1
-0
mesh.cpp
QTProject/mesh.cpp
+21
-10
subdivide.tcs
QTProject/subdivide.tcs
+0
-1
subdivideRegular.tcs
QTProject/subdivideRegular.tcs
+4
-2
subdivision.cpp
QTProject/subdivision.cpp
+1
-1
No files found.
QTProject/logcategories.cpp
View file @
1de39cde
...
@@ -3,3 +3,4 @@
...
@@ -3,3 +3,4 @@
Q_LOGGING_CATEGORY
(
log_subdiv
,
"subdiv"
)
Q_LOGGING_CATEGORY
(
log_subdiv
,
"subdiv"
)
Q_LOGGING_CATEGORY
(
log_subdiv_trace
,
"subdiv.trace"
)
Q_LOGGING_CATEGORY
(
log_subdiv_trace
,
"subdiv.trace"
)
Q_LOGGING_CATEGORY
(
log_mesh
,
"mesh"
)
Q_LOGGING_CATEGORY
(
log_mesh
,
"mesh"
)
Q_LOGGING_CATEGORY
(
log_mesh_render
,
"mesh.render"
)
QTProject/logcategories.h
View file @
1de39cde
...
@@ -7,5 +7,6 @@
...
@@ -7,5 +7,6 @@
Q_DECLARE_LOGGING_CATEGORY
(
log_subdiv
)
Q_DECLARE_LOGGING_CATEGORY
(
log_subdiv
)
Q_DECLARE_LOGGING_CATEGORY
(
log_subdiv_trace
)
Q_DECLARE_LOGGING_CATEGORY
(
log_subdiv_trace
)
Q_DECLARE_LOGGING_CATEGORY
(
log_mesh
)
Q_DECLARE_LOGGING_CATEGORY
(
log_mesh
)
Q_DECLARE_LOGGING_CATEGORY
(
log_mesh_render
)
#endif
#endif
QTProject/mesh.cpp
View file @
1de39cde
...
@@ -437,9 +437,9 @@ void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision,
...
@@ -437,9 +437,9 @@ void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision,
// qCDebug(log_mesh) << materials[MaterialIndex].Diffuse << materials[MaterialIndex].Specular << materials[MaterialIndex].Shininess << materials[MaterialIndex].hasTexture;
// qCDebug(log_mesh) << materials[MaterialIndex].Diffuse << materials[MaterialIndex].Specular << materials[MaterialIndex].Shininess << materials[MaterialIndex].hasTexture;
if
(
regular
)
{
if
(
regular
)
{
// shader->setUniformValue("materialInfo.Diffuse", QVector3D(0.0f, 0.0f, 1.0f));
// 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"
,
QVector3D
(
243.0
,
156.0
,
18.0
)
/
255.0
);
// shader->setUniformValue("materialInfo.Diffuse", QVector/3D(1.0f, 1.0f, 1.0f));
// shader->setUniformValue("materialInfo.Diffuse", QVector/3D(1.0f, 1.0f, 1.0f));
}
else
{
}
else
{
shader
->
setUniformValue
(
"materialInfo.Diffuse"
,
materials
[
MaterialIndex
].
Diffuse
);
shader
->
setUniformValue
(
"materialInfo.Diffuse"
,
materials
[
MaterialIndex
].
Diffuse
);
}
}
...
@@ -459,14 +459,25 @@ void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision,
...
@@ -459,14 +459,25 @@ void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision,
// Draw Vertex Array
// Draw Vertex Array
if
(
regular
){
if
(
regular
){
if
(
!
entry
->
indices_regular
.
isEmpty
())
{
for
(
int
depth
=
0
;
depth
<
subdivision
+
1
;
++
depth
)
{
f
->
glBindBuffer
(
GL_ARRAY_BUFFER
,
entry
->
VB_handle
);
std
::
shared_ptr
<
SubdivEntry
>
depthEntry
=
entries
[
index
].
buffers
[
depth
];
f
->
glVertexAttribPointer
(
positionIndex
,
3
,
GL_FLOAT
,
GL_FALSE
,
sizeof
(
Vertex
),
0
);
if
(
!
depthEntry
->
indices_regular
.
isEmpty
())
{
std
::
shared_ptr
<
SubdivEntry
>
depthEntryMinusOne
=
entries
[
index
].
buffers
[
depth
];
if
(
depth
>
0
){
depthEntryMinusOne
=
entries
[
index
].
buffers
[
depth
-
1
];
}
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
entry
->
IB_regular_handle
);
shader
->
setUniformValue
(
"depth"
,
depth
);
f
->
glPatchParameteri
(
GL_PATCH_VERTICES
,
12
);
f
->
glDrawElements
(
GL_PATCHES
,
entry
->
indices_regular
.
size
(),
GL_UNSIGNED_INT
,
0
);
f
->
glBindBuffer
(
GL_ARRAY_BUFFER
,
depthEntryMinusOne
->
VB_handle
);
//qCDebug(log_mesh)<<"Patches "<<entry->indices_regular.size()/12<<" Subdivision Level: "<< subdivision;
f
->
glVertexAttribPointer
(
positionIndex
,
3
,
GL_FLOAT
,
GL_FALSE
,
sizeof
(
Vertex
),
0
);
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
depthEntry
->
IB_regular_handle
);
f
->
glPatchParameteri
(
GL_PATCH_VERTICES
,
12
);
f
->
glDrawElements
(
GL_PATCHES
,
depthEntry
->
indices_regular
.
size
(),
GL_UNSIGNED_INT
,
0
);
qCDebug
(
log_mesh
)
<<
"Patches "
<<
entry
->
indices_regular
.
size
()
/
12
<<
" Subdivision Level: "
<<
subdivision
;
}
}
}
}
else
{
}
else
{
if
(
!
entry
->
indices_irregular
.
isEmpty
())
{
if
(
!
entry
->
indices_irregular
.
isEmpty
())
{
...
...
QTProject/subdivide.tcs
View file @
1de39cde
...
@@ -5,7 +5,6 @@ layout(vertices = 3) out;
...
@@ -5,7 +5,6 @@ layout(vertices = 3) out;
in vec3 vPosition[];
in vec3 vPosition[];
out vec3 tcPosition[];
out vec3 tcPosition[];
uniform float subdiv;
void main()
void main()
{
{
...
...
QTProject/subdivideRegular.tcs
View file @
1de39cde
...
@@ -6,17 +6,19 @@ in vec3 vPosition[];
...
@@ -6,17 +6,19 @@ in vec3 vPosition[];
out vec3 tcPosition[];
out vec3 tcPosition[];
uniform int subdiv;
uniform int subdiv;
uniform int depth;
void main()
void main()
{
{
tcPosition[gl_InvocationID] = vPosition[gl_InvocationID];
tcPosition[gl_InvocationID] = vPosition[gl_InvocationID];
float tesselation = subdiv;
float tesselation = subdiv
-depth
;
gl_TessLevelOuter[0] = exp2(tesselation);
gl_TessLevelOuter[0] = exp2(tesselation);
gl_TessLevelOuter[1] = exp2(tesselation);
gl_TessLevelOuter[1] = exp2(tesselation);
gl_TessLevelOuter[2] = exp2(tesselation);
gl_TessLevelOuter[2] = exp2(tesselation);
gl_TessLevelInner[0] = exp2(tesselation
+1
);
gl_TessLevelInner[0] = exp2(tesselation);
}
}
QTProject/subdivision.cpp
View file @
1de39cde
...
@@ -68,7 +68,7 @@ void Subdivision::subdivide(Mesh *mesh, int level) {
...
@@ -68,7 +68,7 @@ void Subdivision::subdivide(Mesh *mesh, int level) {
input
.
index_buffer
=
entry
->
indices_irregular
;
input
.
index_buffer
=
entry
->
indices_irregular
;
if
(
input
.
index_buffer
.
isEmpty
())
{
if
(
input
.
index_buffer
.
isEmpty
())
{
current_mesh
->
update
(
input
.
vb_handle
,
input
.
vertex_buffer
,
input
.
index_buffer
,
entry
->
indices_regular
);
//
current_mesh->update(input.vb_handle, input.vertex_buffer, input.index_buffer, entry->indices_regular);
}
else
{
}
else
{
Tables
tables
=
precomputeTables
(
input
);
Tables
tables
=
precomputeTables
(
input
);
Result
result
=
runShader
(
input
,
tables
);
Result
result
=
runShader
(
input
,
tables
);
...
...
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