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
59566e61
Commit
59566e61
authored
8 years ago
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add subdiv logging category
parent
9d5ca018
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
22 deletions
+23
-22
subdivision.cpp
QTProject/subdivision.cpp
+23
-22
No files found.
QTProject/subdivision.cpp
View file @
59566e61
#include <memory>
#include <memory>
#include "logcategories.h"
#include "subdivision.h"
#include "subdivision.h"
#include "triangle.h"
#include "triangle.h"
...
@@ -34,15 +35,15 @@ QOpenGLShaderProgram *Subdivision::initComputeShaderProgram(QString &source){
...
@@ -34,15 +35,15 @@ QOpenGLShaderProgram *Subdivision::initComputeShaderProgram(QString &source){
exit
(
5
);
exit
(
5
);
}
}
q
Debug
(
)
<<
"Adding compute shader ..."
;
q
CDebug
(
log_subdiv
)
<<
"Adding compute shader ..."
;
QOpenGLShaderProgram
*
shader
=
new
QOpenGLShaderProgram
();
QOpenGLShaderProgram
*
shader
=
new
QOpenGLShaderProgram
();
shader
->
addShader
(
computeShader
);
shader
->
addShader
(
computeShader
);
q
Debug
(
)
<<
"Linking compute shader ..."
;
q
CDebug
(
log_subdiv
)
<<
"Linking compute shader ..."
;
if
(
!
shader
->
link
()){
if
(
!
shader
->
link
()){
qCritical
()
<<
"Linking compute shader failed:"
<<
shader
->
log
();
qCritical
()
<<
"Linking compute shader failed:"
<<
shader
->
log
();
exit
(
5
);
exit
(
5
);
}
}
q
Debug
(
)
<<
"Linking compute shader done"
;
q
CDebug
(
log_subdiv
)
<<
"Linking compute shader done"
;
return
shader
;
return
shader
;
}
}
...
@@ -82,12 +83,12 @@ void Subdivision::subdivide(Mesh *mesh, int level) {
...
@@ -82,12 +83,12 @@ void Subdivision::subdivide(Mesh *mesh, int level) {
QVector
<
unsigned
int
>
irregular
;
QVector
<
unsigned
int
>
irregular
;
findRegular
(
tables
.
index_buffer
,
result
.
vertex_buffer
,
regular
,
irregular
);
findRegular
(
tables
.
index_buffer
,
result
.
vertex_buffer
,
regular
,
irregular
);
q
Debug
(
)
<<
"Indices"
<<
tables
.
index_buffer
.
length
();
q
CDebug
(
log_subdiv
)
<<
"Indices"
<<
tables
.
index_buffer
.
length
();
q
Debug
(
)
<<
"regular"
<<
regular
.
length
();
q
CDebug
(
log_subdiv
)
<<
"regular"
<<
regular
.
length
();
q
Debug
(
)
<<
"irregular"
<<
irregular
.
length
();
q
CDebug
(
log_subdiv
)
<<
"irregular"
<<
irregular
.
length
();
QVector
<
unsigned
int
>
patches
=
getPatchIndexBuffer
(
regular
);
QVector
<
unsigned
int
>
patches
=
getPatchIndexBuffer
(
regular
);
q
Debug
(
)
<<
"patches"
<<
patches
.
length
();
q
CDebug
(
log_subdiv
)
<<
"patches"
<<
patches
.
length
();
current_mesh
->
update
(
result
.
vb_handle
,
result
.
vertex_buffer
,
irregular
,
patches
);
current_mesh
->
update
(
result
.
vb_handle
,
result
.
vertex_buffer
,
irregular
,
patches
);
}
}
...
@@ -144,11 +145,11 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
...
@@ -144,11 +145,11 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
QVector
<
unsigned
int
>
ib
=
input
.
index_buffer
;
QVector
<
unsigned
int
>
ib
=
input
.
index_buffer
;
if
(
debugOutput
)
if
(
debugOutput
)
q
Debug
(
)
<<
"Index Buffer: "
<<
ib
;
q
CDebug
(
log_subdiv
)
<<
"Index Buffer: "
<<
ib
;
QVector
<
Vertex
>
vb
=
input
.
vertex_buffer
;
QVector
<
Vertex
>
vb
=
input
.
vertex_buffer
;
if
(
debugOutput
)
if
(
debugOutput
)
q
Debug
(
)
<<
"Vertex Buffer: "
<<
vb
;
q
CDebug
(
log_subdiv
)
<<
"Vertex Buffer: "
<<
vb
;
QVector
<
Triangle
>
triangles
;
QVector
<
Triangle
>
triangles
;
for
(
int
i
=
0
;
i
<
ib
.
length
();
i
+=
3
)
{
for
(
int
i
=
0
;
i
<
ib
.
length
();
i
+=
3
)
{
...
@@ -261,12 +262,12 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
...
@@ -261,12 +262,12 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
tables
.
index_buffer
.
push_back
(
wu
);
tables
.
index_buffer
.
push_back
(
wu
);
}
}
q
Debug
(
)
<<
"Done with edge table. "
<<
tables
.
edge_indices
.
length
();
q
CDebug
(
log_subdiv
)
<<
"Done with edge table. "
<<
tables
.
edge_indices
.
length
();
if
(
debugOutput
){
if
(
debugOutput
){
q
Debug
(
)
<<
"Eedges found. Table: "
<<
tables
.
edge_indices
;
q
CDebug
(
log_subdiv
)
<<
"Eedges found. Table: "
<<
tables
.
edge_indices
;
q
Debug
(
)
<<
"Table (long version):"
;
q
CDebug
(
log_subdiv
)
<<
"Table (long version):"
;
for
(
int
i
=
0
;
i
<
tables
.
edge_indices
.
length
();
i
++
){
for
(
int
i
=
0
;
i
<
tables
.
edge_indices
.
length
();
i
++
){
q
Debug
(
)
<<
"blub:"
<<
tables
.
edge_indices
[
i
];
q
CDebug
(
log_subdiv
)
<<
"blub:"
<<
tables
.
edge_indices
[
i
];
}
}
}
}
...
@@ -334,11 +335,11 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
...
@@ -334,11 +335,11 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
tables
.
vertex_offsets
.
push_back
(
offset
);
tables
.
vertex_offsets
.
push_back
(
offset
);
q
Debug
(
)
<<
"Done with vertex index table. "
;
q
CDebug
(
log_subdiv
)
<<
"Done with vertex index table. "
;
if
(
debugOutput
){
if
(
debugOutput
){
q
Debug
(
)
<<
"Duplicates: "
;
q
CDebug
(
log_subdiv
)
<<
"Duplicates: "
;
for
(
int
i
=
0
;
i
<
duplicates
.
length
();
i
++
){
for
(
int
i
=
0
;
i
<
duplicates
.
length
();
i
++
){
q
Debug
(
)
<<
duplicates
[
i
];
q
CDebug
(
log_subdiv
)
<<
duplicates
[
i
];
}
}
}
}
tables
.
index_regular
=
getPatchIndexBuffer
(
ib
);
tables
.
index_regular
=
getPatchIndexBuffer
(
ib
);
...
@@ -367,8 +368,8 @@ void Subdivision::splitRegular(Mesh *mesh) {
...
@@ -367,8 +368,8 @@ void Subdivision::splitRegular(Mesh *mesh) {
current_mesh
->
buffers
[
0
]
->
indices_irregular
=
irregular
;
current_mesh
->
buffers
[
0
]
->
indices_irregular
=
irregular
;
current_mesh
->
buffers
[
0
]
->
updateIndices
();
current_mesh
->
buffers
[
0
]
->
updateIndices
();
q
Debug
(
)
<<
"regular: "
<<
regular
.
length
();
q
CDebug
(
log_subdiv
)
<<
"regular: "
<<
regular
.
length
();
q
Debug
(
)
<<
"irregular: "
<<
irregular
.
length
();
q
CDebug
(
log_subdiv
)
<<
"irregular: "
<<
irregular
.
length
();
}
}
/**
/**
...
@@ -592,18 +593,18 @@ Subdivision::Result Subdivision::runShader(Input input, Tables &tables) {
...
@@ -592,18 +593,18 @@ Subdivision::Result Subdivision::runShader(Input input, Tables &tables) {
ptr
=
(
Vertex
*
)
f
->
glMapBuffer
(
GL_SHADER_STORAGE_BUFFER
,
GL_WRITE_ONLY
);
ptr
=
(
Vertex
*
)
f
->
glMapBuffer
(
GL_SHADER_STORAGE_BUFFER
,
GL_WRITE_ONLY
);
if
(
debugOutput
)
if
(
debugOutput
)
q
Debug
(
)
<<
"New vertices:"
;
q
CDebug
(
log_subdiv
)
<<
"New vertices:"
;
for
(
int
i
=
0
;
i
<
input
.
vertex_buffer
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
input
.
vertex_buffer
.
size
();
i
++
)
{
if
(
debugOutput
)
if
(
debugOutput
)
q
Debug
(
)
<<
ptr
[
i
].
pos
;
q
CDebug
(
log_subdiv
)
<<
ptr
[
i
].
pos
;
result
.
vertex_buffer
.
push_back
(
ptr
[
i
]);
result
.
vertex_buffer
.
push_back
(
ptr
[
i
]);
}
}
if
(
debugOutput
)
if
(
debugOutput
)
q
Debug
(
)
<<
"New edge points:"
;
q
CDebug
(
log_subdiv
)
<<
"New edge points:"
;
for
(
int
i
=
0
;
i
<
tables
.
edge_indices
.
size
()
/
4
;
i
++
)
{
for
(
int
i
=
0
;
i
<
tables
.
edge_indices
.
size
()
/
4
;
i
++
)
{
if
(
debugOutput
)
if
(
debugOutput
)
q
Debug
(
)
<<
ptr
[
edgeOffset
+
i
].
pos
;
q
CDebug
(
log_subdiv
)
<<
ptr
[
edgeOffset
+
i
].
pos
;
result
.
vertex_buffer
.
push_back
(
ptr
[
edgeOffset
+
i
]);
result
.
vertex_buffer
.
push_back
(
ptr
[
edgeOffset
+
i
]);
}
}
...
...
This diff is collapsed.
Click to expand it.
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