Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
OpenGL
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
C-Fu
OpenGL
Commits
b3a8b4bb
Commit
b3a8b4bb
authored
Nov 20, 2016
by
Anakin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
triangulation implemented,
now need to test it
parent
f81f0335
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
7 deletions
+38
-7
MshViewer/Source/OpenGlController.cpp
MshViewer/Source/OpenGlController.cpp
+36
-4
README.md
README.md
+2
-3
No files found.
MshViewer/Source/OpenGlController.cpp
View file @
b3a8b4bb
...
...
@@ -342,10 +342,16 @@ void OpenGLController::updateScene()
// give the MVP to the shader
glUniformMatrix4fv
(
gluiMatrixID
,
1
,
GL_FALSE
,
&
getMVPMatrix
(
modelIndex
)[
0
][
0
]);
glDrawArrays
(
GL_TRIANGLES
,
instanceOffset
,
segIt
->
meshIndices
.
size
()
*
3
);
// calculate the number of vertex
unsigned
int
vertexCount
(
0
);
for
(
auto
&
it
:
segIt
->
meshIndices
)
vertexCount
+=
(
it
->
size
()
-
2
)
*
3
;
glDrawArrays
(
GL_TRIANGLES
,
instanceOffset
,
vertexCount
);
// increase the offset
instanceOffset
+=
segIt
->
meshIndices
.
size
()
*
3
;
instanceOffset
+=
vertexCount
;
}
}
...
...
@@ -407,8 +413,34 @@ void OpenGLController::loadMsh(const char * path)
}
else
if
(
mshIt
->
size
()
>
3
)
// needs to be triangulated
{
//TODO: triangulate;
MessageBox
(
NULL
,
"Ooops!"
,
"MeshViewer 2.0 Error"
,
MB_OK
|
MB_ICONERROR
);
// for every triangle of the multi polygon
for
(
int
tri
=
0
;
tri
<
mshIt
->
size
()
-
2
;
tri
++
)
{
// for every edge of the triangle
for
(
int
triEdge
=
0
;
triEdge
<
3
;
triEdge
++
)
{
Vertex
tempVertex
;
// every edge has 3 coordinates
for
(
int
j
=
0
;
j
<
3
;
j
++
)
tempVertex
.
position
[
j
]
=
(
GLfloat
)
segIt
->
vertex
[(
*
mshIt
)[
triEdge
>
0
?
tri
+
triEdge
:
0
]
*
3
+
j
];
// and 2 UV
if
(
segIt
->
uv
==
NULL
)
{
tempVertex
.
uv
[
0
]
=
1.0
;
tempVertex
.
uv
[
1
]
=
1.0
;
}
else
{
for
(
int
j
=
0
;
j
<
2
;
j
++
)
tempVertex
.
uv
[
j
]
=
(
GLfloat
)
segIt
->
uv
[(
*
mshIt
)[
triEdge
>
0
?
tri
+
triEdge
:
0
]
*
2
+
j
];
}
tempBufferData
.
push_back
(
tempVertex
);
}
}
//TODO: test triangulation
//MessageBox(NULL, "Ooops!", "MeshViewer 2.0 Error", MB_OK | MB_ICONERROR);
}
else
// this shouldn't happen (polygon with less then 3 vertex)
{
...
...
README.md
View file @
b3a8b4bb
...
...
@@ -14,10 +14,9 @@ licence, too.
### To Do
-
cluster seam to use wrong textures
-
multipoly testing
-
cloth testing
-
colisions are displayed (dont touch hiden things)
-
bones are not triangulated,
-
nulls are not triangulated,
-
optional display bones, shadow, collision,...
-
integrate into a software:
-> gui open file ( + drag and drop),
-> list all msh under a directory,
...
...
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