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
f804bd56
Commit
f804bd56
authored
Sep 28, 2016
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add updateSharpEdges
parent
e6ccfe75
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
subdivision.cpp
QTProject/subdivision.cpp
+27
-0
subdivision.h
QTProject/subdivision.h
+4
-0
No files found.
QTProject/subdivision.cpp
View file @
f804bd56
...
...
@@ -136,6 +136,8 @@ void Subdivision::subdivide(Mesh *mesh, int level) {
* erst die Vertex-points (in der selben Reihenfolge wie im ursprünglichen Vertex-Buffer) und dann die Edgepoints kommen.
*
* Einträge in neuem Vertex-buffer: Verschobene Knoten aus altem Vertex-Buffer :: edge-vertices erstellt aus edgeIndices_base.
*
* sharpEdges: Vorher leer, wird sonst geleert, wird gefüllt mit neuen sharp edges, alte sollten im Input stehen.
*/
Subdivision
::
Tables
Subdivision
::
precomputeTables
(
Input
input
)
{
Tables
tables
;
...
...
@@ -184,6 +186,9 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
updateIndexBuffer
(
tables
.
extra_triangles
,
modified_vertices
);
qCDebug
(
log_timing
)
<<
"updateIndexBuffer:"
<<
formatTimeMeasurement
(
subTimer
.
elapsed
());
subTimer
.
restart
();
updateSharpEdges
(
input
.
sharp_edges
,
tables
.
sharp_edges
,
modified_vertices
,
old_edge_to_new_vertex
);
qCDebug
(
log_subdiv
)
<<
"Precompute Tables Done"
;
return
tables
;
}
...
...
@@ -711,6 +716,28 @@ void Subdivision::updateIndexBuffer(QVector<unsigned int> &index_buffer, QMap<un
}
}
void
Subdivision
::
updateSharpEdges
(
const
QMap
<
Edge
,
unsigned
int
>
&
sharp_edges_old
,
QMap
<
Edge
,
unsigned
int
>
&
sharp_edges_new
,
const
QMap
<
unsigned
int
,
unsigned
int
>&
old_vertex_to_new_vertex
,
const
QMap
<
Edge
,
unsigned
int
>
&
old_edge_to_new_vertex
){
sharp_edges_new
.
clear
();
for
(
Edge
e
:
sharp_edges_old
.
keys
()){
unsigned
int
sharpness_old
=
sharp_edges_old
.
value
(
e
);
if
(
sharpness_old
>
1
){
unsigned
int
u_old
=
e
.
a
;
unsigned
int
v_old
=
e
.
b
;
unsigned
int
u_new
=
old_vertex_to_new_vertex
[
u_old
];
unsigned
int
v_new
=
old_vertex_to_new_vertex
[
v_new
];
unsigned
int
center
=
old_edge_to_new_vertex
[
Edge
(
u_old
,
v_old
)];
unsigned
int
sharpness_new
=
sharpness_old
-
1
;
sharp_edges_new
.
insert
(
Edge
(
u_new
,
center
),
sharpness_new
);
sharp_edges_new
.
insert
(
Edge
(
center
,
v_new
),
sharpness_new
);
//TODO find regular darf sharpe sachen nicht als regular sehen
}
}
}
void
Subdivision
::
splitRegular
(
Mesh
*
mesh
)
{
QTime
totalTimer
;
totalTimer
.
start
();
...
...
QTProject/subdivision.h
View file @
f804bd56
...
...
@@ -75,6 +75,10 @@ private:
QVector
<
unsigned
int
>
getAllVertexIndices
(
const
QVector
<
Vertex
>
&
vb
,
const
QVector
<
Triangle
>
&
triangles
);
bool
removeVertexIndex
(
const
QVector
<
Vertex
>
&
vb
,
QVector
<
unsigned
int
>
&
vertices
,
const
Vertex
&
vertex
);
void
updateIndexBuffer
(
QVector
<
unsigned
int
>
&
index_buffer
,
QMap
<
unsigned
int
,
unsigned
int
>
map
);
void
updateSharpEdges
(
const
QMap
<
Edge
,
unsigned
int
>
&
sharp_edges_old
,
QMap
<
Edge
,
unsigned
int
>
&
sharp_edges_new
,
const
QMap
<
unsigned
int
,
unsigned
int
>&
old_vertex_to_new_vertex
,
const
QMap
<
Edge
,
unsigned
int
>
&
old_edge_to_new_vertex
);
void
findRegular
(
QVector
<
Triangle
>
triangles
,
QMap
<
Triangle
,
Triangle
::
Neighbors
>
neighbors
,
QVector
<
Triangle
>
&
regular
,
QVector
<
Triangle
>
&
irregular
);
Result
runShader
(
Input
input
,
Tables
&
tables
);
void
runCopyShader
(
GLuint
size
,
GLuint
vb_in
,
GLuint
vb_out
);
...
...
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