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
5858c94b
Commit
5858c94b
authored
Jul 01, 2016
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add hacky way of creating a new Mesh object
parent
f5b67cfe
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
1 deletion
+46
-1
mesh.cpp
QTProject/mesh.cpp
+44
-0
mesh.h
QTProject/mesh.h
+1
-0
subdivision.cpp
QTProject/subdivision.cpp
+1
-1
No files found.
QTProject/mesh.cpp
View file @
5858c94b
...
@@ -177,6 +177,50 @@ Mesh::Mesh(QOpenGLFunctions_4_3_Core *f,QString fileName)
...
@@ -177,6 +177,50 @@ Mesh::Mesh(QOpenGLFunctions_4_3_Core *f,QString fileName)
}
}
}
}
Mesh
::
Mesh
(
QOpenGLFunctions_4_3_Core
*
f
,
Mesh
*
mesh
,
QVector
<
Vertex
>
&
vertex_buffer
,
QVector
<
GLuint
>
&
index_buffer
)
{
loaded
=
false
;
this
->
f
=
mesh
->
f
;
scene
=
mesh
->
scene
;
//Init Materials
for
(
int
i
=
0
;
i
<
mesh
->
materials
.
size
();
i
++
)
{
materials
.
push_back
(
mesh
->
materials
[
i
]);
}
entries
.
resize
(
1
);
entries
[
0
].
name
=
mesh
->
entries
[
0
].
name
;
entries
[
0
].
materialIndex
=
mesh
->
entries
[
0
].
materialIndex
;
entries
[
0
].
init
(
f
,
vertex_buffer
,
index_buffer
);
rootNode
.
name
=
mesh
->
rootNode
.
name
;
rootNode
.
transformation
=
mesh
->
rootNode
.
transformation
;
rootNode
.
meshes
.
resize
(
1
);
rootNode
.
meshes
[
0
]
=
0
;
globalInverseTransform
=
rootNode
.
transformation
.
inverted
();
double
amax
=
std
::
numeric_limits
<
float
>::
max
();
QVector3D
min
=
QVector3D
(
amax
,
amax
,
amax
);
QVector3D
max
=
QVector3D
(
-
amax
,
-
amax
,
-
amax
);
findObjectDimension
(
rootNode
,
QMatrix4x4
(),
min
,
max
);
qDebug
()
<<
"AABB"
<<
min
<<
max
;
float
dist
=
qMax
(
max
.
x
()
-
min
.
x
(),
qMax
(
max
.
y
()
-
min
.
y
(),
max
.
z
()
-
min
.
z
()));
float
sc
=
100.0
/
dist
;
QVector3D
center
=
(
max
-
min
)
/
2
;
QVector3D
trans
=
-
(
max
-
center
);
// Apply the scale and translation to a matrix
screenTransform
.
setToIdentity
();
screenTransform
.
scale
(
sc
);
screenTransform
.
translate
(
trans
);
loaded
=
true
;
}
Mesh
::~
Mesh
()
Mesh
::~
Mesh
()
{
{
entries
.
clear
();
entries
.
clear
();
...
...
QTProject/mesh.h
View file @
5858c94b
...
@@ -48,6 +48,7 @@ class Mesh
...
@@ -48,6 +48,7 @@ class Mesh
{
{
public
:
public
:
Mesh
(
QOpenGLFunctions_4_3_Core
*
f
,
QString
filename
);
Mesh
(
QOpenGLFunctions_4_3_Core
*
f
,
QString
filename
);
Mesh
(
QOpenGLFunctions_4_3_Core
*
f
,
Mesh
*
mesh
,
QVector
<
Vertex
>
&
vertex_buffer
,
QVector
<
GLuint
>
&
index_buffer
);
~
Mesh
();
~
Mesh
();
void
render
(
QOpenGLShaderProgram
*
shader
,
QMatrix4x4
V
,
QMatrix4x4
P
);
void
render
(
QOpenGLShaderProgram
*
shader
,
QMatrix4x4
V
,
QMatrix4x4
P
);
...
...
QTProject/subdivision.cpp
View file @
5858c94b
...
@@ -58,7 +58,7 @@ Mesh *Subdivision::subdivide(Mesh *mesh) {
...
@@ -58,7 +58,7 @@ Mesh *Subdivision::subdivide(Mesh *mesh) {
Tables
tables
=
precomputeTables
(
input
);
Tables
tables
=
precomputeTables
(
input
);
Result
result
=
runShader
(
input
,
tables
);
Result
result
=
runShader
(
input
,
tables
);
return
NULL
;
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