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
0e9ef934
Commit
0e9ef934
authored
Aug 18, 2016
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change extractPatches to findRegular
findRegular returns two index buffers, one for regular triangles and one for irregular ones.
parent
fa34b503
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
11 deletions
+18
-11
subdivision.cpp
QTProject/subdivision.cpp
+17
-10
subdivision.h
QTProject/subdivision.h
+1
-1
No files found.
QTProject/subdivision.cpp
View file @
0e9ef934
...
@@ -479,15 +479,16 @@ QVector<unsigned int> Subdivision::getPatchIndexBuffer(QVector<unsigned int> ib)
...
@@ -479,15 +479,16 @@ QVector<unsigned int> Subdivision::getPatchIndexBuffer(QVector<unsigned int> ib)
return
pib
;
return
pib
;
}
}
/*
/*
*
*
TODO: test code, use it
*
Generates index buffers containing all regular and all irregular triangles in the input index buffer.
*
*
* Would probably be a good idea to store both regular and irregular patches.
* @param index_buffer Index buffer describing triangles.
* @param vertex_buffer Vertices used by index_buffer.
* @param regular All regular triangles are appended to this index buffer.
* @param irregular All irregular triangles are appended to this index buffer.
*/
*/
void
Subdivision
::
extractPatches
(
QVector
<
unsigned
int
>
index_buffer
,
QVector
<
Vertex
>
vertex_buffer
,
QVector
<
Subdivision
::
Patch
>
&
patches
){
void
Subdivision
::
findRegular
(
QVector
<
unsigned
int
>
index_buffer
,
QVector
<
Vertex
>
vertex_buffer
,
QVector
<
unsigned
int
>
&
regular
,
QVector
<
unsigned
int
>
&
irregular
)
{
patches
.
clear
();
for
(
int
i
=
0
;
i
<
index_buffer
.
length
()
-
2
;
i
+=
3
){
for
(
unsigned
int
i
=
0
;
i
<
index_buffer
.
length
()
-
2
;
i
+=
3
){
Vertex
vx
=
vertex_buffer
[
index_buffer
[
i
]];
Vertex
vx
=
vertex_buffer
[
index_buffer
[
i
]];
Vertex
vy
=
vertex_buffer
[
index_buffer
[
i
+
1
]];
Vertex
vy
=
vertex_buffer
[
index_buffer
[
i
+
1
]];
Vertex
vz
=
vertex_buffer
[
index_buffer
[
i
+
2
]];
Vertex
vz
=
vertex_buffer
[
index_buffer
[
i
+
2
]];
...
@@ -495,7 +496,7 @@ void Subdivision::extractPatches(QVector<unsigned int> index_buffer, QVector<Ver
...
@@ -495,7 +496,7 @@ void Subdivision::extractPatches(QVector<unsigned int> index_buffer, QVector<Ver
int
countx
=
0
;
int
countx
=
0
;
int
county
=
0
;
int
county
=
0
;
int
countz
=
0
;
int
countz
=
0
;
for
(
unsigned
int
j
=
0
;
j
<
index_buffer
.
length
();
j
++
){
for
(
int
j
=
0
;
j
<
index_buffer
.
length
();
j
++
){
if
(
j
!=
i
&&
j
!=
i
+
1
&&
j
!=
i
+
2
){
if
(
j
!=
i
&&
j
!=
i
+
1
&&
j
!=
i
+
2
){
if
(
vx
.
samePos
(
vertex_buffer
[
index_buffer
[
j
]])){
if
(
vx
.
samePos
(
vertex_buffer
[
index_buffer
[
j
]])){
countx
++
;
countx
++
;
...
@@ -508,8 +509,14 @@ void Subdivision::extractPatches(QVector<unsigned int> index_buffer, QVector<Ver
...
@@ -508,8 +509,14 @@ void Subdivision::extractPatches(QVector<unsigned int> index_buffer, QVector<Ver
}
}
}
}
}
}
if
(
countx
!=
5
||
county
!=
5
||
countz
!=
5
){
if
(
countx
==
5
&&
county
==
5
&&
countz
==
5
){
//triangle is irregular
regular
.
push_back
(
index_buffer
[
i
]);
regular
.
push_back
(
index_buffer
[
i
+
1
]);
regular
.
push_back
(
index_buffer
[
i
+
2
]);
}
else
{
irregular
.
push_back
(
index_buffer
[
i
]);
irregular
.
push_back
(
index_buffer
[
i
+
1
]);
irregular
.
push_back
(
index_buffer
[
i
+
2
]);
}
}
}
}
}
}
...
...
QTProject/subdivision.h
View file @
0e9ef934
...
@@ -53,7 +53,7 @@ private:
...
@@ -53,7 +53,7 @@ private:
QOpenGLShaderProgram
*
initComputeShaderProgram
(
QString
&
source
);
QOpenGLShaderProgram
*
initComputeShaderProgram
(
QString
&
source
);
Tables
precomputeTables
(
Input
input
);
Tables
precomputeTables
(
Input
input
);
void
extractPatches
(
QVector
<
unsigned
int
>
index_buffer
,
QVector
<
Vertex
>
vertex_buffer
,
QVector
<
Patch
>
&
patches
);
void
findRegular
(
QVector
<
unsigned
int
>
index_buffer
,
QVector
<
Vertex
>
vertex_buffer
,
QVector
<
unsigned
int
>
&
regular
,
QVector
<
unsigned
int
>
&
irregular
);
Result
runShader
(
Input
input
,
Tables
&
tables
);
Result
runShader
(
Input
input
,
Tables
&
tables
);
void
runVertexShader
(
GLuint
size
,
GLuint
vb_handle
,
GLuint
vertex_indices_handle
,
GLuint
vertex_offsets_handle
,
GLuint
output_handle
);
void
runVertexShader
(
GLuint
size
,
GLuint
vb_handle
,
GLuint
vertex_indices_handle
,
GLuint
vertex_offsets_handle
,
GLuint
output_handle
);
void
runEdgeShader
(
GLuint
size
,
GLuint
vb_handle
,
GLuint
edge_indices_handle
,
GLuint
output_handle
,
GLuint
offset
);
void
runEdgeShader
(
GLuint
size
,
GLuint
vb_handle
,
GLuint
edge_indices_handle
,
GLuint
output_handle
,
GLuint
offset
);
...
...
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