Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OpenGL
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
C-Fu
OpenGL
Commits
bcdc17c3
Commit
bcdc17c3
authored
8 years ago
by
Anakin
Browse files
Options
Downloads
Patches
Plain Diff
shorten code,
tested multipoly, there are some problems, look at the README.md,
parent
b3a8b4bb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MshViewer/Source/OpenGlController.cpp
+3
-29
3 additions, 29 deletions
MshViewer/Source/OpenGlController.cpp
README.md
+3
-2
3 additions, 2 deletions
README.md
with
6 additions
and
31 deletions
MshViewer/Source/OpenGlController.cpp
+
3
−
29
View file @
bcdc17c3
...
...
@@ -388,33 +388,10 @@ void OpenGLController::loadMsh(const char * path)
{
for
(
auto
&
mshIt
:
segIt
->
meshIndices
)
// for every polygon
{
if
(
mshIt
->
size
()
==
3
)
// already triangulated
{
for
(
int
i
=
0
;
i
<
3
;
i
++
)
// for every edge of the polygon
{
Vertex
tempVertex
;
// every edge has 3 coordinates
for
(
int
j
=
0
;
j
<
3
;
j
++
)
tempVertex
.
position
[
j
]
=
(
GLfloat
)
segIt
->
vertex
[(
*
mshIt
)[
i
]
*
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
)[
i
]
*
2
+
j
];
}
tempBufferData
.
push_back
(
tempVertex
);
}
}
else
if
(
mshIt
->
size
()
>
3
)
// needs to be triangulated
if
(
mshIt
->
size
()
>=
3
)
// multipoly
{
// for every triangle of the multi polygon
for
(
int
tri
=
0
;
tri
<
mshIt
->
size
()
-
2
;
tri
++
)
for
(
unsigned
int
tri
=
0
;
tri
<
mshIt
->
size
()
-
2
;
tri
++
)
{
// for every edge of the triangle
for
(
int
triEdge
=
0
;
triEdge
<
3
;
triEdge
++
)
...
...
@@ -438,11 +415,8 @@ void OpenGLController::loadMsh(const char * path)
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)
else
// this shouldn't happen (polygon with less then 3 vertex)
{
deleteVectors
();
MessageBox
(
NULL
,
"You have polygons with less then 3 vertices!"
,
"MeshViewer 2.0 Error"
,
MB_OK
|
MB_ICONERROR
);
...
...
This diff is collapsed.
Click to expand it.
README.md
+
3
−
2
View file @
bcdc17c3
...
...
@@ -13,8 +13,9 @@ Feel free to use my code the way you like. But remember i used some public libra
licence, too.
### To Do
-
cluster seam to use wrong textures
-
multipoly testing
-
cluster use wrong textures
-
use normals or fix ccw and cw
-
multipoly triangulation not 100% good
-
cloth testing
-
optional display bones, shadow, collision,...
-
integrate into a software:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment