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
1139c553
Commit
1139c553
authored
Sep 28, 2016
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
temp
parent
f0257839
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
8 deletions
+32
-8
mesh.cpp
QTProject/mesh.cpp
+8
-0
subdivision.cpp
QTProject/subdivision.cpp
+24
-8
No files found.
QTProject/mesh.cpp
View file @
1139c553
...
@@ -536,6 +536,14 @@ void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision,
...
@@ -536,6 +536,14 @@ void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision,
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
entry
->
IB_irregular_handle
);
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
entry
->
IB_irregular_handle
);
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
);
shader
->
setUniformValue
(
"materialInfo.Diffuse"
,
QVector3D
(
255.0
,
0.0
,
0.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_irregular_handle
);
f
->
glPatchParameteri
(
GL_PATCH_VERTICES
,
3
);
//f->glDrawElements(GL_PATCHES, entry->indices_irregular.size(), GL_UNSIGNED_INT, 0);
}
}
if
(
!
entry
->
indices_extra
.
isEmpty
()
&&
false
)
{
if
(
!
entry
->
indices_extra
.
isEmpty
()
&&
false
)
{
...
...
QTProject/subdivision.cpp
View file @
1139c553
...
@@ -1284,19 +1284,36 @@ void Subdivision::updateIrregularForDraw(const QVector<Triangle> &triangles,QMap
...
@@ -1284,19 +1284,36 @@ void Subdivision::updateIrregularForDraw(const QVector<Triangle> &triangles,QMap
result
.
vertex_buffer_irregular
[
triangle
.
v_idx
()]
=
result
.
vertex_buffer
.
at
(
triangle
.
v_idx
());
result
.
vertex_buffer_irregular
[
triangle
.
v_idx
()]
=
result
.
vertex_buffer
.
at
(
triangle
.
v_idx
());
result
.
vertex_buffer_irregular
[
triangle
.
w_idx
()]
=
result
.
vertex_buffer
.
at
(
triangle
.
w_idx
());
result
.
vertex_buffer_irregular
[
triangle
.
w_idx
()]
=
result
.
vertex_buffer
.
at
(
triangle
.
w_idx
());
bool
uv_sharp
=
(
triangle
.
get_sharpness_uv
()
>
0
);
bool
vw_sharp
=
(
triangle
.
get_sharpness_vw
()
>
0
);
bool
wu_sharp
=
(
triangle
.
get_sharpness_wu
()
>
0
);
Triangle
::
Neighbors
ns
=
neighbors
.
value
(
triangle
);
Triangle
::
Neighbors
ns
=
neighbors
.
value
(
triangle
);
if
(
!
(
uv_sharp
||
wu_sharp
))
{
bool
u_sharp
=
triangle
.
get_sharpness_uv
()
>
0
;
bool
v_sharp
=
triangle
.
get_sharpness_vw
()
>
0
;
bool
w_sharp
=
triangle
.
get_sharpness_wu
()
>
0
;
Triangle
::
Neighbor
n
;
n
=
ns
.
uv
;
while
(
*
n
.
triangle
!=
triangle
)
{
u_sharp
=
u_sharp
||
n
.
triangle
->
get_sharpness
(
rotate_edge_name
(
n
.
edge
.
name
))
>
0
;
n
=
neighbors
[
*
n
.
triangle
].
get_neighbor
(
rotate_edge_name
(
n
.
edge
.
name
));
}
n
=
ns
.
vw
;
while
(
*
n
.
triangle
!=
triangle
)
{
v_sharp
=
v_sharp
||
n
.
triangle
->
get_sharpness
(
rotate_edge_name
(
n
.
edge
.
name
))
>
0
;
n
=
neighbors
[
*
n
.
triangle
].
get_neighbor
(
rotate_edge_name
(
n
.
edge
.
name
));
}
n
=
ns
.
wu
;
while
(
*
n
.
triangle
!=
triangle
)
{
w_sharp
=
w_sharp
||
n
.
triangle
->
get_sharpness
(
rotate_edge_name
(
n
.
edge
.
name
))
>
0
;
n
=
neighbors
[
*
n
.
triangle
].
get_neighbor
(
rotate_edge_name
(
n
.
edge
.
name
));
}
if
(
!
u_sharp
)
{
result
.
vertex_buffer_irregular
[
triangle
.
u_idx
()].
pos
=
updateIrregularVertexForDraw
(
triangle
.
u
(),
vertexNeighbors
(
triangle
,
ns
.
uv
,
neighbors
));
result
.
vertex_buffer_irregular
[
triangle
.
u_idx
()].
pos
=
updateIrregularVertexForDraw
(
triangle
.
u
(),
vertexNeighbors
(
triangle
,
ns
.
uv
,
neighbors
));
}
}
if
(
!
(
uv_sharp
||
vw_sharp
)
)
{
if
(
!
v_sharp
)
{
result
.
vertex_buffer_irregular
[
triangle
.
v_idx
()].
pos
=
updateIrregularVertexForDraw
(
triangle
.
v
(),
vertexNeighbors
(
triangle
,
ns
.
vw
,
neighbors
));
result
.
vertex_buffer_irregular
[
triangle
.
v_idx
()].
pos
=
updateIrregularVertexForDraw
(
triangle
.
v
(),
vertexNeighbors
(
triangle
,
ns
.
vw
,
neighbors
));
}
}
if
(
!
(
vw_sharp
||
wu_sharp
)
)
{
if
(
!
w_sharp
)
{
result
.
vertex_buffer_irregular
[
triangle
.
w_idx
()].
pos
=
updateIrregularVertexForDraw
(
triangle
.
w
(),
vertexNeighbors
(
triangle
,
ns
.
wu
,
neighbors
));
result
.
vertex_buffer_irregular
[
triangle
.
w_idx
()].
pos
=
updateIrregularVertexForDraw
(
triangle
.
w
(),
vertexNeighbors
(
triangle
,
ns
.
wu
,
neighbors
));
}
}
}
}
...
@@ -1341,7 +1358,6 @@ bool removeVertex(QVector<Vertex> &vertices, const Vertex &vertex) {
...
@@ -1341,7 +1358,6 @@ bool removeVertex(QVector<Vertex> &vertices, const Vertex &vertex) {
QVector3D
Subdivision
::
updateIrregularVertexForDraw
(
Vertex
currentCorner
,
QVector
<
Triangle
>
neighboring_triangles
)
{
QVector3D
Subdivision
::
updateIrregularVertexForDraw
(
Vertex
currentCorner
,
QVector
<
Triangle
>
neighboring_triangles
)
{
QVector
<
Vertex
>
surroundingVertex
;
QVector
<
Vertex
>
surroundingVertex
;
return
currentCorner
.
pos
;
surroundingVertex
=
getAllVertices
(
neighboring_triangles
);
surroundingVertex
=
getAllVertices
(
neighboring_triangles
);
bool
removed
=
removeVertex
(
surroundingVertex
,
currentCorner
);
bool
removed
=
removeVertex
(
surroundingVertex
,
currentCorner
);
...
...
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