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
163766c2
Commit
163766c2
authored
Sep 28, 2016
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename ibToTriangles to regularIbToTriangles
parent
38d1d37b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
13 deletions
+19
-13
subdivision.cpp
QTProject/subdivision.cpp
+8
-6
triangle.cpp
QTProject/triangle.cpp
+10
-6
triangle.h
QTProject/triangle.h
+1
-1
No files found.
QTProject/subdivision.cpp
View file @
163766c2
...
@@ -95,9 +95,9 @@ void Subdivision::subdivide(Mesh *mesh, int level) {
...
@@ -95,9 +95,9 @@ void Subdivision::subdivide(Mesh *mesh, int level) {
Result
result
=
runShader
(
input
,
tables
);
Result
result
=
runShader
(
input
,
tables
);
QVector
<
Triangle
>
triangles
;
QVector
<
Triangle
>
triangles
;
i
bToTriangles
(
&
result
.
vertex_buffer
,
tables
.
index_buffer
,
triangles
);
regularI
bToTriangles
(
&
result
.
vertex_buffer
,
tables
.
index_buffer
,
triangles
);
QVector
<
Triangle
>
all_triangles
;
QVector
<
Triangle
>
all_triangles
;
i
bToTriangles
(
&
result
.
vertex_buffer
,
tables
.
extra_triangles
,
all_triangles
);
regularI
bToTriangles
(
&
result
.
vertex_buffer
,
tables
.
extra_triangles
,
all_triangles
);
all_triangles
+=
triangles
;
all_triangles
+=
triangles
;
QMap
<
Triangle
,
Triangle
::
Neighbors
>
neighbors
;
QMap
<
Triangle
,
Triangle
::
Neighbors
>
neighbors
;
...
@@ -152,10 +152,10 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
...
@@ -152,10 +152,10 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
QTime
subTimer
;
QTime
subTimer
;
subTimer
.
start
();
subTimer
.
start
();
QVector
<
Triangle
>
triangles
;
QVector
<
Triangle
>
triangles
;
i
bToTriangles
(
&
vb
,
ib
,
triangles
);
regularI
bToTriangles
(
&
vb
,
ib
,
triangles
);
QVector
<
Triangle
>
triangles_regular
;
QVector
<
Triangle
>
triangles_regular
;
i
bToTriangles
(
&
vb
,
ib_regular
,
triangles_regular
);
regularI
bToTriangles
(
&
vb
,
ib_regular
,
triangles_regular
);
qCDebug
(
log_timing
)
<<
"building Triangles:"
<<
formatTimeMeasurement
(
subTimer
.
elapsed
());
qCDebug
(
log_timing
)
<<
"building Triangles:"
<<
formatTimeMeasurement
(
subTimer
.
elapsed
());
...
@@ -718,9 +718,11 @@ void Subdivision::splitRegular(Mesh *mesh) {
...
@@ -718,9 +718,11 @@ void Subdivision::splitRegular(Mesh *mesh) {
Mesh
::
MeshEntry
*
current_mesh
=
mesh
->
getMeshEntry
(
first_mesh_index
);
Mesh
::
MeshEntry
*
current_mesh
=
mesh
->
getMeshEntry
(
first_mesh_index
);
QVector
<
Triangle
>
all_triangles
;
QVector
<
Triangle
>
all_triangles
;
ibToTriangles
(
&
current_mesh
->
buffers
[
0
]
->
vertices
,
current_mesh
->
buffers
[
0
]
->
indices_irregular
,
all_triangles
);
regularIbToTriangles
(
&
current_mesh
->
buffers
[
0
]
->
vertices
,
current_mesh
->
buffers
[
0
]
->
indices_irregular
,
all_triangles
);
QVector
<
unsigned
int
>
old_regular_ib
=
patchIBToTriangleIB
(
current_mesh
->
buffers
[
0
]
->
indices_regular
);
QVector
<
unsigned
int
>
old_regular_ib
=
patchIBToTriangleIB
(
current_mesh
->
buffers
[
0
]
->
indices_regular
);
i
bToTriangles
(
&
current_mesh
->
buffers
[
0
]
->
vertices
,
old_regular_ib
,
all_triangles
);
regularI
bToTriangles
(
&
current_mesh
->
buffers
[
0
]
->
vertices
,
old_regular_ib
,
all_triangles
);
QMap
<
Triangle
,
Triangle
::
Neighbors
>
neighbors
;
QMap
<
Triangle
,
Triangle
::
Neighbors
>
neighbors
;
buildNeighborsMap
(
current_mesh
->
buffers
[
0
]
->
vertices
,
all_triangles
,
neighbors
);
buildNeighborsMap
(
current_mesh
->
buffers
[
0
]
->
vertices
,
all_triangles
,
neighbors
);
...
...
QTProject/triangle.cpp
View file @
163766c2
...
@@ -208,12 +208,6 @@ Triangle::Edge::Name rotate_edge_name(Triangle::Edge::Name edge) {
...
@@ -208,12 +208,6 @@ Triangle::Edge::Name rotate_edge_name(Triangle::Edge::Name edge) {
}
}
}
}
void
ibToTriangles
(
QVector
<
Vertex
>
*
vb
,
QVector
<
unsigned
int
>
&
ib
,
QVector
<
Triangle
>
&
triangles
)
{
for
(
int
i
=
0
;
i
<
ib
.
length
();
i
+=
3
)
{
triangles
.
push_back
(
Triangle
(
vb
,
ib
[
i
],
ib
[
i
+
1
],
ib
[
i
+
2
]));
}
}
void
Triangle
::
set_sharpness
(
Triangle
::
Edge
::
Name
name
,
unsigned
int
value
){
void
Triangle
::
set_sharpness
(
Triangle
::
Edge
::
Name
name
,
unsigned
int
value
){
if
(
name
==
Edge
::
Name
::
uv
){
if
(
name
==
Edge
::
Name
::
uv
){
sharpness_uv
=
value
;
sharpness_uv
=
value
;
...
@@ -224,6 +218,16 @@ void Triangle::set_sharpness(Triangle::Edge::Name name, unsigned int value){
...
@@ -224,6 +218,16 @@ void Triangle::set_sharpness(Triangle::Edge::Name name, unsigned int value){
}
}
}
}
//basically the same as ibToTriangles without sharp edges
void
regularIbToTriangles
(
const
QVector
<
Vertex
>
*
vb
,
const
QVector
<
unsigned
int
>
&
ib
,
QVector
<
Triangle
>
&
triangles
)
{
for
(
int
i
=
0
;
i
<
ib
.
length
();
i
+=
3
)
{
triangles
.
push_back
(
Triangle
(
vb
,
ib
[
i
],
ib
[
i
+
1
],
ib
[
i
+
2
]));
}
}
void
trianglesToIB
(
const
QVector
<
Triangle
>
&
triangles
,
QVector
<
unsigned
int
>
&
ib
)
{
void
trianglesToIB
(
const
QVector
<
Triangle
>
&
triangles
,
QVector
<
unsigned
int
>
&
ib
)
{
ib
.
reserve
(
ib
.
length
()
+
triangles
.
length
()
*
3
);
ib
.
reserve
(
ib
.
length
()
+
triangles
.
length
()
*
3
);
QVectorIterator
<
Triangle
>
it
(
triangles
);
QVectorIterator
<
Triangle
>
it
(
triangles
);
...
...
QTProject/triangle.h
View file @
163766c2
...
@@ -88,7 +88,7 @@ class Triangle {
...
@@ -88,7 +88,7 @@ class Triangle {
};
};
Triangle
::
Edge
::
Name
rotate_edge_name
(
Triangle
::
Edge
::
Name
edge
);
Triangle
::
Edge
::
Name
rotate_edge_name
(
Triangle
::
Edge
::
Name
edge
);
void
ibToTriangles
(
QVector
<
Vertex
>
*
vb
,
QVector
<
unsigned
int
>
&
ib
,
QVector
<
Triangle
>
&
triangles
);
void
regularIbToTriangles
(
const
QVector
<
Vertex
>
*
vb
,
const
QVector
<
unsigned
int
>
&
ib
,
QVector
<
Triangle
>
&
triangles
);
void
trianglesToIB
(
const
QVector
<
Triangle
>
&
triangles
,
QVector
<
unsigned
int
>
&
ib
);
void
trianglesToIB
(
const
QVector
<
Triangle
>
&
triangles
,
QVector
<
unsigned
int
>
&
ib
);
QDebug
operator
<<
(
QDebug
d
,
const
Triangle
&
triangle
);
QDebug
operator
<<
(
QDebug
d
,
const
Triangle
&
triangle
);
...
...
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