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
21f7a420
Commit
21f7a420
authored
Jul 21, 2016
by
Kai Westerkamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
richtigen vertecies nehmen...
parent
e56887c7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
24 deletions
+30
-24
mainwidget.cpp
QTProject/mainwidget.cpp
+17
-16
mesh.cpp
QTProject/mesh.cpp
+6
-2
subdivideRegular.tcs
QTProject/subdivideRegular.tcs
+1
-1
subdivideRegular.tes
QTProject/subdivideRegular.tes
+6
-5
No files found.
QTProject/mainwidget.cpp
View file @
21f7a420
...
...
@@ -127,9 +127,9 @@ void MainWidget::loadNewMesh(){
QString
fn
=
QFileDialog
::
getOpenFileName
(
NULL
,
tr
(
"Open Mesh..."
),
QString
(
"..
\\
Models"
),
tr
(
"*.md5mesh *.3ds *.md2 *.obj *.dae *.dxf *.mesh.xml *.blend *.b3d"
));
tr
(
"*.md5mesh *.3ds *.md2 *.obj *.dae *.dxf *.mesh.xml *.blend *.b3d"
));
loadNewMesh
(
fn
);
loadNewMesh
(
fn
);
}
void
MainWidget
::
loadNewMesh
(
QString
path
){
...
...
@@ -158,7 +158,7 @@ void MainWidget::setdebugOutput(bool output){
void
MainWidget
::
setRotation
(
bool
started
){
qDebug
()
<<
"rotation"
<<
started
;
this
->
rotation
=
started
;
rotTime
=
QTime
::
currentTime
();
rotTime
=
QTime
::
currentTime
();
}
void
MainWidget
::
setWireframe
(
bool
active
){
...
...
@@ -193,11 +193,11 @@ QOpenGLShaderProgram* MainWidget::initShaderProgram(QString vertSource, QString
QOpenGLShader
*
MainWidget
::
initGLShader
(
QString
scource
,
QOpenGLShader
::
ShaderType
type
){
QOpenGLShader
*
shader
=
new
QOpenGLShader
(
type
);
if
(
!
shader
->
compileSourceFile
(
scource
)){
qCritical
()
<<
type
<<
"Shader"
<<
scource
<<
"failed"
<<
shader
->
log
();
exit
(
5
);
}
return
shader
;
if
(
!
shader
->
compileSourceFile
(
scource
)){
qCritical
()
<<
type
<<
"Shader"
<<
scource
<<
"failed"
<<
shader
->
log
();
exit
(
5
);
}
return
shader
;
}
...
...
@@ -213,17 +213,18 @@ void MainWidget::paintGL(){
rot
.
rotate
(
time
/
100.0
*
36
/
5
,
QVector3D
(
0
,
1
,
0
));
}
if
(
subdivLevel
>
0
){
regularShader
->
bind
();
regularShader
->
setUniformValue
(
"wireframe"
,
wireframe
);
regularShader
->
setUniformValue
(
"colorTexture"
,
0
);
regularShader
->
setUniformValue
(
"LightPos"
,
QVector3D
(
0
,
100
,
100
));
regularShader
->
setUniformValue
(
"subdiv"
,
subdivLevel
);
regularShader
->
bind
();
regularShader
->
setUniformValue
(
"wireframe"
,
wireframe
);
regularShader
->
setUniformValue
(
"colorTexture"
,
0
);
regularShader
->
setUniformValue
(
"LightPos"
,
QVector3D
(
0
,
100
,
100
));
regularShader
->
setUniformValue
(
"subdiv"
,
subdivLevel
);
mesh
->
render
(
regularShader
,
cam
->
getMatrix
()
*
rot
,
m_projection
,
subdivLevel
,
true
);
mesh
->
render
(
regularShader
,
cam
->
getMatrix
()
*
rot
,
m_projection
,
subdivLevel
,
true
);
regularShader
->
release
();
regularShader
->
release
();
}
subdevisionShader
->
bind
();
...
...
QTProject/mesh.cpp
View file @
21f7a420
...
...
@@ -458,18 +458,22 @@ void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision,
std
::
shared_ptr
<
SubdivEntry
>
entry
=
entries
[
index
].
buffers
[
subdivision
];
// Draw Vertex Array
f
->
glBindBuffer
(
GL_ARRAY_BUFFER
,
entry
->
VB_handle
);
f
->
glVertexAttribPointer
(
positionIndex
,
3
,
GL_FLOAT
,
GL_FALSE
,
sizeof
(
Vertex
),
0
);
// qDebug()<<"Render"<<subdivision<<entry->indices;
if
(
regular
){
f
->
glBindBuffer
(
GL_ARRAY_BUFFER
,
entries
[
index
].
buffers
[
subdivision
-
1
]
->
VB_handle
);
f
->
glVertexAttribPointer
(
positionIndex
,
3
,
GL_FLOAT
,
GL_FALSE
,
sizeof
(
Vertex
),
0
);
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_ARRAY_BUFFER
,
entry
->
VB_handle
);
f
->
glVertexAttribPointer
(
positionIndex
,
3
,
GL_FLOAT
,
GL_FALSE
,
sizeof
(
Vertex
),
0
);
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 @
21f7a420
...
...
@@ -12,7 +12,7 @@ void main()
tcPosition[gl_InvocationID] = vPosition[gl_InvocationID];
float tesselation = subdiv+
6
;
float tesselation = subdiv+
15
;
gl_TessLevelOuter[0] = tesselation;
gl_TessLevelOuter[1] = tesselation;
...
...
QTProject/subdivideRegular.tes
View file @
21f7a420
...
...
@@ -59,11 +59,12 @@ void main()
vec3 newPos= a0*p0+a1*p1+a2*p2+a3*p3+a4*p4+a5*p5+a6*p6+a7*p7+a8*p8+a9*p9+a10*p10+a11*p11;
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;
...
...
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