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
e56887c7
Commit
e56887c7
authored
Jul 21, 2016
by
Kai Westerkamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
subdivide
parent
c2d8d532
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
11 deletions
+14
-11
mesh.cpp
QTProject/mesh.cpp
+7
-3
subdivideRegular.tcs
QTProject/subdivideRegular.tcs
+2
-2
subdivideRegular.tes
QTProject/subdivideRegular.tes
+5
-5
subdivision.cpp
QTProject/subdivision.cpp
+0
-1
No files found.
QTProject/mesh.cpp
View file @
e56887c7
...
...
@@ -26,6 +26,11 @@ Mesh::SubdivEntry::~SubdivEntry()
void
Mesh
::
SubdivEntry
::
addRegular
(
QVector
<
unsigned
int
>&
Indices
){
indicesRegular
=
Indices
;
indices
.
clear
();
for
(
int
var
=
0
;
var
<
12
;
++
var
)
{
qDebug
()
<<
indicesRegular
[
var
];
}
f
->
glGenBuffers
(
1
,
&
IB_Regular
);
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
IB_Regular
);
f
->
glBufferData
(
GL_ELEMENT_ARRAY_BUFFER
,
sizeof
(
unsigned
int
)
*
indicesRegular
.
size
(),
&
indicesRegular
[
0
],
GL_STATIC_DRAW
);
...
...
@@ -460,13 +465,12 @@ void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision,
if
(
regular
){
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
entry
->
IB_Regular
);
f
->
glPatchParameteri
(
GL_PATCH_VERTICES
,
12
);
f
->
glDrawElements
(
GL_PATCHES
,
entry
->
indicesRegular
.
size
(),
GL_UNSIGNED_INT
,
0
);
}
else
{
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
entry
->
IB_handle
);
f
->
glPatchParameteri
(
GL_PATCH_VERTICES
,
3
);
f
->
glDrawElements
(
GL_PATCHES
,
entry
->
indices
.
size
(),
GL_UNSIGNED_INT
,
0
);
}
...
...
QTProject/subdivideRegular.tcs
View file @
e56887c7
...
...
@@ -5,14 +5,14 @@ layout(vertices = 12) out;
in vec3 vPosition[];
out vec3 tcPosition[];
uniform
floa
t subdiv;
uniform
in
t subdiv;
void main()
{
tcPosition[gl_InvocationID] = vPosition[gl_InvocationID];
float tesselation = subdiv;
float tesselation = subdiv
+6
;
gl_TessLevelOuter[0] = tesselation;
gl_TessLevelOuter[1] = tesselation;
...
...
QTProject/subdivideRegular.tes
View file @
e56887c7
...
...
@@ -36,7 +36,7 @@ void main()
float a3 = 6*u4+24*u3*w+24*u2*w2+8*u*w3+w4+24*u3*v+60*u2*v*w+36*u*v*w2+6*v*w3+24*u2*v2+36*u*v2*w+12*v2*w2+8*u*v3+6*v3*w+v4;
float a4 = u4+6*u3*w+12*u2*w2+6*u*w3+w4+2*u3*v+6*u2*v*w+6*u*v*w2+2*v*w3;
float a5 = 2*u*v3+v4;
float a6 = u4+6*u3*w+12*u2*w2+6*u*w3+w4+8*u3*v+36*u2*v*w+36*u*v*w2+8*v*w3+24*u2*v2+60*u*v2*w+24*v2*w2+24*u*
w
3+24*v3*w+6*v4;
float a6 = u4+6*u3*w+12*u2*w2+6*u*w3+w4+8*u3*v+36*u2*v*w+36*u*v*w2+8*v*w3+24*u2*v2+60*u*v2*w+24*v2*w2+24*u*
v
3+24*v3*w+6*v4;
float a7 = u4+8*u3*w+24*u2*w2+24*u*w3+6*w4+6*u3*v+36*u2*v*w+60*u*v*w2+24*v*w3+12*u2*v2+36*u*v2*w+24*v2*w2+6*u*v3+8*v3*w+v4;
float a8 = 2*u*w3+w4;
float a9 = 2*v3*w+v4;
...
...
@@ -60,10 +60,10 @@ void main()
vec4 pos = vec4(newPos/12,1);
vec3 d0 = gl_TessCoord.x * p3;
vec3 d1 = gl_TessCoord.y * p6;
vec3 d2 = gl_TessCoord.z * p7;
pos = vec4((d0 + d1 + d2),1);
//
vec3 d0 = gl_TessCoord.x * p3;
//
vec3 d1 = gl_TessCoord.y * p6;
//
vec3 d2 = gl_TessCoord.z * p7;
//
pos = vec4((d0 + d1 + d2),1);
tePatchDistance = gl_TessCoord.xyz;
teCamPosition = vec4(MV*pos).xyz;
...
...
QTProject/subdivision.cpp
View file @
e56887c7
...
...
@@ -76,7 +76,6 @@ void Subdivision::subdivide(Mesh *mesh, int level) {
current_mesh
->
update
(
result
.
vb_handle
,
result
.
vertex_buffer
,
tables
.
index_buffer
);
current_mesh
->
buffers
[
currentMax
+
1
]
->
addRegular
(
tables
.
index_regular
);
qDebug
()
<<
tables
.
index_regular
.
size
();
//return new Mesh(f, mesh, result.vertex_buffer, tables.index_buffer);
}
...
...
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