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
84a57269
Commit
84a57269
authored
Aug 20, 2016
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename variables in mesh.{cpp,h}
parent
88c169ea
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
38 deletions
+38
-38
mesh.cpp
QTProject/mesh.cpp
+28
-28
mesh.h
QTProject/mesh.h
+4
-4
subdivision.cpp
QTProject/subdivision.cpp
+6
-6
No files found.
QTProject/mesh.cpp
View file @
84a57269
...
@@ -9,29 +9,29 @@ QDebug operator<< (QDebug d, const Vertex &v) {
...
@@ -9,29 +9,29 @@ QDebug operator<< (QDebug d, const Vertex &v) {
Mesh
::
SubdivEntry
::
SubdivEntry
()
Mesh
::
SubdivEntry
::
SubdivEntry
()
{
{
VB_handle
=
0xFFFFFFFF
;
VB_handle
=
0xFFFFFFFF
;
IB_handle
=
0xFFFFFFFF
;
IB_
irregular_
handle
=
0xFFFFFFFF
;
IB_
Regular
=
0xFFFFFFFF
;
IB_
regular_handle
=
0xFFFFFFFF
;
}
}
Mesh
::
SubdivEntry
::~
SubdivEntry
()
Mesh
::
SubdivEntry
::~
SubdivEntry
()
{
{
qDebug
()
<<
"FIXME: Delete Called: num vertex:"
<<
vertices
.
size
();
qDebug
()
<<
"FIXME: Delete Called: num vertex:"
<<
vertices
.
size
();
/*f->glDeleteBuffers(1, &VB_handle);
/*f->glDeleteBuffers(1, &VB_handle);
f->glDeleteBuffers(1, &IB_handle);
f->glDeleteBuffers(1, &IB_
irregular_
handle);
f->glDeleteBuffers(1, &IB_
Regular
);
f->glDeleteBuffers(1, &IB_
regular_handle
);
*/
*/
}
}
void
Mesh
::
SubdivEntry
::
updateIndices
()
{
void
Mesh
::
SubdivEntry
::
updateIndices
()
{
f
->
glDeleteBuffers
(
1
,
&
IB_handle
);
f
->
glDeleteBuffers
(
1
,
&
IB_
irregular_
handle
);
f
->
glGenBuffers
(
1
,
&
IB_handle
);
f
->
glGenBuffers
(
1
,
&
IB_
irregular_
handle
);
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
IB_handle
);
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
IB_
irregular_
handle
);
f
->
glBufferData
(
GL_ELEMENT_ARRAY_BUFFER
,
sizeof
(
unsigned
int
)
*
indices
.
size
(),
&
indices
[
0
],
GL_STATIC_DRAW
);
f
->
glBufferData
(
GL_ELEMENT_ARRAY_BUFFER
,
sizeof
(
unsigned
int
)
*
indices
_irregular
.
size
(),
&
indices_irregular
[
0
],
GL_STATIC_DRAW
);
f
->
glDeleteBuffers
(
1
,
&
IB_
Regular
);
f
->
glDeleteBuffers
(
1
,
&
IB_
regular_handle
);
f
->
glGenBuffers
(
1
,
&
IB_
Regular
);
f
->
glGenBuffers
(
1
,
&
IB_
regular_handle
);
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
IB_
Regular
);
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
IB_
regular_handle
);
f
->
glBufferData
(
GL_ELEMENT_ARRAY_BUFFER
,
sizeof
(
unsigned
int
)
*
indices
Regular
.
size
(),
&
indicesR
egular
[
0
],
GL_STATIC_DRAW
);
f
->
glBufferData
(
GL_ELEMENT_ARRAY_BUFFER
,
sizeof
(
unsigned
int
)
*
indices
_regular
.
size
(),
&
indices_r
egular
[
0
],
GL_STATIC_DRAW
);
}
}
void
Mesh
::
SubdivEntry
::
init
(
QOpenGLFunctions_4_3_Core
*
f
,
QVector
<
Vertex
>&
Vertices
,
void
Mesh
::
SubdivEntry
::
init
(
QOpenGLFunctions_4_3_Core
*
f
,
QVector
<
Vertex
>&
Vertices
,
...
@@ -51,19 +51,19 @@ void Mesh::SubdivEntry::init(QOpenGLFunctions_4_3_Core *f, GLuint VB_handle, QVe
...
@@ -51,19 +51,19 @@ void Mesh::SubdivEntry::init(QOpenGLFunctions_4_3_Core *f, GLuint VB_handle, QVe
this
->
VB_handle
=
VB_handle
;
this
->
VB_handle
=
VB_handle
;
vertices
=
Vertices
;
vertices
=
Vertices
;
indices
=
Indices_irregular
;
indices
_irregular
=
Indices_irregular
;
indices
R
egular
=
patches
;
indices
_r
egular
=
patches
;
qDebug
()
<<
"Vertices"
<<
vertices
.
length
();
qDebug
()
<<
"Vertices"
<<
vertices
.
length
();
qDebug
()
<<
"Indices irregular"
<<
indices
.
length
();
qDebug
()
<<
"Indices irregular"
<<
indices
_irregular
.
length
();
qDebug
()
<<
"Indices patches"
<<
patches
.
length
();
qDebug
()
<<
"Indices patches"
<<
patches
.
length
();
f
->
glGenBuffers
(
1
,
&
IB_handle
);
f
->
glGenBuffers
(
1
,
&
IB_
irregular_
handle
);
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
IB_handle
);
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
IB_
irregular_
handle
);
f
->
glBufferData
(
GL_ELEMENT_ARRAY_BUFFER
,
sizeof
(
unsigned
int
)
*
indices
.
size
(),
&
indices
[
0
],
GL_STATIC_DRAW
);
f
->
glBufferData
(
GL_ELEMENT_ARRAY_BUFFER
,
sizeof
(
unsigned
int
)
*
indices
_irregular
.
size
(),
&
indices_irregular
[
0
],
GL_STATIC_DRAW
);
f
->
glGenBuffers
(
1
,
&
IB_
Regular
);
f
->
glGenBuffers
(
1
,
&
IB_
regular_handle
);
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
IB_
Regular
);
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
IB_
regular_handle
);
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
);
}
}
...
@@ -471,25 +471,25 @@ void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision,
...
@@ -471,25 +471,25 @@ void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision,
// Draw Vertex Array
// Draw Vertex Array
// qDebug()<<"Render"<<subdivision<<entry->indices;
// qDebug()<<"Render"<<subdivision<<entry->indices
_irregular
;
if
(
regular
){
if
(
regular
){
if
(
!
entry
->
indices
R
egular
.
isEmpty
())
{
if
(
!
entry
->
indices
_r
egular
.
isEmpty
())
{
f
->
glBindBuffer
(
GL_ARRAY_BUFFER
,
entry
->
VB_handle
);
f
->
glBindBuffer
(
GL_ARRAY_BUFFER
,
entry
->
VB_handle
);
f
->
glVertexAttribPointer
(
positionIndex
,
3
,
GL_FLOAT
,
GL_FALSE
,
sizeof
(
Vertex
),
0
);
f
->
glVertexAttribPointer
(
positionIndex
,
3
,
GL_FLOAT
,
GL_FALSE
,
sizeof
(
Vertex
),
0
);
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
entry
->
IB_
Regular
);
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
entry
->
IB_
regular_handle
);
f
->
glPatchParameteri
(
GL_PATCH_VERTICES
,
12
);
f
->
glPatchParameteri
(
GL_PATCH_VERTICES
,
12
);
f
->
glDrawElements
(
GL_PATCHES
,
entry
->
indices
R
egular
.
size
(),
GL_UNSIGNED_INT
,
0
);
f
->
glDrawElements
(
GL_PATCHES
,
entry
->
indices
_r
egular
.
size
(),
GL_UNSIGNED_INT
,
0
);
}
}
}
else
{
}
else
{
if
(
!
entry
->
indices
.
isEmpty
())
{
if
(
!
entry
->
indices
_irregular
.
isEmpty
())
{
f
->
glBindBuffer
(
GL_ARRAY_BUFFER
,
entry
->
VB_handle
);
f
->
glBindBuffer
(
GL_ARRAY_BUFFER
,
entry
->
VB_handle
);
f
->
glVertexAttribPointer
(
positionIndex
,
3
,
GL_FLOAT
,
GL_FALSE
,
sizeof
(
Vertex
),
0
);
f
->
glVertexAttribPointer
(
positionIndex
,
3
,
GL_FLOAT
,
GL_FALSE
,
sizeof
(
Vertex
),
0
);
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
entry
->
IB_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
.
size
(),
GL_UNSIGNED_INT
,
0
);
f
->
glDrawElements
(
GL_PATCHES
,
entry
->
indices
_irregular
.
size
(),
GL_UNSIGNED_INT
,
0
);
}
}
}
}
}
}
...
...
QTProject/mesh.h
View file @
84a57269
...
@@ -60,12 +60,12 @@ public:
...
@@ -60,12 +60,12 @@ public:
~
SubdivEntry
();
~
SubdivEntry
();
GLuint
VB_handle
;
GLuint
VB_handle
;
GLuint
IB_handle
;
GLuint
IB_
irregular_
handle
;
GLuint
IB_
Regular
;
GLuint
IB_
regular_handle
;
QVector
<
Vertex
>
vertices
;
QVector
<
Vertex
>
vertices
;
QVector
<
unsigned
int
>
indices
;
QVector
<
unsigned
int
>
indices
_irregular
;
QVector
<
unsigned
int
>
indices
R
egular
;
QVector
<
unsigned
int
>
indices
_r
egular
;
QOpenGLFunctions_4_3_Core
*
f
;
QOpenGLFunctions_4_3_Core
*
f
;
...
...
QTProject/subdivision.cpp
View file @
84a57269
...
@@ -69,10 +69,10 @@ void Subdivision::subdivide(Mesh *mesh, int level) {
...
@@ -69,10 +69,10 @@ void Subdivision::subdivide(Mesh *mesh, int level) {
input
.
vb_handle
=
entry
->
VB_handle
;
input
.
vb_handle
=
entry
->
VB_handle
;
input
.
vertex_buffer
=
entry
->
vertices
;
input
.
vertex_buffer
=
entry
->
vertices
;
input
.
index_buffer
=
entry
->
indices
;
input
.
index_buffer
=
entry
->
indices
_irregular
;
if
(
input
.
index_buffer
.
isEmpty
())
{
if
(
input
.
index_buffer
.
isEmpty
())
{
current_mesh
->
update
(
input
.
vb_handle
,
input
.
vertex_buffer
,
input
.
index_buffer
,
entry
->
indices
R
egular
);
current_mesh
->
update
(
input
.
vb_handle
,
input
.
vertex_buffer
,
input
.
index_buffer
,
entry
->
indices
_r
egular
);
}
else
{
}
else
{
Tables
tables
=
precomputeTables
(
input
);
Tables
tables
=
precomputeTables
(
input
);
Result
result
=
runShader
(
input
,
tables
);
Result
result
=
runShader
(
input
,
tables
);
...
@@ -388,12 +388,12 @@ void Subdivision::splitRegular(Mesh *mesh) {
...
@@ -388,12 +388,12 @@ void Subdivision::splitRegular(Mesh *mesh) {
QVector
<
unsigned
int
>
regular
;
QVector
<
unsigned
int
>
regular
;
QVector
<
unsigned
int
>
irregular
;
QVector
<
unsigned
int
>
irregular
;
findRegular
(
current_mesh
->
buffers
[
0
]
->
indices
,
current_mesh
->
buffers
[
0
]
->
vertices
,
regular
,
irregular
);
findRegular
(
current_mesh
->
buffers
[
0
]
->
indices
_irregular
,
current_mesh
->
buffers
[
0
]
->
vertices
,
regular
,
irregular
);
findRegular
(
current_mesh
->
buffers
[
0
]
->
indices
R
egular
,
current_mesh
->
buffers
[
0
]
->
vertices
,
regular
,
irregular
);
findRegular
(
current_mesh
->
buffers
[
0
]
->
indices
_r
egular
,
current_mesh
->
buffers
[
0
]
->
vertices
,
regular
,
irregular
);
QVector
<
unsigned
int
>
patches
=
getPatchIndexBuffer
(
regular
);
QVector
<
unsigned
int
>
patches
=
getPatchIndexBuffer
(
regular
);
current_mesh
->
buffers
[
0
]
->
indices
R
egular
=
patches
;
current_mesh
->
buffers
[
0
]
->
indices
_r
egular
=
patches
;
current_mesh
->
buffers
[
0
]
->
indices
=
irregular
;
current_mesh
->
buffers
[
0
]
->
indices
_irregular
=
irregular
;
current_mesh
->
buffers
[
0
]
->
updateIndices
();
current_mesh
->
buffers
[
0
]
->
updateIndices
();
qDebug
()
<<
"regular: "
<<
regular
.
length
();
qDebug
()
<<
"regular: "
<<
regular
.
length
();
...
...
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