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
6883649b
Commit
6883649b
authored
Sep 27, 2016
by
Kai Westerkamp
Committed by
Philipp Adolf
Sep 27, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JAAAAAAAAAAAAAAAAAAAAAAAA FIXED IT
parent
07e28ea6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
36 deletions
+74
-36
mesh.cpp
QTProject/mesh.cpp
+21
-4
mesh.h
QTProject/mesh.h
+5
-2
subdivision.cpp
QTProject/subdivision.cpp
+48
-30
No files found.
QTProject/mesh.cpp
View file @
6883649b
...
@@ -40,22 +40,24 @@ void Mesh::SubdivEntry::init(QOpenGLFunctions_4_3_Core *f,QVector<Vertex>& Verti
...
@@ -40,22 +40,24 @@ void Mesh::SubdivEntry::init(QOpenGLFunctions_4_3_Core *f,QVector<Vertex>& Verti
f
->
glBufferData
(
GL_ARRAY_BUFFER
,
sizeof
(
Vertex
)
*
Vertices
.
size
(),
&
Vertices
[
0
],
GL_STATIC_DRAW
);
f
->
glBufferData
(
GL_ARRAY_BUFFER
,
sizeof
(
Vertex
)
*
Vertices
.
size
(),
&
Vertices
[
0
],
GL_STATIC_DRAW
);
QVector
<
unsigned
int
>
patches
;
QVector
<
unsigned
int
>
patches
;
this
->
init
(
f
,
VB_handle
,
Vertices
,
Vertices
,
Indices_irregular
,
patches
);
this
->
init
(
f
,
VB_handle
,
Vertices
,
Vertices
,
Indices_irregular
,
patches
,
patches
);
}
}
void
Mesh
::
SubdivEntry
::
init
(
QOpenGLFunctions_4_3_Core
*
f
,
GLuint
VB_handle
,
QVector
<
Vertex
>&
Vertices
,
QVector
<
Vertex
>&
Vertices_irregular
,
void
Mesh
::
SubdivEntry
::
init
(
QOpenGLFunctions_4_3_Core
*
f
,
GLuint
VB_handle
,
QVector
<
Vertex
>&
Vertices
,
QVector
<
Vertex
>&
Vertices_irregular
,
QVector
<
unsigned
int
>&
Indices_irregular
,
QVector
<
unsigned
int
>&
patches
){
QVector
<
unsigned
int
>&
Indices_irregular
,
QVector
<
unsigned
int
>&
patches
,
QVector
<
unsigned
int
>&
Indices_extra
){
this
->
f
=
f
;
this
->
f
=
f
;
this
->
VB_handle
=
VB_handle
;
this
->
VB_handle
=
VB_handle
;
vertices
=
Vertices
;
vertices
=
Vertices
;
indices_irregular
=
Indices_irregular
;
indices_irregular
=
Indices_irregular
;
indices_regular
=
patches
;
indices_regular
=
patches
;
indices_extra
=
Indices_extra
;
qCDebug
(
log_mesh
)
<<
"Vertices"
<<
vertices
.
length
();
qCDebug
(
log_mesh
)
<<
"Vertices"
<<
vertices
.
length
();
qCDebug
(
log_mesh
)
<<
"Vertices Irregular"
<<
Vertices_irregular
.
length
();
qCDebug
(
log_mesh
)
<<
"Vertices Irregular"
<<
Vertices_irregular
.
length
();
qCDebug
(
log_mesh
)
<<
"Indices irregular"
<<
indices_irregular
.
length
();
qCDebug
(
log_mesh
)
<<
"Indices irregular"
<<
indices_irregular
.
length
();
qCDebug
(
log_mesh
)
<<
"Indices patches"
<<
patches
.
length
();
qCDebug
(
log_mesh
)
<<
"Indices patches"
<<
patches
.
length
();
qCDebug
(
log_mesh
)
<<
"Indices extra"
<<
Indices_extra
.
length
();
f
->
glGenBuffers
(
1
,
&
VB_handle_irregular
);
f
->
glGenBuffers
(
1
,
&
VB_handle_irregular
);
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
VB_handle_irregular
);
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
VB_handle_irregular
);
...
@@ -71,6 +73,11 @@ void Mesh::SubdivEntry::init(QOpenGLFunctions_4_3_Core *f, GLuint VB_handle, QVe
...
@@ -71,6 +73,11 @@ void Mesh::SubdivEntry::init(QOpenGLFunctions_4_3_Core *f, GLuint VB_handle, QVe
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
IB_regular_handle
);
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
IB_regular_handle
);
if
(
patches
.
size
()
!=
0
)
if
(
patches
.
size
()
!=
0
)
f
->
glBufferData
(
GL_ELEMENT_ARRAY_BUFFER
,
sizeof
(
unsigned
int
)
*
patches
.
size
(),
&
patches
[
0
],
GL_STATIC_DRAW
);
f
->
glBufferData
(
GL_ELEMENT_ARRAY_BUFFER
,
sizeof
(
unsigned
int
)
*
patches
.
size
(),
&
patches
[
0
],
GL_STATIC_DRAW
);
f
->
glGenBuffers
(
1
,
&
IB_extra_handle
);
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
IB_extra_handle
);
if
(
Indices_extra
.
size
()
!=
0
)
f
->
glBufferData
(
GL_ELEMENT_ARRAY_BUFFER
,
sizeof
(
unsigned
int
)
*
Indices_extra
.
size
(),
&
Indices_extra
[
0
],
GL_STATIC_DRAW
);
}
}
...
@@ -103,10 +110,10 @@ void Mesh::MeshEntry::init(QOpenGLFunctions_4_3_Core *f,QVector<Vertex>& Vertice
...
@@ -103,10 +110,10 @@ void Mesh::MeshEntry::init(QOpenGLFunctions_4_3_Core *f,QVector<Vertex>& Vertice
}
}
}
}
void
Mesh
::
MeshEntry
::
update
(
GLuint
VB_handle
,
QVector
<
Vertex
>&
Vertices
,
QVector
<
Vertex
>&
Vertices_Irregular
,
QVector
<
unsigned
int
>&
Indices_irregular
,
QVector
<
unsigned
int
>&
patches
)
{
void
Mesh
::
MeshEntry
::
update
(
GLuint
VB_handle
,
QVector
<
Vertex
>&
Vertices
,
QVector
<
Vertex
>&
Vertices_Irregular
,
QVector
<
unsigned
int
>&
Indices_irregular
,
QVector
<
unsigned
int
>&
patches
,
QVector
<
unsigned
int
>&
Indices_extra
)
{
SubdivEntry
*
entry
=
new
SubdivEntry
;
SubdivEntry
*
entry
=
new
SubdivEntry
;
buffers
.
push_back
(
std
::
shared_ptr
<
SubdivEntry
>
(
entry
));
buffers
.
push_back
(
std
::
shared_ptr
<
SubdivEntry
>
(
entry
));
entry
->
init
(
f
,
VB_handle
,
Vertices
,
Vertices_Irregular
,
Indices_irregular
,
patches
);
entry
->
init
(
f
,
VB_handle
,
Vertices
,
Vertices_Irregular
,
Indices_irregular
,
patches
,
Indices_extra
);
}
}
Mesh
::
MeshEntry
::~
MeshEntry
()
Mesh
::
MeshEntry
::~
MeshEntry
()
...
@@ -495,6 +502,16 @@ void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision,
...
@@ -495,6 +502,16 @@ void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision,
f
->
glPatchParameteri
(
GL_PATCH_VERTICES
,
3
);
f
->
glPatchParameteri
(
GL_PATCH_VERTICES
,
3
);
f
->
glDrawElements
(
GL_PATCHES
,
entry
->
indices_irregular
.
size
(),
GL_UNSIGNED_INT
,
0
);
f
->
glDrawElements
(
GL_PATCHES
,
entry
->
indices_irregular
.
size
(),
GL_UNSIGNED_INT
,
0
);
}
}
if
(
!
entry
->
indices_extra
.
isEmpty
()
&&
false
)
{
shader
->
setUniformValue
(
"materialInfo.Diffuse"
,
QVector3D
(
0.0
,
156.0
,
18.0
)
/
255.0
);
f
->
glBindBuffer
(
GL_ARRAY_BUFFER
,
entry
->
VB_handle
);
f
->
glVertexAttribPointer
(
positionIndex
,
3
,
GL_FLOAT
,
GL_FALSE
,
sizeof
(
Vertex
),
0
);
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
entry
->
IB_extra_handle
);
f
->
glPatchParameteri
(
GL_PATCH_VERTICES
,
3
);
f
->
glDrawElements
(
GL_PATCHES
,
entry
->
indices_extra
.
size
(),
GL_UNSIGNED_INT
,
0
);
}
}
}
}
}
...
...
QTProject/mesh.h
View file @
6883649b
...
@@ -34,20 +34,23 @@ public:
...
@@ -34,20 +34,23 @@ public:
GLuint
VB_handle
;
GLuint
VB_handle
;
GLuint
VB_handle_irregular
;
GLuint
VB_handle_irregular
;
GLuint
IB_irregular_handle
;
GLuint
IB_irregular_handle
;
GLuint
IB_regular_handle
;
GLuint
IB_regular_handle
;
GLuint
IB_extra_handle
;
QVector
<
Vertex
>
vertices
;
QVector
<
Vertex
>
vertices
;
QVector
<
Vertex
>
vertices_irregular
;
QVector
<
Vertex
>
vertices_irregular
;
QVector
<
unsigned
int
>
indices_irregular
;
QVector
<
unsigned
int
>
indices_irregular
;
QVector
<
unsigned
int
>
indices_regular
;
QVector
<
unsigned
int
>
indices_regular
;
QVector
<
unsigned
int
>
indices_extra
;
QOpenGLFunctions_4_3_Core
*
f
;
QOpenGLFunctions_4_3_Core
*
f
;
void
init
(
QOpenGLFunctions_4_3_Core
*
f
,
QVector
<
Vertex
>&
Vertices
,
void
init
(
QOpenGLFunctions_4_3_Core
*
f
,
QVector
<
Vertex
>&
Vertices
,
QVector
<
unsigned
int
>&
Indices_irregular
);
QVector
<
unsigned
int
>&
Indices_irregular
);
void
init
(
QOpenGLFunctions_4_3_Core
*
f
,
GLuint
VB_handle
,
QVector
<
Vertex
>&
Vertices
,
QVector
<
Vertex
>&
Vertices_irregular
,
void
init
(
QOpenGLFunctions_4_3_Core
*
f
,
GLuint
VB_handle
,
QVector
<
Vertex
>&
Vertices
,
QVector
<
Vertex
>&
Vertices_irregular
,
QVector
<
unsigned
int
>&
Indices_irregular
,
QVector
<
unsigned
int
>&
patches
);
QVector
<
unsigned
int
>&
Indices_irregular
,
QVector
<
unsigned
int
>&
patches
,
QVector
<
unsigned
int
>&
Indices_extra
);
void
updateIndices
();
void
updateIndices
();
};
};
...
@@ -56,7 +59,7 @@ public:
...
@@ -56,7 +59,7 @@ public:
~
MeshEntry
();
~
MeshEntry
();
void
init
(
QOpenGLFunctions_4_3_Core
*
f
,
QVector
<
Vertex
>&
Vertices
,
QVector
<
unsigned
int
>&
Indices
);
void
init
(
QOpenGLFunctions_4_3_Core
*
f
,
QVector
<
Vertex
>&
Vertices
,
QVector
<
unsigned
int
>&
Indices
);
void
update
(
GLuint
VB_handle
,
QVector
<
Vertex
>&
Vertices
,
QVector
<
Vertex
>&
Vertices_Irregular
,
QVector
<
unsigned
int
>&
Indices_irregular
,
QVector
<
unsigned
int
>&
patches
);
void
update
(
GLuint
VB_handle
,
QVector
<
Vertex
>&
Vertices
,
QVector
<
Vertex
>&
Vertices_Irregular
,
QVector
<
unsigned
int
>&
Indices_irregular
,
QVector
<
unsigned
int
>&
patches
,
QVector
<
unsigned
int
>&
Indices_extra
);
QString
name
;
QString
name
;
...
...
QTProject/subdivision.cpp
View file @
6883649b
...
@@ -17,9 +17,9 @@ Subdivision::~Subdivision()
...
@@ -17,9 +17,9 @@ Subdivision::~Subdivision()
}
}
QString
Subdivision
::
formatTimeMeasurement
(
int
time
){
QString
Subdivision
::
formatTimeMeasurement
(
int
time
){
return
QString
(
"%1m %2s %3ms"
).
arg
(
time
/
60000
,
2
,
10
,
QChar
(
'0'
))
return
QString
(
"%1m %2s %3ms"
).
arg
(
time
/
60000
,
2
,
10
,
QChar
(
'0'
))
.
arg
((
time
%
60000
)
/
1000
,
2
,
10
,
QChar
(
'0'
))
.
arg
((
time
%
60000
)
/
1000
,
2
,
10
,
QChar
(
'0'
))
.
arg
((
time
%
1000
)
,
3
,
10
,
QChar
(
'0'
));
.
arg
((
time
%
1000
)
,
3
,
10
,
QChar
(
'0'
));
}
}
void
Subdivision
::
init
()
{
void
Subdivision
::
init
()
{
...
@@ -72,9 +72,9 @@ void Subdivision::subdivide(Mesh *mesh, int level) {
...
@@ -72,9 +72,9 @@ void Subdivision::subdivide(Mesh *mesh, int level) {
Input
input
;
Input
input
;
int
currentMax
=
current_mesh
->
buffers
.
size
()
-
1
;
int
currentMax
=
current_mesh
->
buffers
.
size
()
-
1
;
//qCDebug(log_subdiv) << "Subdiv Level" << level << "Requested. Current Max:" << currentMax;
if
(
level
<=
currentMax
)
if
(
level
<=
currentMax
)
return
;
return
;
qCDebug
(
log_subdiv
)
<<
"========== Caluculating Subdiv Level"
<<
level
<<
"=========="
;
std
::
shared_ptr
<
Mesh
::
SubdivEntry
>
entry
=
current_mesh
->
buffers
[
currentMax
];
std
::
shared_ptr
<
Mesh
::
SubdivEntry
>
entry
=
current_mesh
->
buffers
[
currentMax
];
...
@@ -119,7 +119,7 @@ void Subdivision::subdivide(Mesh *mesh, int level) {
...
@@ -119,7 +119,7 @@ void Subdivision::subdivide(Mesh *mesh, int level) {
getPatchIndexBuffer
(
regular
,
neighbors
,
patches
);
getPatchIndexBuffer
(
regular
,
neighbors
,
patches
);
qCDebug
(
log_subdiv
)
<<
"patches"
<<
patches
.
length
();
qCDebug
(
log_subdiv
)
<<
"patches"
<<
patches
.
length
();
current_mesh
->
update
(
result
.
vb_handle
,
result
.
vertex_buffer
,
result
.
vertex_buffer_irregular
,
irregular_ib
,
patches
);
current_mesh
->
update
(
result
.
vb_handle
,
result
.
vertex_buffer
,
result
.
vertex_buffer_irregular
,
irregular_ib
,
patches
,
tables
.
extra_triangles
);
qCDebug
(
log_timing
)
<<
"subdivide done:"
<<
formatTimeMeasurement
(
timer
.
elapsed
());
qCDebug
(
log_timing
)
<<
"subdivide done:"
<<
formatTimeMeasurement
(
timer
.
elapsed
());
}
}
...
@@ -182,11 +182,10 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
...
@@ -182,11 +182,10 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
precomputeEdgeTable
(
tables
,
triangles
,
neighbors
,
(
unsigned
int
)
vb
.
length
(),
extra_old_triangles
);
precomputeEdgeTable
(
tables
,
triangles
,
neighbors
,
(
unsigned
int
)
vb
.
length
(),
extra_old_triangles
);
qCDebug
(
log_timing
)
<<
"precomputeEdgeTable:"
<<
formatTimeMeasurement
(
subTimer
.
elapsed
());
qCDebug
(
log_timing
)
<<
"precomputeEdgeTable:"
<<
formatTimeMeasurement
(
subTimer
.
elapsed
());
QVector
<
Triangle
>
irregular_and_extra_triangles
=
triangles
+
extra_old_triangles
;
QVector
<
Triangle
>
irregular_and_extra_triangles
=
triangles
+
extra_old_triangles
;
QMap
<
unsigned
int
,
unsigned
int
>
modified_vertices
;
QMap
<
unsigned
int
,
unsigned
int
>
modified_vertices
;
subTimer
.
restart
();
subTimer
.
restart
();
QVector
<
Triangle
>
foo
=
all_triangles
+
extra_old_triangles
;
precomputeVertexTable
(
tables
,
vb
,
irregular_and_extra_triangles
,
neighbors
,
modified_vertices
);
precomputeVertexTable
(
tables
,
vb
,
foo
,
neighbors
,
modified_vertices
);
qCDebug
(
log_timing
)
<<
"precomputeVertexTable:"
<<
formatTimeMeasurement
(
subTimer
.
elapsed
());
qCDebug
(
log_timing
)
<<
"precomputeVertexTable:"
<<
formatTimeMeasurement
(
subTimer
.
elapsed
());
subTimer
.
restart
();
subTimer
.
restart
();
...
@@ -383,9 +382,16 @@ void Subdivision::buildNeighborsMap(QVector<Vertex> &vb, QVector<Triangle> &tria
...
@@ -383,9 +382,16 @@ void Subdivision::buildNeighborsMap(QVector<Vertex> &vb, QVector<Triangle> &tria
QVector
<
Triangle
>
Subdivision
::
vertexNeighbors
(
Triangle
&
triangle
,
Triangle
::
Neighbor
current_neighbor
,
QMap
<
Triangle
,
Triangle
::
Neighbors
>
neighbors
)
{
QVector
<
Triangle
>
Subdivision
::
vertexNeighbors
(
Triangle
&
triangle
,
Triangle
::
Neighbor
current_neighbor
,
QMap
<
Triangle
,
Triangle
::
Neighbors
>
neighbors
)
{
QVector
<
Triangle
>
ns
;
QVector
<
Triangle
>
ns
;
do
{
do
{
assert
(
current_neighbor
.
triangle
!=
NULL
);
if
(
current_neighbor
.
triangle
==
NULL
){
ns
.
clear
();
return
ns
;
}
ns
.
push_back
(
*
current_neighbor
.
triangle
);
ns
.
push_back
(
*
current_neighbor
.
triangle
);
current_neighbor
=
neighbors
.
value
(
*
current_neighbor
.
triangle
).
get_neighbor
(
rotate_edge_name
(
current_neighbor
.
edge
.
name
));
current_neighbor
=
neighbors
.
value
(
*
current_neighbor
.
triangle
).
get_neighbor
(
rotate_edge_name
(
current_neighbor
.
edge
.
name
));
if
(
current_neighbor
.
triangle
==
NULL
){
ns
.
clear
();
return
ns
;
}
}
while
(
*
current_neighbor
.
triangle
!=
triangle
);
}
while
(
*
current_neighbor
.
triangle
!=
triangle
);
assert
(
current_neighbor
.
triangle
!=
NULL
);
assert
(
current_neighbor
.
triangle
!=
NULL
);
return
ns
;
return
ns
;
...
@@ -614,6 +620,7 @@ void Subdivision::precomputeVertexTable(Tables &tables, QVector<Vertex> &vb, QVe
...
@@ -614,6 +620,7 @@ void Subdivision::precomputeVertexTable(Tables &tables, QVector<Vertex> &vb, QVe
unsigned
int
output_offset
=
vb
.
size
()
+
tables
.
edge_indices
.
size
()
/
4
;
unsigned
int
output_offset
=
vb
.
size
()
+
tables
.
edge_indices
.
size
()
/
4
;
tables
.
vertex_offsets
.
push_back
(
0
);
tables
.
vertex_offsets
.
push_back
(
0
);
for
(
int
i
=
0
;
i
<
irregular_triangles
.
length
();
i
++
)
{
for
(
int
i
=
0
;
i
<
irregular_triangles
.
length
();
i
++
)
{
Triangle
triangle
=
irregular_triangles
[
i
];
Triangle
triangle
=
irregular_triangles
[
i
];
...
@@ -624,35 +631,44 @@ void Subdivision::precomputeVertexTable(Tables &tables, QVector<Vertex> &vb, QVe
...
@@ -624,35 +631,44 @@ void Subdivision::precomputeVertexTable(Tables &tables, QVector<Vertex> &vb, QVe
idx
=
triangle
.
u_idx
();
idx
=
triangle
.
u_idx
();
if
(
!
modified_vertices
.
contains
(
idx
))
{
if
(
!
modified_vertices
.
contains
(
idx
))
{
tables
.
vertex_indices
.
push_back
(
idx
);
QVector
<
Triangle
>
neighborTriangles
=
vertexNeighbors
(
triangle
,
ns
.
uv
,
neighbors
);
modified_vertices
.
insert
(
idx
,
output_offset
++
);
if
(
!
neighborTriangles
.
empty
()){
neighbor_indices
=
getAllVertexIndices
(
vb
,
vertexNeighbors
(
triangle
,
ns
.
uv
,
neighbors
));
tables
.
vertex_indices
.
push_back
(
idx
);
removed
=
removeVertexIndex
(
vb
,
neighbor_indices
,
triangle
.
u
());
modified_vertices
.
insert
(
idx
,
output_offset
++
);
assert
(
removed
);
neighbor_indices
=
getAllVertexIndices
(
vb
,
neighborTriangles
);
tables
.
vertex_indices
+=
neighbor_indices
;
removed
=
removeVertexIndex
(
vb
,
neighbor_indices
,
triangle
.
u
());
tables
.
vertex_offsets
.
push_back
(
tables
.
vertex_indices
.
length
());
assert
(
removed
);
tables
.
vertex_indices
+=
neighbor_indices
;
tables
.
vertex_offsets
.
push_back
(
tables
.
vertex_indices
.
length
());
}
}
}
idx
=
triangle
.
v_idx
();
idx
=
triangle
.
v_idx
();
if
(
!
modified_vertices
.
contains
(
idx
))
{
if
(
!
modified_vertices
.
contains
(
idx
))
{
tables
.
vertex_indices
.
push_back
(
idx
);
QVector
<
Triangle
>
neighborTriangles
=
vertexNeighbors
(
triangle
,
ns
.
vw
,
neighbors
);
modified_vertices
.
insert
(
idx
,
output_offset
++
);
if
(
!
neighborTriangles
.
empty
()){
neighbor_indices
=
getAllVertexIndices
(
vb
,
vertexNeighbors
(
triangle
,
ns
.
vw
,
neighbors
));
tables
.
vertex_indices
.
push_back
(
idx
);
removed
=
removeVertexIndex
(
vb
,
neighbor_indices
,
triangle
.
v
());
modified_vertices
.
insert
(
idx
,
output_offset
++
);
assert
(
removed
);
neighbor_indices
=
getAllVertexIndices
(
vb
,
neighborTriangles
);
tables
.
vertex_indices
+=
neighbor_indices
;
removed
=
removeVertexIndex
(
vb
,
neighbor_indices
,
triangle
.
v
());
tables
.
vertex_offsets
.
push_back
(
tables
.
vertex_indices
.
length
());
assert
(
removed
);
tables
.
vertex_indices
+=
neighbor_indices
;
tables
.
vertex_offsets
.
push_back
(
tables
.
vertex_indices
.
length
());
}
}
}
idx
=
triangle
.
w_idx
();
idx
=
triangle
.
w_idx
();
if
(
!
modified_vertices
.
contains
(
idx
))
{
if
(
!
modified_vertices
.
contains
(
idx
))
{
tables
.
vertex_indices
.
push_back
(
idx
);
QVector
<
Triangle
>
neighborTriangles
=
vertexNeighbors
(
triangle
,
ns
.
wu
,
neighbors
);
modified_vertices
.
insert
(
idx
,
output_offset
++
);
if
(
!
neighborTriangles
.
empty
()){
neighbor_indices
=
getAllVertexIndices
(
vb
,
vertexNeighbors
(
triangle
,
ns
.
wu
,
neighbors
));
tables
.
vertex_indices
.
push_back
(
idx
);
removed
=
removeVertexIndex
(
vb
,
neighbor_indices
,
triangle
.
w
());
modified_vertices
.
insert
(
idx
,
output_offset
++
);
assert
(
removed
);
neighbor_indices
=
getAllVertexIndices
(
vb
,
neighborTriangles
);
tables
.
vertex_indices
+=
neighbor_indices
;
removed
=
removeVertexIndex
(
vb
,
neighbor_indices
,
triangle
.
w
());
tables
.
vertex_offsets
.
push_back
(
tables
.
vertex_indices
.
length
());
assert
(
removed
);
tables
.
vertex_indices
+=
neighbor_indices
;
tables
.
vertex_offsets
.
push_back
(
tables
.
vertex_indices
.
length
());
}
}
}
}
}
qCDebug
(
log_timing
)
<<
"precomputeVertexTable done:"
<<
formatTimeMeasurement
(
timer
.
elapsed
());
qCDebug
(
log_timing
)
<<
"precomputeVertexTable done:"
<<
formatTimeMeasurement
(
timer
.
elapsed
());
...
@@ -866,6 +882,7 @@ void Subdivision::findRegular(QVector<Triangle> triangles, QMap<Triangle, Triang
...
@@ -866,6 +882,7 @@ void Subdivision::findRegular(QVector<Triangle> triangles, QMap<Triangle, Triang
Triangle
::
Neighbors
ns
=
neighbors
.
value
(
triangle
);
Triangle
::
Neighbors
ns
=
neighbors
.
value
(
triangle
);
bool
is_regular
=
true
;
bool
is_regular
=
true
;
if
(
!
isVertexRegular
(
triangle
,
ns
.
uv
,
neighbors
))
{
if
(
!
isVertexRegular
(
triangle
,
ns
.
uv
,
neighbors
))
{
is_regular
=
false
;
is_regular
=
false
;
}
}
...
@@ -876,6 +893,7 @@ void Subdivision::findRegular(QVector<Triangle> triangles, QMap<Triangle, Triang
...
@@ -876,6 +893,7 @@ void Subdivision::findRegular(QVector<Triangle> triangles, QMap<Triangle, Triang
is_regular
=
false
;
is_regular
=
false
;
}
}
if
(
is_regular
)
{
if
(
is_regular
)
{
regular
.
push_back
(
triangle
);
regular
.
push_back
(
triangle
);
}
else
{
}
else
{
...
...
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