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
04d2f796
Commit
04d2f796
authored
Jun 16, 2016
by
Alisa Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finished index table for vertex points
parent
b3ed332c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
1 deletion
+81
-1
subdivision.cpp
QTProject/subdivision.cpp
+81
-1
No files found.
QTProject/subdivision.cpp
View file @
04d2f796
...
@@ -71,7 +71,8 @@ void Subdivision::precomputeTables(Mesh *mesh) {
...
@@ -71,7 +71,8 @@ void Subdivision::precomputeTables(Mesh *mesh) {
QVector
<
Vertex
>
vb
=
firstMeshEntry
->
getVertexBuffer
();
QVector
<
Vertex
>
vb
=
firstMeshEntry
->
getVertexBuffer
();
//qDebug()<<"Vertex Buffer: "<<vb;
//qDebug()<<"Vertex Buffer: "<<vb;
//compute edge table
//Format: first two entries: edge vertices. last two entries: distant vertices.
QVector
<
QVector
<
unsigned
int
>>
edgeIndices_base
;
QVector
<
QVector
<
unsigned
int
>>
edgeIndices_base
;
for
(
int
i
=
0
;
i
<
ib
.
length
();
i
+=
3
){
for
(
int
i
=
0
;
i
<
ib
.
length
();
i
+=
3
){
...
@@ -144,6 +145,85 @@ void Subdivision::precomputeTables(Mesh *mesh) {
...
@@ -144,6 +145,85 @@ void Subdivision::precomputeTables(Mesh *mesh) {
}
}
//TODO save/return edge table
//TODO save/return edge table
//compute vertex table
//Format: First entry: original vertex. Other entries: adjacent vertices.
QVector
<
QVector
<
unsigned
int
>>
vertexIndices_base
;
QVector
<
QVector
<
unsigned
int
>>
duplicates
;
//for debugging
for
(
unsigned
int
i
=
0
;
i
<
vb
.
length
();
i
++
){
//hat evtl viel redundanz
QVector
<
unsigned
int
>
adjacent_indices
;
QVector
<
Vertex
>
adj_v
;
//helfer
adjacent_indices
.
push_back
(
i
);
Vertex
originalVertex
=
vb
[
i
];
QVector
<
unsigned
int
>
d
;
for
(
int
j
=
0
;
j
<
ib
.
length
();
j
++
){
if
(
j
==
31
&&
i
==
0
){
qDebug
()
<<
"j is 31, i is 0: "
;
}
//suche verweise auf vertex im indexbuffer
if
(
vb
[
ib
[
j
]].
samePos
(
originalVertex
)){
d
.
push_back
(
j
);
unsigned
int
i1
,
i2
;
//indices for neighbour vertices
if
(
j
%
3
==
0
){
i1
=
ib
[
j
+
1
];
i2
=
ib
[
j
+
2
];
}
else
if
(
j
%
3
==
1
){
i1
=
ib
[
j
+
1
];
i2
=
ib
[
j
-
1
];
}
else
{
i1
=
ib
[
j
-
1
];
i2
=
ib
[
j
-
2
];
}
if
(
j
==
31
&&
i
==
0
){
qDebug
()
<<
"i1: "
<<
i1
<<
", i2: "
<<
i2
;
}
Vertex
v1
,
v2
;
//neighbour vertices;
v1
=
vb
[
i1
];
v2
=
vb
[
i2
];
//check if vertices where already used
//Note: Can't use contain. Contain uses equal (would have to implement equal, but we're only interested in the position here.
bool
found1
=
false
;
bool
found2
=
false
;
for
(
int
k
=
0
;
k
<
adj_v
.
length
();
k
++
){
if
(
adj_v
[
k
].
samePos
(
v1
))
found1
=
true
;
if
(
adj_v
[
k
].
samePos
(
v2
))
found2
=
true
;
}
if
(
!
found1
){
adj_v
.
push_back
(
v1
);
adjacent_indices
.
push_back
(
i1
);
}
if
(
!
found2
){
adj_v
.
push_back
(
v2
);
adjacent_indices
.
push_back
(
i2
);
}
//if one adjacent vertex is referenced by multiple different indices, only its first index will appear in the adjacent_indices list.1
}
}
vertexIndices_base
.
push_back
(
adjacent_indices
);
if
(
!
duplicates
.
contains
(
d
))
duplicates
.
push_back
(
d
);
}
qDebug
()
<<
"Done with vertex index table. "
<<
vertexIndices_base
.
length
()
<<
" vertices processed. Table:"
;
for
(
int
i
=
0
;
i
<
vertexIndices_base
.
length
();
i
++
){
qDebug
()
<<
vertexIndices_base
[
i
];
}
qDebug
()
<<
"Duplicates: "
;
for
(
int
i
=
0
;
i
<
duplicates
.
length
();
i
++
){
qDebug
()
<<
duplicates
[
i
];
}
}
}
void
Subdivision
::
runShader
(
Mesh
*
mesh
)
{
void
Subdivision
::
runShader
(
Mesh
*
mesh
)
{
...
...
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