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
1cbbace4
Commit
1cbbace4
authored
8 years ago
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
temp
parent
0b31a5fa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
subdivision.cpp
QTProject/subdivision.cpp
+19
-10
No files found.
QTProject/subdivision.cpp
View file @
1cbbace4
...
...
@@ -89,15 +89,18 @@ void Subdivision::subdivide(Mesh *mesh, int level) {
Tables
tables
=
precomputeTables
(
input
);
Result
result
=
runShader
(
input
,
tables
);
QVector
<
Triangle
>
triangles
;
ibToTriangles
(
&
result
.
vertex_buffer
,
tables
.
index_buffer
,
triangles
);
QVector
<
Triangle
>
all_triangles
;
ibToTriangles
(
&
result
.
vertex_buffer
,
tables
.
index_buffer
,
all_triangles
);
ibToTriangles
(
&
result
.
vertex_buffer
,
tables
.
extra_triangles
,
all_triangles
);
all_triangles
+=
triangles
;
QMap
<
Triangle
,
Triangle
::
Neighbors
>
neighbors
;
buildNeighborsMap
(
result
.
vertex_buffer
,
all_triangles
,
neighbors
);
QVector
<
Triangle
>
regular
;
QVector
<
Triangle
>
irregular
;
findRegular
(
all_
triangles
,
neighbors
,
regular
,
irregular
);
findRegular
(
triangles
,
neighbors
,
regular
,
irregular
);
qCDebug
(
log_subdiv
)
<<
"Indices"
<<
tables
.
index_buffer
.
length
();
qCDebug
(
log_subdiv
)
<<
"subdivide: regular"
<<
regular
.
length
();
...
...
@@ -177,6 +180,7 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
subTimer
.
restart
();
updateIndexBuffer
(
tables
.
index_buffer
,
modified_vertices
);
updateIndexBuffer
(
tables
.
extra_triangles
,
modified_vertices
);
qCDebug
(
log_timing
)
<<
"updateIndexBuffer:"
<<
formatTimeMeasurement
(
subTimer
.
elapsed
());
qCDebug
(
log_subdiv
)
<<
"Precompute Tables Done"
;
...
...
@@ -410,14 +414,16 @@ void Subdivision::precomputeEdgeTable(Subdivision::Tables &tables, QVector<Trian
*/
Triangle
::
Neighbors
ns
=
neighbors
.
value
(
*
triangle
);
if
(
!
irregular_triangles
.
contains
(
*
ns
.
uv
.
triangle
))
{
extra_triangles
.
insert
(
*
ns
.
uv
.
triangle
,
true
);
}
if
(
!
irregular_triangles
.
contains
(
*
ns
.
vw
.
triangle
))
{
extra_triangles
.
insert
(
*
ns
.
vw
.
triangle
,
true
);
}
if
(
!
irregular_triangles
.
contains
(
*
ns
.
wu
.
triangle
))
{
extra_triangles
.
insert
(
*
ns
.
wu
.
triangle
,
true
);
QVector
<
Triangle
>
neighboring_triangles
;
neighboring_triangles
+=
vertexNeighbors
(
*
triangle
,
ns
.
uv
,
neighbors
);
neighboring_triangles
+=
vertexNeighbors
(
*
triangle
,
ns
.
vw
,
neighbors
);
neighboring_triangles
+=
vertexNeighbors
(
*
triangle
,
ns
.
wu
,
neighbors
);
QVectorIterator
<
Triangle
>
extra
(
neighboring_triangles
);
while
(
extra
.
hasNext
())
{
Triangle
extra_triangle
=
extra
.
next
();
if
(
!
irregular_triangles
.
contains
(
extra_triangle
))
{
extra_triangles
.
insert
(
extra_triangle
,
true
);
}
}
// indices of the three vertices added to the edges of this triangle
...
...
@@ -491,10 +497,13 @@ void Subdivision::precomputeEdgeTable(Subdivision::Tables &tables, QVector<Trian
tables
.
index_buffer
.
push_back
(
wu
);
}
qDebug
()
<<
"extra triangles"
<<
extra_triangles
.
size
();
QMapIterator
<
Triangle
,
bool
>
extra_it
(
extra_triangles
);
while
(
extra_it
.
hasNext
())
{
extra_it
.
next
();
Triangle
triangle
=
extra_it
.
key
();
qDebug
()
<<
triangle
;
unsigned
int
uv
,
vw
,
wu
;
Edge
edge
;
...
...
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