Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
C-Fu
OpenGL
Commits
2524971d
Commit
2524971d
authored
Nov 12, 2016
by
Anakin
Browse files
include all parent modelmatrices
parent
15743e11
Changes
4
Hide whitespace changes
Inline
Side-by-side
MshViewer/Header/OpenGLController.h
View file @
2524971d
...
...
@@ -102,6 +102,7 @@ private:
void
startGLEW
();
void
setCallbackFunctions
();
glm
::
mat4
getModelMatrix
(
unsigned
int
index
);
glm
::
mat4
getMVPMatrix
(
unsigned
int
index
);
...
...
MshViewer/Source/OpenGlController.cpp
View file @
2524971d
...
...
@@ -184,6 +184,22 @@ void OpenGLController::setCallbackFunctions()
glfwSetKeyCallback
(
pWindow
,
keyPress
);
}
glm
::
mat4
OpenGLController
::
getModelMatrix
(
unsigned
int
index
)
{
glm
::
mat4
tempParentMatrix
=
glm
::
mat4
(
1.0
f
);
for
(
unsigned
int
loop
=
0
;
loop
<
vModels
.
size
();
loop
++
)
{
if
(
!
strcmp
(
vModels
[
index
]
->
parent
.
c_str
(),
vModels
[
loop
]
->
name
.
c_str
()))
{
tempParentMatrix
=
getModelMatrix
(
loop
);
break
;
}
}
return
tempParentMatrix
*
vModels
[
index
]
->
m4x4Translation
;
}
glm
::
mat4
OpenGLController
::
getMVPMatrix
(
unsigned
int
index
)
{
// Projection
...
...
@@ -196,10 +212,6 @@ glm::mat4 OpenGLController::getMVPMatrix(unsigned int index)
glm
::
vec3
(
0
,
1
,
0
)
);
// Model
//TODO for all
glm
::
mat4
m4x4Model
=
vModels
[
index
]
->
m4x4Translation
;
// User controlled rotation
glm
::
mat4
m4x4ModelRot
=
glm
::
mat4
(
1.0
f
);
m4x4ModelRot
=
glm
::
rotate
(
m4x4ModelRot
,
fRotationX
,
glm
::
vec3
(
1
,
0
,
0
));
...
...
@@ -207,7 +219,7 @@ glm::mat4 OpenGLController::getMVPMatrix(unsigned int index)
m4x4ModelRot
=
glm
::
rotate
(
m4x4ModelRot
,
fRotationZ
,
glm
::
vec3
(
0
,
0
,
1
));
// Return MVP
return
m4x4Projection
*
m4x4View
*
m4x4ModelRot
*
m4x4
Model
;
return
m4x4Projection
*
m4x4View
*
m4x4ModelRot
*
get
Model
Matrix
(
index
)
;
}
...
...
MshViewer/main.cpp
View file @
2524971d
...
...
@@ -20,8 +20,7 @@ int main(int argc, char** argv)
else
scene
=
OpenGLController
::
getInstance
();
scene
->
loadMsh
(
"..
\\
Release
\\
Msh
\\
multiModTex.msh"
);
//scene->loadMsh("..\\Release\\Msh\\cubeTex.msh");
scene
->
loadMsh
(
"..
\\
Release
\\
Msh
\\
structured.msh"
);
do
{
scene
->
updateScene
();
...
...
Release/Msh/structured.msh
0 → 100644
View file @
2524971d
File added
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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