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
9d5ca018
Commit
9d5ca018
authored
Aug 25, 2016
by
Philipp Adolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add mesh logging category
parent
fa6a6559
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
19 deletions
+20
-19
mesh.cpp
QTProject/mesh.cpp
+20
-19
No files found.
QTProject/mesh.cpp
View file @
9d5ca018
#include "logcategories.h"
#include "mesh.h"
Mesh
::
SubdivEntry
::
SubdivEntry
()
...
...
@@ -9,7 +10,7 @@ Mesh::SubdivEntry::SubdivEntry()
Mesh
::
SubdivEntry
::~
SubdivEntry
()
{
q
Debug
(
)
<<
"FIXME: Delete Called: num vertex:"
<<
vertices
.
size
();
q
CDebug
(
log_mesh
)
<<
"FIXME: Delete Called: num vertex:"
<<
vertices
.
size
();
/*f->glDeleteBuffers(1, &VB_handle);
f->glDeleteBuffers(1, &IB_irregular_handle);
f->glDeleteBuffers(1, &IB_regular_handle);
...
...
@@ -48,9 +49,9 @@ void Mesh::SubdivEntry::init(QOpenGLFunctions_4_3_Core *f, GLuint VB_handle, QVe
indices_irregular
=
Indices_irregular
;
indices_regular
=
patches
;
q
Debug
(
)
<<
"Vertices"
<<
vertices
.
length
();
q
Debug
(
)
<<
"Indices irregular"
<<
indices_irregular
.
length
();
q
Debug
(
)
<<
"Indices patches"
<<
patches
.
length
();
q
CDebug
(
log_mesh
)
<<
"Vertices"
<<
vertices
.
length
();
q
CDebug
(
log_mesh
)
<<
"Indices irregular"
<<
indices_irregular
.
length
();
q
CDebug
(
log_mesh
)
<<
"Indices patches"
<<
patches
.
length
();
f
->
glGenBuffers
(
1
,
&
IB_irregular_handle
);
f
->
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
IB_irregular_handle
);
...
...
@@ -149,10 +150,10 @@ Mesh::Mesh(QOpenGLFunctions_4_3_Core *f,QString fileName)
aiProcess_Triangulate
);
q
Debug
(
)
<<
"File Read"
;
q
CDebug
(
log_mesh
)
<<
"File Read"
;
if
(
!
scene
)
{
q
Debug
(
)
<<
importer
.
GetErrorString
();
q
CDebug
(
log_mesh
)
<<
importer
.
GetErrorString
();
}
else
{
QString
dir
=
QFileInfo
(
fileName
).
path
();
...
...
@@ -166,10 +167,10 @@ Mesh::Mesh(QOpenGLFunctions_4_3_Core *f,QString fileName)
material
->
Get
(
AI_MATKEY_NAME
,
mname
);
initMaterial
(
dir
,
i
,
material
);
q
Debug
(
)
<<
"Loaded Material"
<<
(
i
+
1
)
<<
"/"
<<
scene
->
mNumMaterials
<<
":"
<<
mname
.
C_Str
()
<<
"Shininess"
<<
materials
[
i
].
Shininess
;
q
CDebug
(
log_mesh
)
<<
"Loaded Material"
<<
(
i
+
1
)
<<
"/"
<<
scene
->
mNumMaterials
<<
":"
<<
mname
.
C_Str
()
<<
"Shininess"
<<
materials
[
i
].
Shininess
;
}
}
q
Debug
(
)
<<
"Materials Read"
;
q
CDebug
(
log_mesh
)
<<
"Materials Read"
;
//Init Mesh
if
(
scene
->
HasMeshes
())
...
...
@@ -185,7 +186,7 @@ Mesh::Mesh(QOpenGLFunctions_4_3_Core *f,QString fileName)
return
;
}
q
Debug
(
)
<<
"Mesh Read"
;
q
CDebug
(
log_mesh
)
<<
"Mesh Read"
;
//init Nodes
if
(
scene
->
mRootNode
!=
NULL
)
...
...
@@ -200,9 +201,9 @@ Mesh::Mesh(QOpenGLFunctions_4_3_Core *f,QString fileName)
{
rootNode
.
meshes
[
i
]
=
i
;
}
q
Debug
(
)
<<
"No Root Node"
;
q
CDebug
(
log_mesh
)
<<
"No Root Node"
;
}
q
Debug
(
)
<<
"Nodes Read"
;
q
CDebug
(
log_mesh
)
<<
"Nodes Read"
;
globalInverseTransform
=
rootNode
.
transformation
.
inverted
();
...
...
@@ -211,7 +212,7 @@ Mesh::Mesh(QOpenGLFunctions_4_3_Core *f,QString fileName)
QVector3D
max
=
QVector3D
(
-
amax
,
-
amax
,
-
amax
);
findObjectDimension
(
rootNode
,
QMatrix4x4
(),
min
,
max
);
q
Debug
(
)
<<
"AABB"
<<
min
<<
max
;
q
CDebug
(
log_mesh
)
<<
"AABB"
<<
min
<<
max
;
float
dist
=
qMax
(
max
.
x
()
-
min
.
x
(),
qMax
(
max
.
y
()
-
min
.
y
(),
max
.
z
()
-
min
.
z
()));
float
sc
=
100.0
/
dist
;
...
...
@@ -256,7 +257,7 @@ Mesh::Mesh(QOpenGLFunctions_4_3_Core *f, Mesh *mesh, QVector<Vertex> &vertex_buf
QVector3D
max
=
QVector3D
(
-
amax
,
-
amax
,
-
amax
);
findObjectDimension
(
rootNode
,
QMatrix4x4
(),
min
,
max
);
q
Debug
(
)
<<
"AABB"
<<
min
<<
max
;
q
CDebug
(
log_mesh
)
<<
"AABB"
<<
min
<<
max
;
float
dist
=
qMax
(
max
.
x
()
-
min
.
x
(),
qMax
(
max
.
y
()
-
min
.
y
(),
max
.
z
()
-
min
.
z
()));
float
sc
=
100.0
/
dist
;
...
...
@@ -290,16 +291,16 @@ void Mesh::initNode(const aiScene *scene, aiNode *node, Node &newNode,QString de
newNode
.
transformation
=
QMatrix4x4
(
node
->
mTransformation
[
0
]);
newNode
.
meshes
.
resize
(
node
->
mNumMeshes
);
if
(
debug
)
q
Debug
(
)
<<
debugoffset
.
toStdString
().
c_str
()
<<
"NodeName"
<<
newNode
.
name
;
if
(
debug
)
q
Debug
(
)
<<
debugoffset
.
toStdString
().
c_str
()
<<
" NumMeshes"
<<
newNode
.
meshes
.
size
();
if
(
debug
)
q
CDebug
(
log_mesh
)
<<
debugoffset
.
toStdString
().
c_str
()
<<
"NodeName"
<<
newNode
.
name
;
if
(
debug
)
q
CDebug
(
log_mesh
)
<<
debugoffset
.
toStdString
().
c_str
()
<<
" NumMeshes"
<<
newNode
.
meshes
.
size
();
for
(
uint
i
=
0
;
i
<
node
->
mNumMeshes
;
++
i
)
{
newNode
.
meshes
[
i
]
=
node
->
mMeshes
[
i
];
if
(
debug
)
q
Debug
(
)
<<
debugoffset
.
toStdString
().
c_str
()
<<
" MeshName"
<<
entries
[
newNode
.
meshes
[
i
]].
name
;
if
(
debug
)
q
CDebug
(
log_mesh
)
<<
debugoffset
.
toStdString
().
c_str
()
<<
" MeshName"
<<
entries
[
newNode
.
meshes
[
i
]].
name
;
}
if
(
debug
)
q
Debug
(
)
<<
debugoffset
.
toStdString
().
c_str
()
<<
" NumChildren"
<<
node
->
mNumChildren
;
if
(
debug
)
q
CDebug
(
log_mesh
)
<<
debugoffset
.
toStdString
().
c_str
()
<<
" NumChildren"
<<
node
->
mNumChildren
;
QString
newDebug
=
QString
(
debugoffset
).
append
(
" "
);
for
(
uint
i
=
0
;
i
<
node
->
mNumChildren
;
++
i
)
{
...
...
@@ -381,7 +382,7 @@ void Mesh::initMeshEntry(int index, aiMesh * entry) {
entries
[
index
].
name
=
entry
->
mName
.
length
!=
0
?
entry
->
mName
.
C_Str
()
:
""
;
entries
[
index
].
materialIndex
=
entry
->
mMaterialIndex
;
q
Debug
(
)
<<
"Loaded Mesh:"
<<
entries
[
index
].
name
<<
"HasBones:"
<<
entry
->
HasBones
();
q
CDebug
(
log_mesh
)
<<
"Loaded Mesh:"
<<
entries
[
index
].
name
<<
"HasBones:"
<<
entry
->
HasBones
();
entries
[
index
].
init
(
f
,
Vertices
,
Indices
);
}
...
...
@@ -429,7 +430,7 @@ void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision,
{
int
MaterialIndex
=
entries
[
index
].
materialIndex
;
if
(
MaterialIndex
<
materials
.
size
())
{
// q
Debug(
) << materials[MaterialIndex].Diffuse << materials[MaterialIndex].Specular << materials[MaterialIndex].Shininess << materials[MaterialIndex].hasTexture;
// q
CDebug(log_mesh
) << materials[MaterialIndex].Diffuse << materials[MaterialIndex].Specular << materials[MaterialIndex].Shininess << materials[MaterialIndex].hasTexture;
if
(
regular
)
{
shader
->
setUniformValue
(
"materialInfo.Diffuse"
,
QVector3D
(
0.0
f
,
0.0
f
,
1.0
f
));
...
...
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