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
197f85be
Commit
197f85be
authored
Aug 22, 2016
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename nib_offset to edge_index
parent
d117e237
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
12 deletions
+19
-12
subdivision.cpp
QTProject/subdivision.cpp
+19
-12
No files found.
QTProject/subdivision.cpp
View file @
197f85be
...
...
@@ -146,7 +146,8 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
// for each triangle the edges of the neighbor triangles are stored.
// First the edge shared with the triangles uv edge, then vw and wu.
QMap
<
Triangle
,
QVector
<
Triangle
::
Edge
>>
opposite_edges
;
unsigned
int
nib_offset
=
vb
.
length
();
//offset in new index buffer for edge vertices
unsigned
int
edge_index
=
vb
.
length
();
//offset in new index buffer for edge vertices
for
(
int
i
=
0
;
i
<
triangles
.
length
();
i
++
){
//schaue alle dreiecke an
Triangle
triangle
=
triangles
[
i
];
...
...
@@ -170,6 +171,14 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
}
QVector
<
Triangle
::
Edge
>
opposite
=
opposite_edges
.
value
(
triangle
);
// indices of the three vertices added to the edges of this triangle
unsigned
int
uv
,
vw
,
wu
;
uv
=
edge_index
++
;
vw
=
edge_index
++
;
wu
=
edge_index
++
;
tables
.
edge_indices
.
push_back
(
triangle
.
u_idx
());
tables
.
edge_indices
.
push_back
(
triangle
.
v_idx
());
tables
.
edge_indices
.
push_back
(
triangle
.
w_idx
());
...
...
@@ -187,22 +196,20 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
//add indices to new index buffer
tables
.
index_buffer
.
push_back
(
triangle
.
u_idx
());
tables
.
index_buffer
.
push_back
(
nib_offset
);
tables
.
index_buffer
.
push_back
(
nib_offset
+
2
);
tables
.
index_buffer
.
push_back
(
uv
);
tables
.
index_buffer
.
push_back
(
wu
);
tables
.
index_buffer
.
push_back
(
triangle
.
v_idx
());
tables
.
index_buffer
.
push_back
(
nib_offset
+
1
);
tables
.
index_buffer
.
push_back
(
nib_offset
);
tables
.
index_buffer
.
push_back
(
vw
);
tables
.
index_buffer
.
push_back
(
uv
);
tables
.
index_buffer
.
push_back
(
triangle
.
w_idx
());
tables
.
index_buffer
.
push_back
(
nib_offset
+
2
);
tables
.
index_buffer
.
push_back
(
nib_offset
+
1
);
tables
.
index_buffer
.
push_back
(
nib_offset
);
tables
.
index_buffer
.
push_back
(
nib_offset
+
1
);
tables
.
index_buffer
.
push_back
(
nib_offset
+
2
);
tables
.
index_buffer
.
push_back
(
wu
);
tables
.
index_buffer
.
push_back
(
vw
);
nib_offset
+=
3
;
tables
.
index_buffer
.
push_back
(
uv
);
tables
.
index_buffer
.
push_back
(
vw
);
tables
.
index_buffer
.
push_back
(
wu
);
}
qDebug
()
<<
"Done with edge table. "
<<
tables
.
edge_indices
.
length
();
...
...
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